diff --git a/backend/models/postgis/project.py b/backend/models/postgis/project.py index 3b805ac974..0f2b847c95 100644 --- a/backend/models/postgis/project.py +++ b/backend/models/postgis/project.py @@ -61,6 +61,7 @@ ) from backend.services.grid.grid_service import GridService from backend.models.postgis.interests import Interest, project_interests +import os # Secondary table defining many-to-many join for projects that were favorited by users. project_favorites = db.Table( @@ -271,7 +272,8 @@ def set_country_info(self): "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/58.0.3029.110 Safari/537.3" - ) + ), + "Referer": os.environ.get("TM_APP_BASE_URL", "https://example.com"), } try: response = requests.get(url, headers=headers) diff --git a/scripts/aws/cloudformation/tasking-manager.template.js b/scripts/aws/cloudformation/tasking-manager.template.js index d5dc21ec30..7a6eb5e164 100644 --- a/scripts/aws/cloudformation/tasking-manager.template.js +++ b/scripts/aws/cloudformation/tasking-manager.template.js @@ -423,6 +423,7 @@ const Resources = { 'export DEBIAN_FRONTEND=noninteractive', 'export LC_ALL="en_US.UTF-8"', 'export LC_CTYPE="en_US.UTF-8"', + 'export PATH=$PATH:/root/.local/bin', 'dpkg-reconfigure --frontend=noninteractive locales', 'sudo apt-get -q -y update', 'sudo DEBIAN_FRONTEND=noninteractive apt-get -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade', @@ -437,10 +438,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 --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', @@ -474,7 +475,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}"'),