update, and allow non-mount data

This commit is contained in:
q
2025-10-17 11:29:29 +03:00
parent fb5ce59582
commit 6bb6941287
7 changed files with 84 additions and 56 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/bash
PYTHON=python3
SQLITE=sqlite3
set -eu
export FLASK_DATAFOLDER="/data"
export FLASK_DB="/data/flees.db"
@@ -9,21 +9,21 @@ export SERVER=gunicorn
export PID="flees.pid"
export WORKERS
export TIMEOUT
export TZ
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
if [[ ! -w "$FLASK_DATAFOLDER" ]]; then
echo Cannot write to $FLASK_DATAFOLDER
exit 1
fi
set -eu
. /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 \
--timeout $TIMEOUT \
-w "$WORKERS" \
--worker-tmp-dir "$TMPDIR" \
--timeout "$TIMEOUT" \
--pid="$PID" \
-b 0.0.0.0:$INTERNAL_PORT \
-b 0.0.0.0:"$INTERNAL_PORT" \
'app:app' \
2>&1 | tee -a /data/flees.log