2019-04-13 17:04:54 +00:00
|
|
|
|
|
|
|
# restic-volume-backup
|
|
|
|
|
|
|
|
*WORK IN PROGRESS*
|
|
|
|
|
|
|
|
Backup using using https://restic.net/ for a docker-compose setup.
|
|
|
|
|
2019-04-13 21:12:56 +00:00
|
|
|
Automatically detects and backs up volumes in a docker-compose setup.
|
|
|
|
This includes both host mapped volumes and actual docker volumes.
|
2019-04-13 17:04:54 +00:00
|
|
|
|
|
|
|
* Cron triggers backup
|
|
|
|
* Volumes for all running containers are backed up
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
2019-04-13 21:59:54 +00:00
|
|
|
Required env variables for restic:
|
|
|
|
|
2019-04-13 18:12:25 +00:00
|
|
|
```bash
|
|
|
|
RESTIC_REPOSITORY
|
|
|
|
RESTIC_PASSWORD
|
|
|
|
```
|
2019-04-13 21:59:54 +00:00
|
|
|
|
|
|
|
Example compose setup:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
version: '3'
|
|
|
|
services:
|
|
|
|
backup:
|
|
|
|
build: restic-volume-backup
|
|
|
|
environment:
|
|
|
|
- RESTIC_REPOSITORY=<whatever restic supports>
|
|
|
|
- RESTIC_PASSWORD=hopefullyasecturepw
|
|
|
|
env_file:
|
|
|
|
- some_other_vars.env
|
|
|
|
volumes:
|
|
|
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
2019-04-13 22:57:38 +00:00
|
|
|
example:
|
2019-04-13 21:59:54 +00:00
|
|
|
image: some_image
|
|
|
|
# Enable volume backup with label
|
|
|
|
labels:
|
|
|
|
restic-volume-backup.enabled: true
|
|
|
|
# These volumes will be backed up
|
|
|
|
volumes:
|
2019-04-13 22:02:40 +00:00
|
|
|
# Docker volume
|
|
|
|
- media:/srv/media
|
|
|
|
# Host map
|
|
|
|
- /srv/files:/srv/files
|
2019-04-13 21:59:54 +00:00
|
|
|
|
|
|
|
volumes:
|
|
|
|
media:
|
2019-04-13 22:57:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Include
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
example:
|
|
|
|
image: some_image
|
|
|
|
labels:
|
|
|
|
restic-volume-backup.enabled: true
|
|
|
|
restic-volume-backup.include: "files,data"
|
|
|
|
volumes:
|
|
|
|
# Source don't match include filter. No backup.
|
|
|
|
- media:/srv/media
|
|
|
|
# Matches include filter
|
|
|
|
- files:/srv/files
|
|
|
|
- /srv/data:/srv/data
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
media:
|
|
|
|
files:
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Exclude:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
example:
|
|
|
|
image: some_image
|
|
|
|
labels:
|
|
|
|
restic-volume-backup.enabled: true
|
|
|
|
restic-volume-backup.exclude: "media"
|
|
|
|
volumes:
|
|
|
|
# Excluded by filter
|
|
|
|
- media:/srv/media
|
|
|
|
# Backed up
|
|
|
|
- files:/srv/files
|
|
|
|
- /srv/data:/srv/data
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
media:
|
|
|
|
files:
|
|
|
|
```
|