aaronwmorris / indi-allsky

Software to manage a Linux-based All Sky Camera.
GNU General Public License v3.0
253 stars 42 forks source link

Enhancement Request - Backup/Restore of settings #728

Closed vastmeridian closed 2 months ago

vastmeridian commented 1 year ago

Having moved to a new (larger) ssd, I had to go through the pain of a database migration from an earlier build of indi-allsky to a newer build just to transfer all the settings from one instance of indi-alllsky to another.

**** Setup DB ****
**** Backup DB prior to migration ****
ERROR [flask_migrate] Error: Can't locate revision identified by 'ab5f1e700820'

The script exited abnormally, please try to run again...

Is there a way to add a indi-allsky settings backup or export to (say) the Utilities page that could then be used as an import on the new instance? Perhaps in a json format or similar?

Thinking this would simplify a number of tasks - particularly rebuilding an indi-allsky camera that's had a disk or storage failure. The ability to save this backup offsite using the file transfer side, or a simple copy to USB stick would pay for itself the first time it's used.

aaronwmorris commented 1 year ago

These are the flask database migrations.

You can try these steps from https://github.com/aaronwmorris/indi-allsky/wiki/Database-migrations#fixing-broken-migrations

sqlite3 /var/lib/indi-allsky/indi-allsky.sqlite "DELETE FROM alembic_version;"

# from the indi-allsky folder
rm /var/lib/indi-allsky/migrations/versions/*.py

# now rerun setup.sh
vastmeridian commented 1 year ago

I got to the same point in a slightly different way. I reconnected the old disk, updated indi-allsky and re-run the export. That has now worked and I'm up and running. In retrospect, your method would have been slightly quicker. :)

Nevertheless, if you're interested, my request for the enhancement is still a valid one (he asked hopefully!)

aaronwmorris commented 1 year ago

Your method was going to be my next suggestion, which is the best way.

I will write up a backup/restore procedure.

vastmeridian commented 1 year ago

I did run into the same Error: Can't locate revision error when I next updated the new system from the GIT master - even after updating using 'my method', so I still had to use the rm /var/lib/indi-allsky/migrations/versions/*.py to recover the system. Hopefully that's it now ...

aaronwmorris commented 1 year ago

It is only a problem if the last database schema does not reflect what is in the DB. If you upgraded before moving systems, you should be fine.

vastmeridian commented 1 year ago

Hi Aaron I'm just being tidy. Have you written the backup/restore procedure. mentioned above? If so, I'll test then close this issue.

aaronwmorris commented 1 year ago

Not yet. I will get to it very soon.

aaronwmorris commented 1 year ago

This is my first pass at an informational page on backing up indi-allsky:

https://github.com/aaronwmorris/indi-allsky/wiki/Backup-and-Recovery

I am also planning on writing a script to create a unified tar file of all of the files necessary to backup.

vastmeridian commented 1 year ago

That new page looks good, Aaron. Script would be good (and I'd be happy to test - at least to a VM and back) One (small) point:

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

Database
Database migrations
Flask config
indi-allsky environment (optional)
Images and videos

I count 5 areas, not 4 (OK - so one is optional) :)