-
-
Notifications
You must be signed in to change notification settings - Fork 94
Backup and Restore
It's important to understand how your Spoolman data is stored, so that you can back it up and restore it incase you need to. Backup and restore can also be done if you want to migrate your Spoolman to a different server.
Your Spoolman data is stored in a database. By default, the SQLite type database is used, which means all data will be stored in a file called "spoolman.db". The location of this file depends on how you installed Spoolman. If you use any non-SQLite database such as MySQL or PostgreSQL, then I cannot help you further because those databases are more complicated.
To perform a backup for the default database type (SQLite), you need to copy the spoolman.db
file somewhere safe. Note however that it's risky to copy this file while Spoolman is running, since there may be active writing to it while you're copying. So to be safe, stop the Spoolman service before you attempt to make a copy of the spoolman.db
file.
If you don't want to stop Spoolman to do a backup, you can make Spoolman perform the backup copy instead, which is guaranteed to be safe. Use the backup POST request to trigger this kind of backup.
Spoolman will automatically make a safe backup every midnight. These are stored in the backups
directory in the same folder as the spoolman.db
file.
If you use the default database type (SQLite), and you've installed Spoolman using the Docker method and followed the sample docker-compose.yml
, then your data will be stored in <spoolman path>/data/spoolman.db
, where <spoolman path>
is the directory you placed your docker-compose.yml
file. This is dictated by the path of the source
field under the volume.
If you use the default database type (SQLite), and you've installed Spoolman using the Standalone method, then your data will be stored in ~/.local/share/spoolman/spoolman.db
.
To restore a SQLite based backup, first stop the Spoolman service if it's already running. Then replace the spoolman.db
file as found above with your backed up one. Then it should be safe to start Spoolman again.