Documentation
fsds/superset-backup-and-restore.md
Plan: Superset Backup/Restore to Azure
Summary
Ensure all local Superset content (dashboards, charts, datasets) can be backed up and restored to Azure.
Current State
What EXISTS
| Component | Location | Purpose |
|---|---|---|
export-dashboards.sh |
projects/bbu-rfid/resources/superset/ |
Exports dashboards + all dependencies |
docker-entrypoint.sh |
projects/bbu-rfid/resources/superset/ |
Already has auto-import code (lines 154-184) |
dashboards.zip |
projects/bbu-rfid/resources/superset/exports/ |
Export from Dec 7-8 (OUTDATED) |
The Auto-Import Already Works!
The docker-entrypoint.sh already contains working auto-import code:
EXPORT_FILE="/app/exports/dashboards.zip"
if [ -f "$EXPORT_FILE" ] && [ -s "$EXPORT_FILE" ]; then
# Uses ImportDashboardsCommand with overwrite=True
fi
The Gap
The dashboards.zip is NOT copied into the Docker image:
.dockerignoreexcludesexports/folderDockerfilehas noCOPYcommand for exports- Result: Auto-import code runs but finds no file
Implementation Steps
Step 1: Export Fresh Dashboards
Run the existing export script (Superset must be running locally):
cd projects/bbu-rfid/resources/superset
./export-dashboards.sh
This captures:
- All 8+ dashboards with dependencies
- All charts (~50+)
- All datasets (~30+)
- Database connection config
Step 2: Enable Dashboard Inclusion in Docker Image
File: projects/bbu-rfid/resources/superset/.dockerignore
Remove the exports exclusion:
-exports/
+# exports/ # Included for Azure auto-import
File: projects/bbu-rfid/resources/superset/Dockerfile
Add after line 16 (after copying superset_config.py):
# Copy pre-exported dashboards for automatic Azure import
COPY exports/ /app/exports/
Step 3: Rebuild and Deploy
On next Azure deployment:
- Docker image will include
dashboards.zip - Container starts,
docker-entrypoint.shruns - Auto-import finds
/app/exports/dashboards.zip - Imports all dashboards with
overwrite=True - Logs show "Successfully imported dashboards"
Files to Modify
| File | Change |
|---|---|
projects/bbu-rfid/resources/superset/.dockerignore |
Comment out exports/ line |
projects/bbu-rfid/resources/superset/Dockerfile |
Add COPY exports/ /app/exports/ |
projects/bbu-rfid/resources/superset/exports/dashboards.zip |
Regenerate (run export script) |
Verification
After Azure deployment, check container logs for:
==> Importing pre-exported dashboards...
Successfully imported dashboards from /app/exports/dashboards.zip
✓ Dashboard import complete
Notes
- SQL Lab saved queries: Not needed per user
- Manual restore option: Still possible via Superset UI if needed
- Export script can be re-run anytime to update dashboards.zip before deployment