# Incus keeper

This project is covering backup and sync scenarios for Incus instances.

* Backups instances into Restic repository
* Syncs instances to another incus instance
* Backs up incus itself

## KV

Functions of Sentinel depends on user KV values configured on each instance. Here is what you can configure:

| Key                              | Default   | Purpose                                                          |
| -------------------------------- | --------- | ---------------------------------------------------------------- |
| user.backup                      | false     | true/false, if true, regular backup job into Restic is performed |
| user.sync                        | false     | true/false, if true, regular sync job into Restic is performed   |
| user.backup-notify-url           | ""        | Call this URL when backup is done                                |
| user.sync-notify-url             | ""        | Call this URL when sync is done                                  |
| user.backup-schedule             | 0 6 * * * | Cron-like line for backup scheduling                             |
| user.sync-schedule               | 0 6 * * * | Cron-like line for sync scheduling                               |
| user.sync-target-remote          | ""        | Sync's target host (needs to be configured in Incus)             |
| user.sync-target-pool            | pool0     | Target's storage pool                                            |
| user.sync-target-instance-suffix | -cold     | Instance name suffix at the target side                          |

## Important notes

Only one backup or sync job can run the same time. There is internal queue of jobs that
is picked up one by one. Cli commands sync and backup are independent from this queue.

Restic needs two environment variables to be set:

* RESTIC_PASSWORD
* RESTIC_REPOSITORY

