This commit is contained in:
Mateusz Gruszczyński
2026-03-05 15:53:33 +01:00
commit e8f6c4c609
74 changed files with 4482 additions and 0 deletions

32
docker/entrypoint.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
mkdir -p instance
export FLASK_APP=app.py
if [[ "${DATABASE_URL:-}" != "" ]]; then
echo "[mikromon] waiting for database"
python - <<'PY'
import os, time
from sqlalchemy import create_engine
url = os.environ.get("DATABASE_URL")
engine = create_engine(url, pool_pre_ping=True)
for i in range(60):
try:
with engine.connect() as c:
c.exec_driver_sql("SELECT 1")
break
except Exception:
time.sleep(1)
else:
raise SystemExit("DB not reachable")
PY
fi
echo "[mikromon] applying migrations"
MIKROMON_MIGRATING=1 flask db upgrade
echo "[mikromon] starting app"
exec python app.py