Sign inSign up

smokserwis/docker-backup-util

By smokserwis

•Updated almost 9 years ago

Backup utility

Image
0

2.0K

smokserwis/docker-backup-util repository overview

⁠Docker backup utility

⁠Requirements

You need to set following envs:

  • DOCKER_HOST - Docker endpoint. Required only if start and stop are used.

Volumes needed:

  • /root - /, readonly
    • if that worries you, attaching /var/lib/docker/volumes to containers /root/var/lib/docker/volumes/ will do. You just won't be able to use archive command.
  • /backups - directory to put your backups to. Writable
  • /profiles - backup profile definitions. If you want to build on this image, you can set the env PROFILE_DIRECTORY to some other directory and put profiles there.

You should run the container with the command matching the backup profile name. If backup profile does not exist, return code 1 will be raised, unless env RC0_IF_NOT_ARGUMENT is set. In this case it will be 0.

Return code 2 is returned if requested profile did not exist.

You can set env RATE_LIMIT to a maximum speed of compression. Default is 100m, which means 100 MB/s.

You can set TAR_NICE to change niceness of tar and gzip processes. Default is 0.

⁠Backup profiles

A backup profile is a text file that uses simple commands to archive things.

  • backup X - archive a Docker volume called X, into X.tar.gz

  • start X - start a Docker container with given name

  • stop X - stop a Docker container with given name

  • archive X Y - archive an arbitrary directory on filesystem, expressed with a absolute path X, and save it as Y.tar.gz.

  • archive_tar X Y - works like archive, but will produce only a tar at output. You can follow it later with archive_gzip Y

⁠Example of a backup profile

Our daily backup is the PostgreSQL database plus system logs. We do it with a profile daily:

stop dms-postgres
backup dms-postgres
start dms-postgres

archive /var/log syslogs

They are executed via bash's source, so beware of code injections!

You can also alter RATE_LIMIT and TAR_NICE on a task basis.

stop dms-postgres
RATE_LIMIT=none backup dms-postgres
start dms-postgres

TAR_NICE=2 archive /var/log syslogs

none means that no limit will be imposed.

Tag summary

Content type

Image

Digest

Size

153.4 MB

Last updated

almost 9 years ago

docker pull smokserwis/docker-backup-util