2022-06-20 17:25:45 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# run migrations
|
|
|
|
export FLASK_APP=/app/pb/__init__.py
|
|
|
|
|
|
|
|
if [ "$DOWNGRADE_DB" = "true" ]; then
|
|
|
|
echo 'Downgrading database...'
|
2022-06-20 17:39:37 -04:00
|
|
|
poetry run flask db downgrade
|
2022-06-20 17:25:45 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$UPGRADE_DB" = "true" ]; then
|
|
|
|
echo 'Upgrading database...'
|
2022-06-20 17:39:37 -04:00
|
|
|
poetry run flask db upgrade
|
2022-06-20 17:25:45 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$RESET_DB" = "true" ]; then
|
|
|
|
echo 'Clearing database and loading example data...'
|
2022-06-20 17:39:37 -04:00
|
|
|
poetry run flask load-example-data
|
2022-06-20 17:25:45 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$LOAD_EXAMPLE_SPONSORS" = "true" ]; then
|
|
|
|
echo 'Loading example data...'
|
2022-06-20 17:39:37 -04:00
|
|
|
poetry run flask load-example-sponsors
|
2022-06-20 17:25:45 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$APPLICATION_ROOT" = "/" ]; then
|
2022-06-20 17:39:37 -04:00
|
|
|
poetry run gunicorn --bind 0.0.0.0:$PORT0 wsgi:app
|
2022-06-20 17:25:45 -04:00
|
|
|
else
|
2022-06-20 17:39:37 -04:00
|
|
|
poetry run gunicorn -e SCRIPT_NAME="$APPLICATION_ROOT" --bind 0.0.0.0:$PORT0 wsgi:app
|
2022-06-20 17:25:45 -04:00
|
|
|
fi
|