From daaf6516ef7c13d81dbc23a5f5868a09d9e1ca07 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 27 Jun 2024 18:29:19 +0100 Subject: [PATCH 1/2] build: update cloudformation config to use pdm export instead of venv --- scripts/aws/cloudformation/tasking-manager.template.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/aws/cloudformation/tasking-manager.template.js b/scripts/aws/cloudformation/tasking-manager.template.js index 7a3899dcab..ea64882c4b 100644 --- a/scripts/aws/cloudformation/tasking-manager.template.js +++ b/scripts/aws/cloudformation/tasking-manager.template.js @@ -437,10 +437,10 @@ const Resources = { 'cd /opt/tasking-manager/', cf.sub('git reset --hard ${GitSha}'), 'pip install --upgrade pip pdm==2.7.4', + 'pdm export --prod > requirements.txt', 'wget -6 https://s3.dualstack.us-east-1.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz -O /tmp/aws-cfn-bootstrap-py3-latest.tar.gz', 'pip install /tmp/aws-cfn-bootstrap-py3-latest.tar.gz', - 'pdm install', - 'eval "$(pdm venv activate)"', + 'pip install -r requirements.txt', 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf', 'export LC_ALL=C', 'wget -6 https://s3.dualstack.us-east-1.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -O /tmp/amazon-cloudwatch-agent.deb', @@ -474,7 +474,7 @@ const Resources = { cf.sub('export TM_IMAGE_UPLOAD_API_KEY="${TaskingManagerImageUploadAPIKey}"'), 'psql "host=$POSTGRES_ENDPOINT dbname=$POSTGRES_DB user=$POSTGRES_USER password=$POSTGRES_PASSWORD" -c "CREATE EXTENSION IF NOT EXISTS postgis"', cf.if('DatabaseDumpFileGiven', cf.sub('aws s3 cp ${DatabaseDump} dump.sql; sudo -u postgres psql "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_ENDPOINT/$POSTGRES_DB" < dump.sql'), ''), - 'pdm run -vv flask db upgrade', + 'flask db upgrade', 'echo "------------------------------------------------------------"', cf.sub('export NEW_RELIC_LICENSE_KEY="${NewRelicLicense}"'), cf.sub('export TM_SENTRY_BACKEND_DSN="${SentryBackendDSN}"'), From 786fd378aa9571669a5ea941f9f3d4b24ef6bc8a Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Fri, 28 Jun 2024 11:23:54 +0100 Subject: [PATCH 2/2] build: add --user flag to cloudformation pip install (avoid sys conflicts) --- scripts/aws/cloudformation/tasking-manager.template.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/aws/cloudformation/tasking-manager.template.js b/scripts/aws/cloudformation/tasking-manager.template.js index ea64882c4b..67b5ff58b3 100644 --- a/scripts/aws/cloudformation/tasking-manager.template.js +++ b/scripts/aws/cloudformation/tasking-manager.template.js @@ -440,7 +440,7 @@ const Resources = { 'pdm export --prod > requirements.txt', 'wget -6 https://s3.dualstack.us-east-1.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz -O /tmp/aws-cfn-bootstrap-py3-latest.tar.gz', 'pip install /tmp/aws-cfn-bootstrap-py3-latest.tar.gz', - 'pip install -r requirements.txt', + 'pip install --user -r requirements.txt', 'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf', 'export LC_ALL=C', 'wget -6 https://s3.dualstack.us-east-1.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -O /tmp/amazon-cloudwatch-agent.deb',