Skip to content

Commit dd7617d

Browse files
committed
Merge branch 'xray-gettingstarted' into xray
2 parents a31412e + 3318355 commit dd7617d

25 files changed

+574
-125
lines changed

.ebextensions/dynamodb-tables.config

Lines changed: 0 additions & 75 deletions
This file was deleted.

.ebextensions/env.config

Lines changed: 0 additions & 10 deletions
This file was deleted.

.ebextensions/sns-topic.config

Lines changed: 0 additions & 3 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ build/*
66
!.elasticbeanstalk/*.cfg.yml
77
!.elasticbeanstalk/*.global.yml
88
*.zip
9-
*.sh
9+
bucket-name.txt
1010
!bin/*.sh
1111
!_lambda/*.sh
1212
lib
1313
_lambda/random-name/node_modules/*
14+
out.yml

1-create-bucket.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
BUCKET_ID=$(dd if=/dev/random bs=8 count=1 2>/dev/null | od -An -tx1 | tr -d ' \t\n')
4+
BUCKET_NAME=lambda-artifacts-$BUCKET_ID
5+
echo $BUCKET_NAME > bucket-name.txt
6+
aws s3 mb s3://$BUCKET_NAME

2-deploy.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
ARTIFACT_BUCKET=$(cat bucket-name.txt)
4+
git archive --format=zip HEAD > package.zip
5+
aws cloudformation package --template-file template.yml --s3-bucket $ARTIFACT_BUCKET --output-template-file out.yml
6+
aws cloudformation deploy --template-file out.yml --stack-name scorekeep --capabilities CAPABILITY_NAMED_IAM

3-open-website.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
ENDPOINT=$(aws cloudformation describe-stacks --stack-name scorekeep --query Stacks[0].Outputs[0].OutputValue --output text)
4+
echo $ENDPOINT

4-run-local.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
export AWS_REGION=$(aws configure get region)
4+
export NOTIFICATION_TOPIC=$(aws cloudformation describe-stack-resource --stack-name scorekeep --logical-resource-id notificationTopic --query 'StackResourceDetail.PhysicalResourceId' --output text)
5+
export GAME_TABLE=$(aws cloudformation describe-stack-resource --stack-name scorekeep --logical-resource-id gameTable --query 'StackResourceDetail.PhysicalResourceId' --output text)
6+
export MOVE_TABLE=$(aws cloudformation describe-stack-resource --stack-name scorekeep --logical-resource-id moveTable --query 'StackResourceDetail.PhysicalResourceId' --output text)
7+
export SESSION_TABLE=$(aws cloudformation describe-stack-resource --stack-name scorekeep --logical-resource-id sessionTable --query 'StackResourceDetail.PhysicalResourceId' --output text)
8+
export STATE_TABLE=$(aws cloudformation describe-stack-resource --stack-name scorekeep --logical-resource-id stateTable --query 'StackResourceDetail.PhysicalResourceId' --output text)
9+
export USER_TABLE=$(aws cloudformation describe-stack-resource --stack-name scorekeep --logical-resource-id userTable --query 'StackResourceDetail.PhysicalResourceId' --output text)
10+
11+
./gradlew bootrun

5-test-local.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
./bin/test-api.sh

6-cleanup.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
aws cloudformation delete-stack --stack-name scorekeep
4+
echo "Deleted function stack"
5+
if [ -f bucket-name.txt ]; then
6+
ARTIFACT_BUCKET=$(cat bucket-name.txt)
7+
while true; do
8+
read -p "Delete deployment artifacts and bucket ($ARTIFACT_BUCKET)?" response
9+
case $response in
10+
[Yy]* ) aws s3 rb --force s3://$ARTIFACT_BUCKET; rm bucket-name.txt; break;;
11+
[Nn]* ) break;;
12+
* ) echo "Response must start with y or n.";;
13+
esac
14+
done
15+
fi
16+
rm -f out.yml out.json package.zip
17+
rm -rf build .gradle build

0 commit comments

Comments
 (0)