-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding datadog tracing and extention layer
- Loading branch information
1 parent
36bf28c
commit 890df51
Showing
4 changed files
with
38 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
#!/bin/bash -x | ||
|
||
if [[ -z "$MBTA_V2_API_KEY" ]]; then | ||
echo "Must provide MBTA_V2_API_KEY in environment" 1>&2 | ||
if [[ -z "$MBTA_V2_API_KEY" || -z "$DD_API_KEY" ]]; then | ||
echo "Must provide MBTA_V2_API_KEY and DD_API_KEY in environment" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
STACK_NAME=ingestor | ||
BUCKET=ingestor-lambda-deployments | ||
|
||
# Identify the version and commit of the current deploy | ||
GIT_VERSION=`git describe --tags --always` | ||
GIT_SHA=`git rev-parse HEAD` | ||
echo "Deploying version $GIT_VERSION | $GIT_SHA" | ||
|
||
# Adding some datadog tags to get better data | ||
DD_TAGS="git.commit.sha:$GIT_SHA,git.repository_url:github.com/transitmatters/data-ingestion" | ||
|
||
poetry export -f requirements.txt --output ingestor/requirements.txt --without-hashes | ||
|
||
pushd ingestor/ | ||
|
||
poetry run chalice package --stage prod --merge-template .chalice/envvars.json --merge-template .chalice/dynamo_tables.json cfn/ | ||
|
||
# Shrink size of layer deployment | ||
zip -d cfn/layer-deployment.zip "python/lib/python3.10/site-packages/botocore/*" | ||
zip -d cfn/layer-deployment.zip "python/lib/python3.10/site-packages/boto3/*" | ||
|
||
aws cloudformation package --template-file cfn/sam.json --s3-bucket $BUCKET --output-template-file cfn/packaged.yaml | ||
aws cloudformation deploy --template-file cfn/packaged.yaml --stack-name $STACK_NAME \ | ||
--capabilities CAPABILITY_NAMED_IAM --no-fail-on-empty-changeset \ | ||
--parameter-overrides MbtaV2ApiKey=$MBTA_V2_API_KEY DDApiKey=$DD_API_KEY | ||
--parameter-overrides MbtaV2ApiKey=$MBTA_V2_API_KEY DDApiKey=$DD_API_KEY GitVersion=$GIT_VERSION DDTags=$DD_TAGS |
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