This commit is contained in:
p4u1 2024-04-08 12:50:57 +02:00
parent 3f1f57f4ba
commit 65ac99ca25

View File

@ -1,5 +1,5 @@
---
title: Backupbot Specification
title: Backupbot-two
---
# For Operators
@ -172,15 +172,12 @@ In the case of restoring database tables, you can use the `pre-hook` &
# Specification
Backups are enabled for the whole compose stack.
By default all volumes are backup up.
It is possible to disable backups for a volume.
By default the whole volume is backed up.
It is possible to define a path or a list of paths for a volume to backup only those.
TODO:
- should the post hook be executed when the backup/restore fails?
## Summary
Creating automated backups of docker swarm services is an often needed task. This specification describes how backups can be configured via labels in a standardised way.
Creating automated backups of docker swarm services is an often needed task. This specification describes how backups can be configured via [service labels](https://docs.docker.com/compose/compose-file/compose-file-v3/#labels-1) in a standardised way.
## Requirements
@ -193,7 +190,7 @@ When backing up a docker stack you MUST first check if the `backupbot.backup`. I
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.
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.
By default all files MUST be backed up on a volume. `backupbot.backup.volumes.{volume_name}.path` MAY be set to only include those paths.
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.
@ -210,7 +207,7 @@ A `backupbot.restore.post-hook` MAY be set on a service. When set the command MU
**Type:** boolean
**Default:** false
**Description:**
Enables backupbot for this compose stack. It SHOULD be added to the first service.
Enables backupbot for this compose stack. The labe should be added to the main service of the compose stack.
**Example:**
@ -221,13 +218,13 @@ backupbot.backup: true
### `backupbot.backup.volumes.{volume_name}`
**Type:** boolean
**Description:** false, true when the given volume has a path specified
Enables backups for the {volume_name} volume.
**Default:** true
**Description:** When set to false the volume is excluded from backups.
**Example:**
```
backupbot.backup.volumes.{volume_name}: true
backupbot.backup.volumes.{volume_name}: false
```
### `backupbot.backup.volumes.{volume_name}.path`
@ -248,8 +245,8 @@ backupbot.backup.volumes.{volume_name}.path: '/var/lib/mariadb/dump.sql.gz'
**Type:** string
**Default:** ""
**Description:**
A command, that gets executed before the files are backuped.
TODO: multiple commands?
A command, that gets executed before the files are backed up.
**Example:**
```
@ -262,7 +259,6 @@ backupbot.backup.pre-hook: 'mysqldump -u root -p"$(cat /run/secrets/db_root_pass
**Default:** ""
**Description:**
A command, that gets executed after the files are backuped.
TODO: what todo if the backup fails? should this always run?
**Example:**
@ -289,7 +285,6 @@ backupbot.restore.pre-hook: "lock db"
**Default:** ""
**Description:**
A command, that gets executed after the files are restored.
TODO: what todo if the restore fails? should this always run?
**Example:**