-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docker-compose.yml to include AWS configuration for S3 and Dyn…
…amoDB, updated post and get routes to fix location header
- Loading branch information
1 parent
0cd5538
commit 2dec181
Showing
8 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
|
||
# Setup steps for working with LocalStack and DynamoDB local instead of AWS. | ||
# Assumes aws cli is installed and LocalStack and DynamoDB local are running. | ||
|
||
# Setup AWS environment variables | ||
echo "Setting AWS environment variables for LocalStack" | ||
|
||
echo "AWS_ACCESS_KEY_ID=test" | ||
export AWS_ACCESS_KEY_ID=test | ||
|
||
echo "AWS_SECRET_ACCESS_KEY=test" | ||
export AWS_SECRET_ACCESS_KEY=test | ||
|
||
echo "AWS_SESSION_TOKEN=test" | ||
export AWS_SESSION_TOKEN=test | ||
|
||
export AWS_DEFAULT_REGION=us-east-1 | ||
echo "AWS_DEFAULT_REGION=us-east-1" | ||
|
||
# Wait for LocalStack to be ready, by inspecting the response from healthcheck | ||
echo 'Waiting for LocalStack S3...' | ||
until (curl --silent http://localhost:4566/_localstack/health | grep "\"s3\": \"\(running\|available\)\"" > /dev/null); do | ||
sleep 5 | ||
done | ||
echo 'LocalStack S3 Ready' | ||
|
||
# Create our S3 bucket with LocalStack | ||
echo "Creating LocalStack S3 bucket: fragments" | ||
aws --endpoint-url=http://localhost:4566 s3api create-bucket --bucket fragments | ||
|
||
# Setup DynamoDB Table with dynamodb-local, see: | ||
# https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/getting-started-step-1.html | ||
echo "Creating DynamoDB-Local DynamoDB table: fragments" | ||
aws --endpoint-url=http://localhost:8000 \ | ||
dynamodb create-table \ | ||
--table-name fragments \ | ||
--attribute-definitions \ | ||
AttributeName=ownerId,AttributeType=S \ | ||
AttributeName=id,AttributeType=S \ | ||
--key-schema \ | ||
AttributeName=ownerId,KeyType=HASH \ | ||
AttributeName=id,KeyType=RANGE \ | ||
--provisioned-throughput \ | ||
ReadCapacityUnits=10,WriteCapacityUnits=5 | ||
|
||
# Wait until the Fragments table exists in dynamodb-local, so we can use it, see: | ||
# https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/wait/table-exists.html | ||
aws --endpoint-url=http://localhost:8000 dynamodb wait table-exists --table-name fragments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Check if | ||
#Check if invalid route returns 404 response | ||
GET http://localhost:8080/no-such-route | ||
|
||
#We should get a 404 response | ||
HTTP/1.0 404 | ||
HTTP/1.1 404 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters