diff --git a/ops/manifests/manifest-unstable.yaml b/ops/manifests/manifest-unstable.yaml index 976bd4425..4b523118c 100644 --- a/ops/manifests/manifest-unstable.yaml +++ b/ops/manifests/manifest-unstable.yaml @@ -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 \ No newline at end of file + - getgov-unstable-database diff --git a/src/run.sh b/src/run.sh new file mode 100755 index 000000000..452469af4 --- /dev/null +++ b/src/run.sh @@ -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