Files
mini-flees/code/entrypoint.sh

31 lines
689 B
Bash

#!/bin/bash
set -eu
export FLASK_DATAFOLDER="/data"
export FLASK_DB="/data/flees.db"
export INTERNAL_PORT="${INTERNAL_PORT:-5000}"
export SERVER=gunicorn
export PID="flees.pid"
export WORKERS
export TIMEOUT
export TZ
if [[ ! -w "$FLASK_DATAFOLDER" ]]; then
echo Cannot write to $FLASK_DATAFOLDER
exit 1
fi
. /opt/venv/bin/activate
sh ./init_db.sh "$FLASK_DB"
echo "Dowload script: curl -H 'Secret: [FLASK_ACCESS_TOKEN]' http://${FLASK_PUBLIC_URL}/script/mfl"
exec "$SERVER" \
-w "$WORKERS" \
--threads 8 \
--worker-tmp-dir "$TMPDIR" \
--timeout "$TIMEOUT" \
--pid="$PID" \
-b 0.0.0.0:"$INTERNAL_PORT" \
'app:app' \
2>&1 | tee -a /data/flees.log