Skip to content

Commit

Permalink
Tag more things
Browse files Browse the repository at this point in the history
  • Loading branch information
clareliguori committed Feb 22, 2020
1 parent 16fc127 commit daf5ccf
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 8 deletions.
5 changes: 5 additions & 0 deletions chat-bot/StackConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"Tags" : {
"project" : "reinvent-trivia"
}
}
1 change: 1 addition & 0 deletions chat-bot/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ artifacts:
files:
- chat-bot/TriviaGameChatBotTest.template.yaml
- chat-bot/TriviaGameChatBotProd.template.yaml
- chat-bot/StackConfig.json
discard-paths: yes
4 changes: 2 additions & 2 deletions pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ In [src](src/) directory:
Create a GitHub [personal access token](https://github.com/settings/tokens) with access to your fork of the repo, including "admin:repo_hook" and "repo" permissions. Then store the token in Secrets Manager:

```
aws secretsmanager create-secret --region us-east-1 --name TriviaGitHubToken --secret-string <my-github-personal-access-token>
aws secretsmanager create-secret --region us-east-1 --name TriviaGitHubToken --tags Key=project,Value=reinvent-trivia --secret-string <my-github-personal-access-token>
```

Create an SNS topic for notifications about pipeline execution failures. An email address or to a [chat bot](https://docs.aws.amazon.com/chatbot/latest/adminguide/setting-up.html) can be subscribed to the topic to receive notifications about pipeline failures.
```
aws sns create-topic --name reinvent-trivia-notifications --region us-east-1
aws sns create-topic --name reinvent-trivia-notifications --tags Key=project,Value=reinvent-trivia --region us-east-1
```

Follow the [CodeStar Notifications user guide](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/set-up-sns.html) to configure the SNS topic to be able to receive notifications about pipeline failures.
Expand Down
2 changes: 2 additions & 0 deletions pipelines/src/api-service-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class TriviaGameBackendPipelineStack extends cdk.Stack {
runOrder: 1,
adminPermissions: true,
templatePath: buildArtifact.atPath(templatePrefix + 'Test.template.json'),
templateConfiguration: buildArtifact.atPath('StackConfig.json'),
}),
new actions.CloudFormationExecuteChangeSetAction({
actionName: 'ExecuteChangesTest',
Expand All @@ -156,6 +157,7 @@ class TriviaGameBackendPipelineStack extends cdk.Stack {
runOrder: 1,
adminPermissions: true,
templatePath: buildArtifact.atPath(templatePrefix + 'Prod.template.json'),
templateConfiguration: buildArtifact.atPath('StackConfig.json'),
}),
new actions.CloudFormationExecuteChangeSetAction({
actionName: 'ExecuteChangesProd',
Expand Down
2 changes: 2 additions & 0 deletions pipelines/src/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class TriviaGameCfnPipeline extends cdk.Construct {
runOrder: 1,
adminPermissions: true,
templatePath: buildArtifact.atPath(templatePrefix + 'Test.template.yaml'),
templateConfiguration: buildArtifact.atPath('StackConfig.json'),
}),
new actions.CloudFormationExecuteChangeSetAction({
actionName: 'ExecuteChangesTest',
Expand All @@ -122,6 +123,7 @@ export class TriviaGameCfnPipeline extends cdk.Construct {
runOrder: 1,
adminPermissions: true,
templatePath: buildArtifact.atPath(templatePrefix + 'Prod.template.yaml'),
templateConfiguration: buildArtifact.atPath('StackConfig.json'),
}),
new actions.CloudFormationExecuteChangeSetAction({
actionName: 'ExecuteChangesProd',
Expand Down
8 changes: 4 additions & 4 deletions trivia-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ The trivia backend is a REST API that serves questions and answers. A running e
Create an ECR repository for both the base Docker image and the application image.

```
aws ecr create-repository --region us-east-1 --repository-name reinvent-trivia-backend
aws ecr create-repository --region us-east-1 --tags Key=project,Value=reinvent-trivia --repository-name reinvent-trivia-backend
aws ecr create-repository --region us-east-1 --repository-name reinvent-trivia-backend-base
aws ecr create-repository --region us-east-1 --tags Key=project,Value=reinvent-trivia --repository-name reinvent-trivia-backend-base
```

Create AWS Certificate Manager certificates for the 'api' and 'test-api' subdomains, then put the unique ARN of those certificates in an AWS Systems Manager Parameter Store parameter.

```
aws ssm put-parameter --region us-east-1 --name CertificateArn-api.reinvent-trivia.com --type String --value arn:aws:acm:...
aws ssm put-parameter --region us-east-1 --tags Key=project,Value=reinvent-trivia --name CertificateArn-api.reinvent-trivia.com --type String --value arn:aws:acm:...
aws ssm put-parameter --region us-east-1 --name CertificateArn-test-api.reinvent-trivia.com --type String --value arn:aws:acm:...
aws ssm put-parameter --region us-east-1 --tags Key=project,Value=reinvent-trivia --name CertificateArn-test-api.reinvent-trivia.com --type String --value arn:aws:acm:...
```

## Customize
Expand Down
5 changes: 5 additions & 0 deletions trivia-backend/infra/cdk/StackConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"Tags" : {
"project" : "reinvent-trivia"
}
}
1 change: 1 addition & 0 deletions trivia-backend/infra/cdk/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ phases:
- npm ci
- npm run build
- cdk synth -o build --app 'node ecs-service.js'
- cp StackConfig.json build/

artifacts:
files:
Expand Down
5 changes: 3 additions & 2 deletions trivia-backend/infra/cdk/ecs-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Certificate } from '@aws-cdk/aws-certificatemanager';
import { Vpc } from '@aws-cdk/aws-ec2';
import { Repository } from '@aws-cdk/aws-ecr';
import { Cluster, ContainerImage } from '@aws-cdk/aws-ecs';
import { Cluster, ContainerImage, PropagatedTagSource } from '@aws-cdk/aws-ecs';
import { ApplicationLoadBalancedFargateService } from '@aws-cdk/aws-ecs-patterns';
import { HostedZone } from '@aws-cdk/aws-route53';
import { StringParameter } from '@aws-cdk/aws-ssm';
Expand Down Expand Up @@ -43,7 +43,8 @@ class TriviaBackendStack extends cdk.Stack {
desiredCount: 3,
domainName: props.domainName,
domainZone,
certificate
certificate,
propagateTags: PropagatedTagSource.SERVICE,
});
}
}
Expand Down

0 comments on commit daf5ccf

Please sign in to comment.