From 96d191b7259994648ee6662dbabf8409b88a7e04 Mon Sep 17 00:00:00 2001 From: igorkorenfeld Date: Fri, 9 Sep 2022 16:32:48 -0400 Subject: [PATCH] Move manifest command to run script, add collectstatic --- ops/manifests/manifest-unstable.yaml | 4 ++-- src/run.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100755 src/run.sh 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