Simplify deployment - use physics pause instead of container shutdown

- IDLE_PAUSE_SECONDS replaces IDLE_TIMEOUT_MINUTES
- Container stays running, physics pauses when idle
- No restart mechanism needed
- Remove wakeup service (no longer needed)
This commit is contained in:
2026-01-29 21:37:18 +00:00
parent 9d6086a4e5
commit ddf2c9439d
3 changed files with 14 additions and 49 deletions

View File

@@ -2,37 +2,22 @@
Deploy the DVT Simulation Platform dashboard with Cloudflare Tunnel for public access.
## Idle Auto-Shutdown
## Idle Auto-Pause
The app automatically shuts down after a period of inactivity to save resources.
The physics simulation automatically pauses when no one is viewing the dashboard.
**Configuration:**
```bash
# In .env or docker-compose.yml
IDLE_TIMEOUT_MINUTES=30 # Shutdown after 30 min idle (0 = disabled)
IDLE_PAUSE_SECONDS=30 # Pause physics after 30s idle
```
**Behaviour:**
- App tracks activity when someone has the dashboard open
- After `IDLE_TIMEOUT_MINUTES` with no viewers, the container exits
- nginx will show a 502 error until the container is restarted
**Restart Options:**
1. **Manual restart** (simplest):
```bash
docker start py-dvt-ate-streamlit
```
2. **Auto-restart on poll** (uncomment `wakeup` service in docker-compose.yml):
- Checks every 30 seconds if streamlit is stopped
- Automatically restarts it
- Adds ~30 second delay before app is available
3. **Always running** (set `IDLE_TIMEOUT_MINUTES=0`):
- App never auto-shuts down
- Uses minimal CPU when idle (~0.1%)
- Memory stays allocated (~300-400MB)
- When someone views the dashboard, physics runs normally
- After `IDLE_PAUSE_SECONDS` with no viewers, physics engine pauses
- CPU drops to ~0% while paused
- Physics resumes instantly when someone visits
- Container stays running (no restart needed)
## Architecture