Skip to content

Commit 609ee46

Browse files
committed
Revert "docs: update readme"
This reverts commit 118e529.
1 parent 47d67ec commit 609ee46

File tree

1 file changed

+46
-59
lines changed
  • packages/cdk-blue-green-container-deployment

1 file changed

+46
-59
lines changed

packages/cdk-blue-green-container-deployment/README.md

Lines changed: 46 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![cloudcomponents Logo](https://raw.githubusercontent.com/cloudcomponents/cdk-constructs/master/logo.png)](https://github.com/cloudcomponents/cdk-constructs)
22

3-
# @cloudcomponents/cdk-blue-green-container-deployment
3+
# @cloudcomponents/cdk-blue-green-container-deployment
44

55
[![Build Status](https://github.com/cloudcomponents/cdk-constructs/workflows/Build/badge.svg)](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build)
66
[![cdkdx](https://img.shields.io/badge/buildtool-cdkdx-blue.svg)](https://github.com/hupe1980/cdkdx)
@@ -11,7 +11,6 @@
1111
> Blue green container deployment with CodeDeploy
1212
1313
## Install
14-
1514
TypeScript/JavaScript:
1615

1716
```bash
@@ -27,97 +26,97 @@ pip install cloudcomponents.cdk-blue-green-container-deployment
2726
## How to use
2827

2928
```typescript
30-
import { Construct, Stack, StackProps } from "@aws-cdk/core";
31-
import { Repository } from "@aws-cdk/aws-codecommit";
32-
import { Pipeline, Artifact } from "@aws-cdk/aws-codepipeline";
33-
import { Vpc, Port } from "@aws-cdk/aws-ec2";
34-
import { Cluster } from "@aws-cdk/aws-ecs";
29+
import { Construct, Stack, StackProps } from '@aws-cdk/core';
30+
import { Repository } from '@aws-cdk/aws-codecommit';
31+
import { Pipeline, Artifact } from '@aws-cdk/aws-codepipeline';
32+
import { Vpc, Port } from '@aws-cdk/aws-ec2';
33+
import { Cluster } from '@aws-cdk/aws-ecs';
3534
import {
3635
ApplicationLoadBalancer,
3736
ApplicationTargetGroup,
3837
TargetType,
39-
} from "@aws-cdk/aws-elasticloadbalancingv2";
38+
} from '@aws-cdk/aws-elasticloadbalancingv2';
4039
import {
4140
CodeBuildAction,
4241
CodeCommitSourceAction,
4342
CodeDeployEcsDeployAction,
44-
} from "@aws-cdk/aws-codepipeline-actions";
43+
} from '@aws-cdk/aws-codepipeline-actions';
4544

46-
import { ImageRepository } from "@cloudcomponents/cdk-container-registry";
45+
import { ImageRepository } from '@cloudcomponents/cdk-container-registry';
4746
import {
4847
EcsService,
4948
DummyTaskDefinition,
5049
EcsDeploymentGroup,
5150
PushImageProject,
52-
} from "@cloudcomponents/cdk-blue-green-container-deployment";
51+
} from '@cloudcomponents/cdk-blue-green-container-deployment';
5352

5453
export class BlueGreenContainerDeploymentStack extends Stack {
5554
constructor(scope: Construct, id: string, props?: StackProps) {
5655
super(scope, id, props);
5756

58-
const vpc = new Vpc(this, "Vpc", {
57+
const vpc = new Vpc(this, 'Vpc', {
5958
maxAzs: 2,
6059
});
6160

62-
const cluster = new Cluster(this, "Cluster", {
61+
const cluster = new Cluster(this, 'Cluster', {
6362
vpc,
64-
clusterName: "blue-green-cluster",
63+
clusterName: 'blue-green-cluster',
6564
});
6665

67-
const loadBalancer = new ApplicationLoadBalancer(this, "LoadBalancer", {
66+
const loadBalancer = new ApplicationLoadBalancer(this, 'LoadBalancer', {
6867
vpc,
6968
internetFacing: true,
7069
});
7170

72-
const prodListener = loadBalancer.addListener("ProfListener", {
71+
const prodListener = loadBalancer.addListener('ProfListener', {
7372
port: 80,
7473
});
7574

76-
const testListener = loadBalancer.addListener("TestListener", {
75+
const testListener = loadBalancer.addListener('TestListener', {
7776
port: 8080,
7877
});
7978

8079
const prodTargetGroup = new ApplicationTargetGroup(
8180
this,
82-
"ProdTargetGroup",
81+
'ProdTargetGroup',
8382
{
8483
port: 80,
8584
targetType: TargetType.IP,
8685
vpc,
87-
}
86+
},
8887
);
8988

90-
prodListener.addTargetGroups("AddProdTg", {
89+
prodListener.addTargetGroups('AddProdTg', {
9190
targetGroups: [prodTargetGroup],
9291
});
9392

9493
const testTargetGroup = new ApplicationTargetGroup(
9594
this,
96-
"TestTargetGroup",
95+
'TestTargetGroup',
9796
{
9897
port: 8080,
9998
targetType: TargetType.IP,
10099
vpc,
101-
}
100+
},
102101
);
103102

104-
testListener.addTargetGroups("AddTestTg", {
103+
testListener.addTargetGroups('AddTestTg', {
105104
targetGroups: [testTargetGroup],
106105
});
107106

108107
// Will be replaced by CodeDeploy in CodePipeline
109108
const taskDefinition = new DummyTaskDefinition(
110109
this,
111-
"DummyTaskDefinition",
110+
'DummyTaskDefinition',
112111
{
113-
image: "nginx",
114-
family: "blue-green",
115-
}
112+
image: 'nginx',
113+
family: 'blue-green',
114+
},
116115
);
117116

118-
const ecsService = new EcsService(this, "EcsService", {
117+
const ecsService = new EcsService(this, 'EcsService', {
119118
cluster,
120-
serviceName: "blue-green-service",
119+
serviceName: 'blue-green-service',
121120
desiredCount: 2,
122121
taskDefinition,
123122
prodTargetGroup,
@@ -126,9 +125,9 @@ export class BlueGreenContainerDeploymentStack extends Stack {
126125
ecsService.connections.allowFrom(loadBalancer, Port.tcp(80));
127126
ecsService.connections.allowFrom(loadBalancer, Port.tcp(8080));
128127

129-
const deploymentGroup = new EcsDeploymentGroup(this, "DeploymentGroup", {
130-
applicationName: "blue-green-application",
131-
deploymentGroupName: "blue-green-deployment-group",
128+
const deploymentGroup = new EcsDeploymentGroup(this, 'DeploymentGroup', {
129+
applicationName: 'blue-green-application',
130+
deploymentGroupName: 'blue-green-deployment-group',
132131
ecsServices: [ecsService],
133132
targetGroupNames: [
134133
prodTargetGroup.targetGroupName,
@@ -137,78 +136,66 @@ export class BlueGreenContainerDeploymentStack extends Stack {
137136
prodTrafficListener: prodListener,
138137
testTrafficListener: testListener,
139138
terminationWaitTimeInMinutes: 100,
140-
autoRollbackOnEvents: [RollbackEvent.DEPLOYMENT_FAILURE],
141-
createDeploymentConfigInput: {
142-
computePlatform: "ECS",
143-
deploymentConfigName: "Canary20Percent5Minute",
144-
trafficRoutingConfig: {
145-
type: "TimeBasedCanary",
146-
timeBasedCanary: {
147-
canaryInterval: 5,
148-
canaryPercentage: 20,
149-
},
150-
},
151-
},
152139
});
153140

154141
// @see https://github.com/cloudcomponents/cdk-constructs/tree/master/examples/blue-green-container-deployment-example/blue-green-repository
155-
const repository = new Repository(this, "CodeRepository", {
156-
repositoryName: "blue-green-repository",
142+
const repository = new Repository(this, 'CodeRepository', {
143+
repositoryName: 'blue-green-repository',
157144
});
158145

159-
const imageRepository = new ImageRepository(this, "ImageRepository", {
146+
const imageRepository = new ImageRepository(this, 'ImageRepository', {
160147
forceDelete: true, //Only for tests
161148
});
162149

163150
const sourceArtifact = new Artifact();
164151

165152
const sourceAction = new CodeCommitSourceAction({
166-
actionName: "CodeCommit",
153+
actionName: 'CodeCommit',
167154
repository,
168155
output: sourceArtifact,
169156
});
170157

171-
const imageArtifact = new Artifact("ImageArtifact");
172-
const manifestArtifact = new Artifact("ManifestArtifact");
158+
const imageArtifact = new Artifact('ImageArtifact');
159+
const manifestArtifact = new Artifact('ManifestArtifact');
173160

174-
const pushImageProject = new PushImageProject(this, "PushImageProject", {
161+
const pushImageProject = new PushImageProject(this, 'PushImageProject', {
175162
imageRepository,
176163
taskDefinition,
177164
});
178165

179166
const buildAction = new CodeBuildAction({
180-
actionName: "PushImage",
167+
actionName: 'PushImage',
181168
project: pushImageProject,
182169
input: sourceArtifact,
183170
outputs: [imageArtifact, manifestArtifact],
184171
});
185172

186173
const deployAction = new CodeDeployEcsDeployAction({
187-
actionName: "CodeDeploy",
174+
actionName: 'CodeDeploy',
188175
taskDefinitionTemplateInput: manifestArtifact,
189176
appSpecTemplateInput: manifestArtifact,
190177
containerImageInputs: [
191178
{
192179
input: imageArtifact,
193-
taskDefinitionPlaceholder: "IMAGE1_NAME",
180+
taskDefinitionPlaceholder: 'IMAGE1_NAME',
194181
},
195182
],
196183
deploymentGroup,
197184
});
198185

199-
new Pipeline(this, "Pipeline", {
200-
pipelineName: "blue-green-pipeline",
186+
new Pipeline(this, 'Pipeline', {
187+
pipelineName: 'blue-green-pipeline',
201188
stages: [
202189
{
203-
stageName: "Source",
190+
stageName: 'Source',
204191
actions: [sourceAction],
205192
},
206193
{
207-
stageName: "Build",
194+
stageName: 'Build',
208195
actions: [buildAction],
209196
},
210197
{
211-
stageName: "Deploy",
198+
stageName: 'Deploy',
212199
actions: [deployAction],
213200
},
214201
],

0 commit comments

Comments
 (0)