Move manifest command to run script, add collectstatic

This commit is contained in:
igorkorenfeld 2022-09-09 16:32:48 -04:00
parent 65bb21ff0f
commit 96d191b725
No known key found for this signature in database
GPG key ID: 826947A4B867F659
2 changed files with 21 additions and 2 deletions

View file

@ -8,7 +8,7 @@ applications:
memory: 512M
stack: cflinuxfs3
timeout: 180
command: gunicorn registrar.config.wsgi -t 60
command: ./run.sh
health-check-type: http
health-check-http-endpoint: /health
env:
@ -20,4 +20,4 @@ applications:
- route: getgov-unstable.app.cloud.gov
services:
- getgov-credentials
- getgov-database
- getgov-unstable-database

19
src/run.sh Executable file
View file

@ -0,0 +1,19 @@
#/bin/bash
set -o errexit
set -o pipefail
# Only run migrations on the zeroth index when in a cloud.gov environment
if [[ -v CF_INSTANCE_INDEX && $CF_INSTANCE_INDEX == 0 ]]
then
python manage.py migrate --settings=registrar.config.settings --noinput
else
echo "Migrations did not run."
if [[ -v CF_INSTANCE_INDEX ]]
then
echo "CF Instance Index is ${CF_INSTANCE_INDEX}."
fi
fi
python manage.py collectstatic --settings=registrar.config.settings --noinput
gunicorn registrar.config.wsgi -t 60