Skip to content

Backup and Recovery

Aaron W Morris edited this page Aug 23, 2024 · 23 revisions

Overview

Backup and recovery of indi-allsky involves backing up several areas

  1. Database
  2. Database migrations
  3. Flask config
  4. indi-allsky environment (optional)
  5. Dark frames
  6. Images and videos

Database

SQLite database

# 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)

Mysql database

# 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 indi_allsky

Database migrations

# 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

Flask config

The flask config is at /etc/indi-allsky/flask.json

indi-allsky environment

Service environment variables are located at /etc/indi-allsky/indi-allsky.env. This is an optional file.

Images and videos

Images and videos are normally located at /var/www/html/allsky/images/

Migrate to a newer OS

  1. Install a new OS

  2. Perform full indi-allsky setup as if setting up a new system

  3. Disable indi-allsky auto-start on new system

     systemctl --user disable indi-allsky.timer
    
  4. Once the web interface is online on the NEW system, delete the following files (on the NEW system)

     rm -i /etc/indi-allsky/flask.json
     
     # 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
    
  5. Copy the /etc/indi-allsky/flask.json from the old system to the new system.

     rsync -av /etc/indi-allsky/flask.json [email protected]:/etc/indi-allsky/.
    
  6. Copy the database migrations from the old system

     rsync -av /var/lib/indi-allsky/migrations/versions/*.py [email protected]:/var/lib/indi-allsky/migrations/versions/.
    
  7. Perform a backup of the SQLite database using the commands above. Copy the export to the new system and restore using instructions above.

  8. Restart the gunicorn service on the new system

     systemctl --user restart gunicorn-indi-allsky
    
  9. 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 -arv /var/www/html/allsky/images/. [email protected]:/var/www/html/allsky/images/.
    
  10. Re-run setup.sh on the new system to fix any outstanding file permissions issues.

  11. If all is well, you should be able to view images in the Gallery, Image Viewer, and Timelapse views.

  12. Try to start the capture process now

     source virtualenv/indi-allsky/bin/activate
     
     ./allsky run
    
  13. 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.
  14. Re-enable indi-allsky auto-start

    systemctl --user enable indi-allsky.timer
    
  15. Start indi-allsky and verify new images are generated

Possible issues

  • If INDI is a newer release, there is a small chance that your camera might get renamed
Clone this wiki locally