Skip to content

Commit

Permalink
Chore/sandbox account stacks (#62)
Browse files Browse the repository at this point in the history
* Can deploy stacks to any account for testing

* No longer need docker compose
  • Loading branch information
NChitty authored Jun 29, 2024
1 parent a0cfd5c commit 9c440c8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 64 deletions.
29 changes: 26 additions & 3 deletions cdk/bin/meal-planner.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import PipelineStack from '../lib/pipeline';
import * as pipeline from '../lib/pipeline';
import PipelineStack, { ProjectEnvironment, sharedEnvironment } from '../lib/pipeline';
import ApplicationLayerStack from '../lib/application-layer';
import PersistenceLayerStack from '../lib/persistence-layer';
import SharedLayerStack from '../lib/shared-layer';

const app = new cdk.App();

new PipelineStack(app, 'MealPlannerPipeline', {
env: pipeline.sharedEnvironment,
env: sharedEnvironment,
});

const projectEnvironment: ProjectEnvironment = {
account: process.env.AWS_SANDBOX_ACCOUNT || '211125429662',
region: process.env.AWS_SANDBOX_REGION || 'us-east-1',
name: process.env.MEAL_PLANNER_PROJECT_NAME || 'Sandbox',
subdomain: process.env.MEAL_PLANNER_PROJECT_SUBDOMAIN || 'sandbox',
};

const devShared = new SharedLayerStack(app, 'DevSharedLayerStack', {
projectEnvironment,
});

const devPersistence = new PersistenceLayerStack(app, 'DevPersistenceLayerStack');

new ApplicationLayerStack(app, 'DevApplicationLayerStack', {
delegationRole: devShared.hostedZoneDelegate.delegationRole,
parentHostedZoneId: devShared.hostedZone.hostedZoneId,
domain: devShared.hostedZoneDelegate.normalizedDomain,
recipeTable: devPersistence.recipeTable,
});
8 changes: 5 additions & 3 deletions cdk/lib/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import MealPlannerStage from './application-stage';
import {
CodePipeline,
CodePipelineSource,
ManualApprovalStep,
ShellStep,
} from 'aws-cdk-lib/pipelines';
import path = require('path');
Expand Down Expand Up @@ -52,10 +53,10 @@ export default class PipelineStack extends Stack {
super(scope, id, props);

const synth = new ShellStep('Synth', {
/* eslint-disable max-len */
input: CodePipelineSource.connection('NChitty/meal-planner', 'main', {
/* eslint-disable max-len */
connectionArn: 'arn:aws:codestar-connections:us-east-1:211125587522:connection/4aa04046-6a83-4774-ad05-50049811955d',
/* eslint-enable max-len */
/* eslint-enable max-len */
}),
commands: [
'cd cdk',
Expand Down Expand Up @@ -86,6 +87,7 @@ export default class PipelineStack extends Stack {
'npx playwright test',
],
}));
pipeline.addStage(prodStage);
pipeline.addStage(prodStage)
.addPre(new ManualApprovalStep('Promote to Production'));
}
}
58 changes: 0 additions & 58 deletions docker-compose.yml

This file was deleted.

0 comments on commit 9c440c8

Please sign in to comment.