Skip to content

Commit

Permalink
deploy registry split to prod (#9853)
Browse files Browse the repository at this point in the history
  • Loading branch information
sean1588 authored Sep 22, 2023
1 parent 66c21d1 commit 65181ac
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
1 change: 1 addition & 0 deletions infrastructure/Pulumi.www-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ config:
www.pulumi.com:websiteLogsBucketName: www-prod.pulumi.com-website-logs
www.pulumi.com:hostedZone: www.pulumi.com
www.pulumi.com:setRootRecord: true
www.pulumi.com:registryStack: "pulumi/registry/production"
2 changes: 1 addition & 1 deletion infrastructure/Pulumi.www-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ config:
www.pulumi.com:websiteLogsBucketName: pulumi-test-io-website-logs
www.pulumi.com:hostedZone: www.pulumi-test.io
www.pulumi.com:setRootRecord: true
www.pulumi.com:testingFlow: true
www.pulumi.com:registryStack: "pulumi/registry/testing"
19 changes: 7 additions & 12 deletions infrastructure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import { getLambdaFunctionAssociations } from "./cloudfrontLambdaAssociations";

const stackConfig = new pulumi.Config();

const stackRef = new pulumi.StackReference(`pulumi/registry/testing`)
const registryCDN = stackRef.getOutput("cloudFrontDomain");

const config = {
// websiteDomain is the domain/host to serve content at.
websiteDomain: stackConfig.require("websiteDomain"),
Expand Down Expand Up @@ -49,10 +46,9 @@ const config = {
// (e.g. in dev environment) you may want to set this to false. This will then take the subdomain
// of the `websiteDomain` rather than use the root of that zone.
setRootRecord: stackConfig.get("setRootRecord") || undefined,

// testingFlow is a flag set in the stack config and used to indicate which pieces of infrastructure
// should be created when run against the test environment.
testingFlow: stackConfig.getBoolean("testingFlow") || undefined,

// the registry stack to reference to route traffic to for `/registry` routes.
registryStack: stackConfig.get("registryStack"),
};

const aiAppStack = new pulumi.StackReference('pulumi/pulumi-ai-app-infra/prod');
Expand Down Expand Up @@ -121,8 +117,6 @@ const uploadsBucketAcl = new aws.s3.BucketAclV2("uploads-bucket-acl", {
dependsOn: [uploadsBucketPublicAccessBlock, uploadsBucketOwnershipControls],
});

// Create a bucket to store bundle files. These will be served under the /css, /js route using a custom cloudfront behavior
// which will only be configured in the testing flow.
const bundlesBucket = new aws.s3.Bucket("bundles-bucket", {
website: {
indexDocument: "index.html",
Expand Down Expand Up @@ -271,9 +265,10 @@ const bundleBehaviors: aws.types.input.cloudfront.DistributionOrderedCacheBehavi
const registryOrigins: aws.types.input.cloudfront.DistributionOrigin[] = [];
const registryBehaviors: aws.types.input.cloudfront.DistributionOrderedCacheBehavior[] = [];

// Only provision additional cloudfront behavors and origins if we're in the testing flow as to not make
// any changes to the production infrastructure at this point.
if (config.testingFlow) {
if (config.registryStack) {
const registryStack = new pulumi.StackReference(config.registryStack);
const registryCDN = registryStack.getOutput("cloudFrontDomain");

bundleOrigins.push(
{
originId: bundlesBucket.arn,
Expand Down

0 comments on commit 65181ac

Please sign in to comment.