-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·55 lines (43 loc) · 1.44 KB
/
deploy.sh
File metadata and controls
executable file
·55 lines (43 loc) · 1.44 KB
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
#!/bin/sh
if [ "${S3_BUCKET_NAME}" = "" ]; then
echo "'S3_BUCKET_NAME' should be specified as an environment variable." 1>&2
exit 1
fi
if [ "${CFN_STACK_NAME}" = "" ]; then
echo "'CFN_STACK_NAME' should be specified as an environment variable." 1>&2
exit 1
fi
if [ "${DOCBASE_DOMAIN}" = "" ]; then
echo "'DOCBASE_DOMAIN' should be specified as an environment variable." 1>&2
exit 1
fi
if [ "${DOCBASE_TOKEN}" = "" ]; then
echo "'DOCBASE_TOKEN' should be specified as an environment variable." 1>&2
exit 1
fi
if [ "${SLACK_TOKEN}" = "" ]; then
echo "'SLACK_TOKEN' should be specified as an environment variable." 1>&2
exit 1
fi
cat << EOT
[ Environment variables ]
S3_BUCKET_NAME: ${S3_BUCKET_NAME}
CFN_STACK_NAME: ${CFN_STACK_NAME}
DOCBASE_DOMAIN: ${DOCBASE_DOMAIN}
DOCBASE_TOKEN: *******
SLACK_TOKEN: *******
EOT
aws cloudformation package --template-file template.yaml \
--output-template-file serverless-output.yaml --s3-bucket ${S3_BUCKET_NAME}
aws cloudformation deploy --stack-name ${CFN_STACK_NAME} \
--template-file serverless-output.yaml \
--parameter DocBaseDomain=${DOCBASE_DOMAIN} \
DocBaseToken=${DOCBASE_TOKEN} \
SlackToken=${SLACK_TOKEN} \
--capabilities CAPABILITY_IAM
URL=$( aws cloudformation describe-stacks --stack-name ${CFN_STACK_NAME} \
--query 'Stacks[].Outputs[?OutputKey==`URL`].OutputValue' --output text )
cat << EOT
[ The endpoint base URL ]
${URL}
EOT