Backupbot Specification #258

Merged
decentral1se merged 8 commits from p4u1/docs.coopcloud.tech:backupbottwo-spec into main 2024-10-29 08:04:39 +00:00
Showing only changes of commit a2ecb767aa - Show all commits

View File

@ -13,17 +13,30 @@ When backing up a docker stack you MUST first check if the `backupbot.backup`. I
## Backup
To enable backups for a docker stack, the `backupbot.backup=true` label MUST be on any of its services. It SHOULD be declared on the first service.

Is the behaviour defined if one service sets backupbot.backup=true and another sets it to backupbot.backup=false?

Is the behaviour defined if one service sets `backupbot.backup=true` and another sets it to `backupbot.backup=false`?
A `backupbot.backup.pre-hook` MAY be set on a service. When set the command MUST be executed inside the running container of the service before backup up files.
By default all volumes MUST be backed up. A volume MAY be excluded from backing up when `backupbot.backup.volumes.{volume_name}=false` is set, where `{volume_name}` is the name of the volume.
### Volumes and paths
By default all volumes MUST be backed up. A volume MAY be excluded from the backup when `backupbot.backup.volumes.{volume_name}=false` is set, where `{volume_name}` is the name of the volume.
3wordchant marked this conversation as resolved
Review

So the spec allows backing up a volume even if ...{volume_name}=false? Is there any harm in changing this to "MUST"?

So the spec allows backing up a volume even if `...{volume_name}=false`? Is there any harm in changing this to "MUST"?
Review

Changed it to "MUST"

Changed it to "MUST"
By default all files MUST be backed up on a volume. `backupbot.backup.volumes.{volume_name}.path` MAY be set to limit the paths for that volume. The value MUST be a valid path relative to the volume root. It MAY contain multiple paths which get seperated by a comma.
A `backupbot.backup.post-hook` MAY be set on a service. When set the command MUST be executed inside the running container of the service after backing up all files.
A backup implementation SHOULD provide the backup of one or multiple stacks in a `.tar.gz` format.
### Pre/Post Hooks
A `backupbot.backup.pre-hook` and `backupbot.backup.post-hook` MAY be set on a service. When set the command MUST be executed inside the running container of the service before/after backing up files.
The command MUST have access to all environment variables inside the container.
There is no guaranteed order in which different hooks MUST be executed.
decentral1se marked this conversation as resolved
Review

I think {volume_name} can be confusing in this case. Because in backupbot.backup.volumes.{volume_name}.path the {volume_name} would be for example assets, while in the path /var/lib/docker/volumes/{volume_name} it would be appname_example_com_assets.
Maybe writing /var/lib/docker/volumes/{stack_name}_{volume_name} would clearer.

I think `{volume_name}` can be confusing in this case. Because in `backupbot.backup.volumes.{volume_name}.path` the `{volume_name}` would be for example `assets`, while in the path `/var/lib/docker/volumes/{volume_name}` it would be `appname_example_com_assets`. Maybe writing `/var/lib/docker/volumes/{stack_name}_{volume_name}` would clearer.
### Output
A backup implementation SHOULD provide the backup of one or multiple stacks in a `.tar.gz` format. In that case each volume MUST be in `/var/lib/docker/volumes/{volume_name}`, where `{volume_name}` is the name of each volume that got backed up.
## Restore
A `backupbot.restore.pre-hook` MAY be set on a service. When set the command MUST be executed inside the running container of the service before restoring backup files.
By default all files MUST be restored into their volume. A volume or path MAY be excluded from restoring.
A `backupbot.restore.post-hook` MAY be set on a service. When set the command MUST be executed inside the running container of the service after restoring backup files.
By default all files MUST be restored into their volume. A volume or path MAY be excluded from restoring. When restoring a backup from a `.tar.gz` it expects the directory layout as described int the [backup output](#output) section.
### Pre/Post Hooks
A `backupbot.restore.pre-hook` and `backupbot.restore.post-hook` MAY be set on a service. When set the command MUST be executed inside the running container of the service before/after restoring the files.
There is no guaranteed order in which different hooks MUST be executed.
## Labels
@ -97,6 +110,7 @@ backupbot.backup.post-hook: "rm -rf /volume_path/dump.db"
**Default:** ""
**Description:**
A command, that gets executed before the files are restored.
Note, that there is no guaranteed order in which multiple hooks get executed.
**Example:**