You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
833 B
34 lines
833 B
#!/bin/sh
|
|
set -eu
|
|
|
|
APP_DIR="${APP_DIR:-/opt/hw}"
|
|
CONFIG_DIR="${CONFIG_DIR:-/opt/hw.conf.d}"
|
|
ENV_FILE="${ENV_FILE:-${CONFIG_DIR}/hw.env}"
|
|
INSTANCE_DIR="${INSTANCE_DIR:-${APP_DIR}/instance}"
|
|
SEED_MARKER_FILE="${SEED_MARKER_FILE:-${INSTANCE_DIR}/.seed-all-complete}"
|
|
|
|
if [ -f "$ENV_FILE" ]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
. "$ENV_FILE"
|
|
set +a
|
|
fi
|
|
|
|
export FLASK_APP="${FLASK_APP:-run.py}"
|
|
export HW_CONFIG="${HW_CONFIG:-production}"
|
|
export PYTHONPATH="${PYTHONPATH:-${APP_DIR}}"
|
|
|
|
mkdir -p "$INSTANCE_DIR/csv_previews"
|
|
|
|
python -m flask db upgrade
|
|
|
|
if [ "${RUN_SEED_ALL:-0}" = "1" ] && [ ! -f "$SEED_MARKER_FILE" ]; then
|
|
python -m flask seed-all
|
|
: > "$SEED_MARKER_FILE"
|
|
fi
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
set -- gunicorn --workers "${HW_GUNICORN_WORKERS:-2}" --bind "0.0.0.0:${HW_GUNICORN_PORT:-8000}" run:app
|
|
fi
|
|
|
|
exec "$@"
|
|
|