-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeploy.sh
executable file
·55 lines (49 loc) · 2.77 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#############################################################
# Deploy WebAPI microservice: #
#############################################################
# 1. Navigate to the CDK project folder for the WebAPI;
# 2. Bootstrap your environment, account, and region to run the CDK project;
# 3. Synthesize the project to validate the implementation and produce the CloudFormation template to be deployed;
# 4. Deploy the CloudFormation Stack after your confirmation;
# 5. Query the VPC ID created from the first Stack and export it to a local environment variable DEMO_VPC_ID
# 6. Query the DemoDeployRegion created from the first Stack and export it to a local environment variable CDK_DEPLOY_REGION
# 7. Navigate back to the root folder
cd WebAPI/src/infra/ \
&& cdk bootstrap \
&& cdk synth \
&& cdk deploy --require-approval never\
&& export DEMO_VPC_ID=$(aws cloudformation describe-stacks --stack-name WebAppInfraStack --output text --query 'Stacks[0].Outputs[?OutputKey==`DemoVpcId`].OutputValue | [0]') \
&& export CDK_DEPLOY_REGION=$(aws cloudformation describe-stacks --stack-name WebAppInfraStack --output text --query 'Stacks[0].Outputs[?OutputKey==`DemoDeployRegion`].OutputValue | [0]') \
&& cd -
#############################################################
# Deploy the first Worker Services microservices #
#############################################################
# 1. Navigate to the CDK project folder for the Worker Service that persists into DynamoDB
# 2. Then synthesize
# 3. and deploy the Stack.
# 4. Navigate back to the root folder
cd ServicesWorkerDb/src/infra/ \
&& cdk synth \
&& cdk deploy --require-approval never\
&& cd -
#############################################################
# Deploy the second Worker Services microservices #
#############################################################
# 1. Navigate to the CDK project folder for the Worker Service that persists into S3 Bucket
# 2. Then synthesize
# 3. and deploy the Stack.
# 4. Navigate back to the root folder
cd ServicesWorkerIntegration/src/infra/ \
&& cdk synth \
&& cdk deploy --require-approval never\
&& cd -
#############################################################
# Echo the WebAPI URL #
#############################################################
echo -e "\n\n"
echo "#############################################################"
echo "# the WebAPI URL #"
echo "#############################################################"
echo -e "\n"
echo $(aws cloudformation describe-stacks --stack-name WebAppInfraStack --output text --query 'Stacks[0].Outputs[?contains(OutputKey,`DemoServiceServiceURLEndpoint`)].OutputValue | [0]')
echo -e "\n\n"