Automatic updates via Git branches with backup and rollback support.
- Backend API: Flask endpoints for managing updates (all require admin auth)
- Frontend UI: Web interface in the
/configUpdates tab - Boot Service: Systemd service for automatic boot-time updates
- Git Integration: Uses git branches (main, dev, canary) for version control
- main: Stable production releases
- dev: Development branch with latest features
- canary: Experimental builds for testing
All OTA endpoints require Authorization: Bearer <token>. Get a token from GET /api/auth/token (localhost only).
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/ota/status |
Current OTA status |
| GET | /api/admin/ota/check |
Check for available updates |
| POST | /api/admin/ota/update |
Pull latest updates |
| POST | /api/admin/ota/switch-branch |
Switch to different branch |
| GET | /api/admin/ota/branches |
List available remote branches |
| GET | /api/admin/ota/test-connection |
Test git remote connectivity |
| GET | /api/admin/ota/history |
Update log history |
| POST | /api/admin/ota/clean-cache |
Clean git cache |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/ota/backups |
List available backups |
| POST | /api/admin/ota/rollback |
Rollback to a backup tag |
Backups are created automatically before each update.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/ota/config |
Get OTA configuration |
| POST | /api/admin/ota/config |
Update OTA configuration |
| POST | /api/admin/ota/update-cron |
Update the cron schedule |
{
"ota": {
"enabled": true,
"branch": "main",
"check_on_boot": true,
"auto_pull": false,
"update_schedule": "0 3 * * *",
"backup_before_update": true,
"max_backups": 5,
"last_update": null,
"last_check": null
}
}- Access
/config(orCtrl+Shift+Cin kiosk mode) - Navigate to "Updates" tab
- Enable OTA, select branch, configure auto-update behavior
- Save configuration
sudo ./scripts/install-ota-service.shThis installs a systemd service for boot-time update checks.
sudo systemctl status pi-analytics-backend
sudo journalctl -u pi-analytics-backend --no-pager -n 50cd ~/dataorb
python3 scripts/boot-update.pyTOKEN=$(curl -s http://localhost:5000/api/auth/token | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")
curl -H "Authorization: Bearer $TOKEN" http://localhost:5000/api/admin/ota/check
curl -X POST -H "Authorization: Bearer $TOKEN" http://localhost:5000/api/admin/ota/updatedataorb/
├── backend/
│ ├── config_manager.py # Configuration management
│ ├── ota_manager.py # OTA operations (git pull, backup, rollback)
│ └── app.py # Flask app with OTA endpoints
├── frontend/src/components/
│ └── ConfigPage/OTAConfig.tsx # OTA configuration UI
├── scripts/
│ ├── boot-update.py # Boot update script
│ └── install-ota-service.sh # Service installation
└── config/
└── posthog-pi-ota.service # Systemd service file
If the system becomes unresponsive after an update:
- Connect keyboard/mouse to device
- Switch to TTY (
Ctrl+Alt+F1) - Rollback via git:
cd ~/dataorb
git tag -l backup-* # List backups
git reset --hard backup-YYYYMMDD-HHMMSS # Rollback
sudo systemctl restart pi-analytics-backend pi-analytics-display- All OTA endpoints require admin authentication
- Branch names are validated against
^[a-zA-Z0-9][a-zA-Z0-9._/-]*$ - Git repository should use HTTPS or SSH keys
- Backups are created automatically before updates