#!/bin/bash set -e # Database tables are created automatically on application startup # (app/main.py runs Base.metadata.create_all). The first user to register # becomes the superadmin (the instance owner), so no admin seeding is needed. # # The demo seed (seed_db.py) plants sample accounts and content for LOCAL # DEVELOPMENT only. It is opt-in: set RUN_SEED=1 to enable it. Never set # RUN_SEED=1 in production. if [ "${RUN_SEED}" = "1" ]; then echo "[entrypoint] RUN_SEED=1 -> running demo database seed..." python seed_db.py fi # Public demo account (enabled by default, see settings.demo_email): # (re)create the demo account and its sample data at boot, then reset it # periodically in the background (default: every 3h; override with # DEMO_RESET_INTERVAL, in seconds). Set DEMO_EMAIL="" to disable. echo "[entrypoint] Resetting demo account..." python reset_demo.py || echo "[entrypoint] WARNING: demo reset failed (continuing)" ( while true; do sleep "${DEMO_RESET_INTERVAL:-10800}" echo "[entrypoint] Scheduled demo reset..." python reset_demo.py || echo "[entrypoint] WARNING: demo reset failed" done ) & echo "[entrypoint] Starting application..." exec "$@"