This commit is contained in:
Q
2023-08-19 11:35:11 +03:00
commit aa6a1d2373
16 changed files with 797 additions and 0 deletions

22
code/entrypoint.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
PYTHON=python3
SQLITE=sqlite3
export FLASK_DATAFOLDER="/data"
export FLASK_DB="/data/flees.db"
export FLASK_CONF="/data/config.json"
export SERVER=gunicorn
export PID="flees.pid"
export WORKERS
if [[ $( stat -c %u /data ) -ne $( id -u ) ]]; then
echo User id and /data folder owner do not match
printf 'UID: %s\nFolder: %s\n' $( id -u ) $( stat -c %u /data )
exit 1
fi
set -eu
. /opt/venv/bin/activate
sh ./init_db.sh "$FLASK_DB"
exec "$SERVER" -w $WORKERS 'app:app' --pid="$PID" -b 0.0.0.0:5000