2020-02-07 02:08:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-02-05 22:07:34 +00:00
|
|
|
# run migrations
|
2020-05-25 04:47:49 +00:00
|
|
|
export FLASK_APP=/app/crc/__init__.py
|
2020-04-15 18:43:09 +00:00
|
|
|
|
2020-04-21 23:37:56 +00:00
|
|
|
if [ "$DOWNGRADE_DB" = "true" ]; then
|
2020-05-22 18:55:55 +00:00
|
|
|
echo 'Downgrading database...'
|
2020-04-21 23:37:56 +00:00
|
|
|
pipenv run flask db downgrade
|
|
|
|
fi
|
|
|
|
|
2020-05-22 18:55:55 +00:00
|
|
|
if [ "$UPGRADE_DB" = "true" ]; then
|
|
|
|
echo 'Upgrading database...'
|
|
|
|
pipenv run flask db upgrade
|
|
|
|
fi
|
2020-02-07 02:08:49 +00:00
|
|
|
|
2021-08-06 19:41:23 +00:00
|
|
|
if [ "$RESET_DB" = "true" ]; then
|
|
|
|
echo 'Resetting database and seeding it with example CR Connect data...'
|
|
|
|
pipenv run flask load-example-data
|
|
|
|
fi
|
2020-02-07 02:08:49 +00:00
|
|
|
|
2020-05-27 16:58:50 +00:00
|
|
|
if [ "$RESET_DB_RRT" = "true" ]; then
|
|
|
|
echo 'Resetting database and seeding it with example RRT data...'
|
|
|
|
pipenv run flask load-example-rrt-data
|
|
|
|
fi
|
|
|
|
|
2020-06-19 14:07:10 +00:00
|
|
|
# THIS MUST BE THE LAST COMMAND!
|
2020-05-25 15:41:53 +00:00
|
|
|
if [ "$APPLICATION_ROOT" = "/" ]; then
|
2020-05-25 16:26:17 +00:00
|
|
|
pipenv run gunicorn --bind 0.0.0.0:$PORT0 wsgi:app
|
2020-05-25 15:41:53 +00:00
|
|
|
else
|
|
|
|
pipenv run gunicorn -e SCRIPT_NAME="$APPLICATION_ROOT" --bind 0.0.0.0:$PORT0 wsgi:app
|
|
|
|
fi
|
2020-06-19 12:44:02 +00:00
|
|
|
|