-
Notifications
You must be signed in to change notification settings - Fork 41
Backup and Recovery
Backup and recovery of indi-allsky involves backing up several areas
- Database
- Database migrations
- Flask config
- indi-allsky environment (optional)
- Images and videos
# Backup
sqlite3 "/var/lib/indi-allsky/indi-allsky.sqlite" .dump | gzip -c > "backup_indi-allsky_sqlite_$(date +%Y%m%d_%H%M%S).sql.gz"
# Restore
gunzip -c backup_indi-allsky_sqlite_00000000.sql.gz | sqlite3 /var/lib/indi-allsky/indi-allsky.sqlite
Note: You can backup the binary sqlite database file itself, but it is NOT portable between platforms (eg ARM -> Intel)
# Backup
mysqldump --host localhost --user indi_allsky_own -p indi_allsky | gzip -c > "backup_indi-allsky_mysql_$(date +%Y%m%d_%H%M%S).sql.gz"
## add --ssl for remote connections
# Restore (create database first)
gunzip -c backup_indi-allsky_mysql_00000000.sql.gz | mysql --host localhost --user indi_allsky_own -p indi_allsky
- Mysql database creation: https://github.com/aaronwmorris/indi-allsky/wiki/MySQL-MariaDB-Information
# Backup
tar -C /var/lib/indi-allsky/migrations --exclude="*.py[oc]" -cvf - . | gzip -c > "backup_indi-allsky_migrations_$(date +%Y%m%d_%H%M%S).tgz"
# Restore
tar -C /var/lib/indi-allsky/migrations -xvfz backup_indi-allsky_migrations_00000000.tgz
The flask config is at /etc/indi-allsky/flask.json
Service environment variables are located at /etc/indi-allsky/indi-allsky.env
. This is an optional file.
Images and videos are normally located at /var/www/html/allsky/images/
-
Install a new OS
-
Perform full indi-allsky setup as if setting up a new system
-
Disable indi-allsky auto-start on new system
systemctl --user disable indi-allsky.timer
-
Once the web interface is online on the NEW system, delete the following files (on the NEW system)
# do not forget the asterisk, could be up to 3 files rm -i /var/lib/indi-allsky/indi-allsky.sqlite* rm -i /var/lib/indi-allsky/migrations/versions/*.py
-
Copy the files in /etc/indi-allsky/ from the old system to the new system.
rsync -pv /etc/indi-allsky/flask.json username@newallsky.local:/etc/indi-allsky/. # this file might not exist rsync -pv /etc/indi-allsky/indi-allsky.env username@newallsky.local:/etc/indi-allsky/.
-
Copy the database migrations from the old system
rsync -pv /var/lib/indi-allsky/migrations/versions/*.py username@newallsky.local:/var/lib/indi-allsky/migrations/versions/.
-
Perform a backup of the SQLite database using the commands above. Copy the export to the new system and restore using instructions above.
-
Restart the gunicorn service on the new system
systemctl --user restart gunicorn-indi-allsky
-
You should be able to navigate to the web interface and see your original camera referenced. If so, copy your original images to the new system. This might take a while.
rsync -prv /var/www/html/allsky/images/. username@newallsky.local:/var/www/html/allsky/images/.
-
Re-run
setup.sh
on the new system to fix any outstanding file permissions issues. -
If all is well, you should be able to view images in the Gallery, Image Viewer, and Timelapse views.
-
Move your camera to the new system
- Reboot your system if you hot-plugged your camera.
- libcamera cameras may need overlays setup. Make sure your camera is detected.
-
Try to start the capture process now and verify new images are generated
source virtualenv/indi-allsky/bin/activate ./allsky.py run (Ctrl-C to stop)
-
Re-enable indi-allsky auto-start
systemctl --user enable indi-allsky.timer
-
Start indi-allsky
systemctl --user start indi-allsky
- If INDI is a newer release, there is a small chance that your camera might get renamed which would result in a new camera entry. There are ways to rename the camera entries in the database, please open a support issue.