Run migrations on the first web instance startup

This commit is contained in:
Ryan Ahearn
2022-10-18 12:27:55 -04:00
parent b7e2dfa7e3
commit 5682af3747
2 changed files with 8 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ applications:
- type: web
instances: ((web_instances))
memory: ((web_memory))
command: ./scripts/run_app_paas.sh gunicorn -c ./gunicorn_config.py application
command: ./scripts/migrate_and_run_web.sh
- type: worker
instances: ((worker_instances))
memory: ((worker_memory))

7
scripts/migrate_and_run_web.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
if [[ $CF_INSTANCE_INDEX -eq 0 ]]; then
flask db upgrade
fi
${HOME}/scripts/run_app_paas.sh gunicorn -c ${HOME}/gunicorn_config.py application