2.2 KiB
Automatic service backup
This docker container will backup services on a schedule, using duplicity as an back end.
How to configure
To configure file hosting locations you can add storage locations to the services.conf
file. One per line, you can add duplicity connections. The syntax of these can be found in their docs.
After changing the services.conf
file, you'll have to rebuild the container.
The script sends logs to the docker log socket (as is usual with containers).
docker-compose build
docker-compose up -d
docker-compose logs -f
How to use
This docker container assumes that you use the following directory structure:
some_folder/
service1/
backup.conf
service2/
backup.conf
service3/
By default, some_folder
is mapped to /services
as this is where my services reside. You can change this in the docker-compose.yml
file.
If you put a backup.conf
file into a service's directory it will get backed up. If you omit this file, the service will be skipped.
The contents of the backup file are a duplicity include list. You can find more documentation about them at their docs
You can find an example file with some comments at backup.conf.example
.
Backup file syntax
Lines starting with ##
are comments.
Lines starting with #
are interpreted as variable assignments. There are three variables used to control backup behaviour.
## These are also the default values
# RETAIN=1M
# INCREMENT=1W
# INTERVAL=1H
RETAIN
specifies how long backups should be kept around.
INCREMENT
specifies how long incremental backups are made before creating a full backup again. This will make a full backup every week.
INTERVAL
specifies how long between backups.
The RETAIN
and INCREMENT
variables are directly fed into duplicity and use their syntax. The INTERVAL
variable is read by the container, and has the following options:
1M for once each month
1W for once each week
1D for once each day
1H for once each hour
2H for once each two hours
6H for once each six hours
12H for twice each day
Values must be whole integers, and the minimal value possible is 1H
.