Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrink the deployment so we can deploy again #96

Merged
merged 5 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ poetry export -f requirements.txt --output ingestor/requirements.txt --without-h
pushd ingestor/

poetry run chalice package --stage prod --merge-template .chalice/resources.json cfn/

# Shrink the deployment package for the lambda layer https://stackoverflow.com/a/69355796
zip -d cfn/layer-deployment.zip '*/__pycache__/*'
zip -d cfn/layer-deployment.zip python/**/*.dist-info/**/*
zip -d cfn/layer-deployment.zip python/lib/python3.11/site-packages/numpy*/tests/**/*
zip -d cfn/layer-deployment.zip python/lib/python3.11/site-packages/pandas*/tests/**/*
zip -d cfn/layer-deployment.zip python/lib/python3.11/site-packages/pyarrow*/tests/**/*
zip -d cfn/layer-deployment.zip python/lib/python3.11/site-packages/boto3*/**/*
zip -d cfn/layer-deployment.zip python/lib/python3.11/site-packages/botocore*/**/*

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 \
Expand Down
2 changes: 1 addition & 1 deletion ingestor/.chalice/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"iam_policy_file": "policy-yankee.json",
"lambda_memory_size": 1024,
"lambda_timeout": 60,
"max_ebs_size_gb": 5
"max_ebs_size_gb": 2
},
"process_daily_lamp": {
"iam_policy_file": "policy-lamp-ingest.json",
Expand Down
23 changes: 20 additions & 3 deletions ingestor/.chalice/resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,24 @@
}
}
},
"ProcessDailyLamp": {
"Type": "AWS::Serverless::Function",
"Properties": {
"Environment": {
"Variables": {
"DD_API_KEY": {
"Ref": "DDApiKey"
},
"DD_VERSION": {
"Ref": "GitVersion"
},
"DD_TAGS": {
"Ref": "DDTags"
}
}
}
}
},
"DeliveredTripMetricsDB": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
Expand Down Expand Up @@ -585,7 +603,7 @@
]
}
},
"ShuttleTravelTimes": {
"ShuttleTravelTimes": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"TableName": "ShuttleTravelTimes",
Expand All @@ -608,7 +626,6 @@
"AttributeName": "date",
"KeyType": "RANGE"
}

],
"BillingMode": "PAY_PER_REQUEST",
"Tags": [
Expand All @@ -623,7 +640,7 @@
"Type": "AWS::S3::Bucket",
"DeletionPolicy": "Retain",
"Properties": {
"BucketName": "tm-shuttle-positions"
"BucketName": "tm-shuttle-positions"
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion ingestor/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ def store_landing_data(event):


# Runs every 5 minutes from either 4 AM -> 1:55AM or 5 AM -> 2:55 AM depending on DST
@app.schedule(Cron("0/5", "0-6,9-23", "*", "*", "?", "*"))
# @app.schedule(Cron("0/5", "0-6,9-23", "*", "*", "?", "*"))
# Hourly frequency for now until we've fixed things up
@app.schedule(Cron("0", "0-6,9-23", "*", "*", "?", "*"))
def update_yankee_shuttles(event):
yankee.update_shuttles()

Expand Down
31 changes: 10 additions & 21 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.