dback

module
v0.0.0-...-d5261e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2020 License: GPL-3.0

README

Dback is application for observe docker containers, make bulk incremental backups of their mounts (folders and volumes), and pass backups to S3 bucket. Restoring to exist containers is also available.
Runs restic under the hood.

The main use case

There is an instance with some important dockerized apps like Jenkins, GitLab, Vault, etc...

  • Somebody wants to add an extra dockerized application, and he won't setup backup for the app
  • All the apps can afford short downtime of each container
  • All exist and extra dockerized apps of the instance must have periodical (daily) backup

Example

Run test application. Zabbix.

docker run --name dback-example-zabbix --restart always -p 127.0.0.1:80:80 -d zabbix/zabbix-appliance:alpine-4.4.0

Run s3 server (minio), with a bucket

docker run --rm -d --name dback-test-1.minio -p 127.0.0.1:9000:9000 -e MINIO_ACCESS_KEY=dback_test -e MINIO_SECRET_KEY=3b464c70cf691ef6512ed51b2a minio/minio:RELEASE.2020-03-25T07-03-04Z server /data
docker run --rm -d --link dback-test-1.minio:minio --entrypoint=sh minio/mc:RELEASE.2020-05-28T23-43-36Z -c "mc config host add minio http://minio:9000 dback_test 3b464c70cf691ef6512ed51b2a && mc mb minio/dback-test"

Wait for ~1min for zabbix init
Open http://localhost, check the login form shown

Backup mounts of zabbix, and may be some other containers matching default selection pattern

docker run --rm -t --link dback-test-1.minio:minio -v //var/run/docker.sock:/var/run/docker.sock dback/dback:0.0.110 backup --s3-endpoint=http://minio:9000 -b=dback-test -a=dback_test -s=3b464c70cf691ef6512ed51b2a -p=SecureResticPassword11

Corrupt zabbix DB

docker exec -t dback-example-zabbix bash -c "rm -rf /var/lib/mysql/*"

Open http://localhost, check database error shown

Restore all mounts of zabbix container

docker run --rm -t --link dback-test-1.minio:minio -v //var/run/docker.sock:/var/run/docker.sock dback/dback:0.0.110 restore container dback-example-zabbix --s3-endpoint=http://minio:9000 -b=dback-test -a=dback_test -s=3b464c70cf691ef6512ed51b2a -p=SecureResticPassword11

Open http://localhost, check login form works again

Backup options

Default containers selection pattern:

By default, backup will be applied for all mounts of each container matched the options:

  • HostConfig.RestartPolicy != no
  • HostConfig.AutoRemove == false
  • Status.Running == true

The pattern can be overridden with --matcher flag. It is based on xpath matching in docker inspect xml. You can see the xml with dback inspect <container>.

Exclude mounts or containers:

You able to ignore some mounts by regex.
dback backup --exclude-mount "^/(drone.*|dback-test-1.5.*)$" this call will ignore all mounts started from "/drone" or "/dback-test-1.5"

Alternatives, and why dback created:

Inspired by these projects:
https://github.com/blacklabelops/volumerize
https://github.com/christophetd/duplicacy-autobackup
https://github.com/loomchild/volume-backup
https://github.com/istepanov/docker-backup-to-s3
https://github.com/lobaro/restic-backup-docker

The apps listed above did not support some features dback provides:

  • Containers observation. Dback is find and backup all containers matching the pattern.
  • Auto stop/start containers. Dback is always stops containers before make backup, and then start they, even if something went wrong.
  • Incremental backup. 2nd and subsequent backups are faster than 1st, because restic sending and store only the difference between shots.
  • Bulk restoring. You are able to restore all the mounts of target container, and even all saved mounts of all containers, with a single command.
  • Concurrency. By default - start a thread for each mount. Can be decreased.
  • Retrying. Restic will retry mount backup procedure, if something went wrong.

That's why dback is more useful in some cases.

Directories

Path Synopsis
src
cli
dback/utils/spacetracker
the package for catch min free space left on device after tracking started
the package for catch min free space left on device after tracking started
github.com/StackExchange/wmi
Package wmi provides a WQL interface for WMI on Windows.
Package wmi provides a WQL interface for WMI on Windows.
github.com/docker/docker/api/types
Package types is used for API stability in the types and response to the consumers of the API stats endpoint.
Package types is used for API stability in the types and response to the consumers of the API stats endpoint.
github.com/docker/docker/api/types/backend
Package backend includes types to send information to server backends.
Package backend includes types to send information to server backends.
github.com/docker/docker/api/types/filters
Package filters provides tools for encoding a mapping of keys to a set of multiple values.
Package filters provides tools for encoding a mapping of keys to a set of multiple values.
github.com/docker/docker/api/types/plugins/logdriver
Package logdriver is a generated protocol buffer package.
Package logdriver is a generated protocol buffer package.
github.com/docker/docker/api/types/swarm/runtime
Package runtime is a generated protocol buffer package.
Package runtime is a generated protocol buffer package.
github.com/docker/docker/api/types/versions/v1p19
Package v1p19 provides specific API types for the API version 1, patch 19.
Package v1p19 provides specific API types for the API version 1, patch 19.
github.com/docker/docker/api/types/versions/v1p20
Package v1p20 provides specific API types for the API version 1, patch 20.
Package v1p20 provides specific API types for the API version 1, patch 20.
github.com/docker/docker/builder
Package builder defines interfaces for any Docker builder to implement.
Package builder defines interfaces for any Docker builder to implement.
github.com/docker/docker/builder/dockerfile
Package dockerfile is the evaluation step in the Dockerfile parse/evaluate pipeline.
Package dockerfile is the evaluation step in the Dockerfile parse/evaluate pipeline.
github.com/docker/docker/builder/remotecontext
Package remotecontext is a generated protocol buffer package.
Package remotecontext is a generated protocol buffer package.
github.com/docker/docker/client
Package client is a Go client for the Docker Engine API.
Package client is a Go client for the Docker Engine API.
github.com/docker/docker/daemon
Package daemon exposes the functions that occur on the host server that the Docker daemon is running.
Package daemon exposes the functions that occur on the host server that the Docker daemon is running.
github.com/docker/docker/daemon/logger
Package logger defines interfaces that logger drivers implement to log messages.
Package logger defines interfaces that logger drivers implement to log messages.
github.com/docker/docker/daemon/logger/awslogs
Package awslogs provides the logdriver for forwarding container logs to Amazon CloudWatch Logs
Package awslogs provides the logdriver for forwarding container logs to Amazon CloudWatch Logs
github.com/docker/docker/daemon/logger/etwlogs
Package etwlogs provides a log driver for forwarding container logs as ETW events.(ETW stands for Event Tracing for Windows) A client can then create an ETW listener to listen for events that are sent by the ETW provider that we register, using the provider's GUID "a3693192-9ed6-46d2-a981-f8226c8363bd".
Package etwlogs provides a log driver for forwarding container logs as ETW events.(ETW stands for Event Tracing for Windows) A client can then create an ETW listener to listen for events that are sent by the ETW provider that we register, using the provider's GUID "a3693192-9ed6-46d2-a981-f8226c8363bd".
github.com/docker/docker/daemon/logger/fluentd
Package fluentd provides the log driver for forwarding server logs to fluentd endpoints.
Package fluentd provides the log driver for forwarding server logs to fluentd endpoints.
github.com/docker/docker/daemon/logger/gelf
Package gelf provides the log driver for forwarding server logs to endpoints that support the Graylog Extended Log Format.
Package gelf provides the log driver for forwarding server logs to endpoints that support the Graylog Extended Log Format.
github.com/docker/docker/daemon/logger/journald
Package journald provides the log driver for forwarding server logs to endpoints that receive the systemd format.
Package journald provides the log driver for forwarding server logs to endpoints that receive the systemd format.
github.com/docker/docker/daemon/logger/jsonfilelog
Package jsonfilelog provides the default Logger implementation for Docker logging.
Package jsonfilelog provides the default Logger implementation for Docker logging.
github.com/docker/docker/daemon/logger/local
Package local provides a logger implementation that stores logs on disk.
Package local provides a logger implementation that stores logs on disk.
github.com/docker/docker/daemon/logger/logentries
Package logentries provides the log driver for forwarding server logs to logentries endpoints.
Package logentries provides the log driver for forwarding server logs to logentries endpoints.
github.com/docker/docker/daemon/logger/splunk
Package splunk provides the log driver for forwarding server logs to Splunk HTTP Event Collector endpoint.
Package splunk provides the log driver for forwarding server logs to Splunk HTTP Event Collector endpoint.
github.com/docker/docker/daemon/logger/syslog
Package syslog provides the logdriver for forwarding server logs to syslog endpoints.
Package syslog provides the logdriver for forwarding server logs to syslog endpoints.
github.com/docker/docker/dockerversion
Package dockerversion is auto-generated at build-time
Package dockerversion is auto-generated at build-time
github.com/docker/docker/errdefs
Package errdefs defines a set of error interfaces that packages should use for communicating classes of errors.
Package errdefs defines a set of error interfaces that packages should use for communicating classes of errors.
github.com/docker/docker/integration
Package integration provides integrations tests for Moby (API).
Package integration provides integrations tests for Moby (API).
github.com/docker/docker/integration-cli/checker
Package checker provides helpers for gotest.tools/assert.
Package checker provides helpers for gotest.tools/assert.
github.com/docker/docker/internal/test/suite
Package suite is a simplified version of testify's suite package which has unnecessary dependencies.
Package suite is a simplified version of testify's suite package which has unnecessary dependencies.
github.com/docker/docker/layer
Package layer is package for managing read-only and read-write mounts on the union file system driver.
Package layer is package for managing read-only and read-write mounts on the union file system driver.
github.com/docker/docker/pkg/aaparser
Package aaparser is a convenience package interacting with `apparmor_parser`.
Package aaparser is a convenience package interacting with `apparmor_parser`.
github.com/docker/docker/pkg/capabilities
Package capabilities allows to generically handle capabilities.
Package capabilities allows to generically handle capabilities.
github.com/docker/docker/pkg/filenotify
Package filenotify provides a mechanism for watching file(s) for changes.
Package filenotify provides a mechanism for watching file(s) for changes.
github.com/docker/docker/pkg/locker
Package locker provides a mechanism for creating finer-grained locking to help free up more global locks to handle other tasks.
Package locker provides a mechanism for creating finer-grained locking to help free up more global locks to handle other tasks.
github.com/docker/docker/pkg/parsers
Package parsers provides helper functions to parse and validate different type of string.
Package parsers provides helper functions to parse and validate different type of string.
github.com/docker/docker/pkg/parsers/kernel
Package kernel provides helper function to get, parse and compare kernel versions for different platforms.
Package kernel provides helper function to get, parse and compare kernel versions for different platforms.
github.com/docker/docker/pkg/parsers/operatingsystem
Package operatingsystem provides helper function to get the operating system name for different platforms.
Package operatingsystem provides helper function to get the operating system name for different platforms.
github.com/docker/docker/pkg/pidfile
Package pidfile provides structure and helper functions to create and remove PID file.
Package pidfile provides structure and helper functions to create and remove PID file.
github.com/docker/docker/pkg/platform
Package platform provides helper function to get the runtime architecture for different platforms.
Package platform provides helper function to get the runtime architecture for different platforms.
github.com/docker/docker/pkg/plugins
Package plugins provides structures and helper functions to manage Docker plugins.
Package plugins provides structures and helper functions to manage Docker plugins.
github.com/docker/docker/pkg/pools
Package pools provides a collection of pools which provide various data types with buffers.
Package pools provides a collection of pools which provide various data types with buffers.
github.com/docker/docker/pkg/signal
Package signal provides helper functions for dealing with signals across various operating systems.
Package signal provides helper functions for dealing with signals across various operating systems.
github.com/docker/docker/pkg/streamformatter
Package streamformatter provides helper functions to format a stream.
Package streamformatter provides helper functions to format a stream.
github.com/docker/docker/pkg/stringid
Package stringid provides helper functions for dealing with string identifiers
Package stringid provides helper functions for dealing with string identifiers
github.com/docker/docker/pkg/tailfile
Package tailfile provides helper functions to read the nth lines of any ReadSeeker.
Package tailfile provides helper functions to read the nth lines of any ReadSeeker.
github.com/docker/docker/pkg/tarsum
Package tarsum provides algorithms to perform checksum calculation on filesystem layers.
Package tarsum provides algorithms to perform checksum calculation on filesystem layers.
github.com/docker/docker/pkg/term
Package term provides structures and helper functions to work with terminal (state, sizes).
Package term provides structures and helper functions to work with terminal (state, sizes).
github.com/docker/docker/pkg/truncindex
Package truncindex provides a general 'index tree', used by Docker in order to be able to reference containers by only a few unambiguous characters of their id.
Package truncindex provides a general 'index tree', used by Docker in order to be able to reference containers by only a few unambiguous characters of their id.
github.com/docker/docker/pkg/urlutil
Package urlutil provides helper function to check urls kind.
Package urlutil provides helper function to check urls kind.
github.com/docker/docker/pkg/useragent
Package useragent provides helper functions to pack version information into a single User-Agent header.
Package useragent provides helper functions to pack version information into a single User-Agent header.
github.com/docker/docker/registry
Package registry contains client primitives to interact with a remote Docker registry.
Package registry contains client primitives to interact with a remote Docker registry.
github.com/docker/docker/testutil
Package testutil contains common testing tasks like running dockerd.
Package testutil contains common testing tasks like running dockerd.
github.com/docker/docker/testutil/daemon
Package daemon launches dockerd for testing purposes.
Package daemon launches dockerd for testing purposes.
github.com/docker/docker/volume/local
Package local provides the default implementation for volumes.
Package local provides the default implementation for volumes.
github.com/golang/groupcache
Package groupcache provides a data loading mechanism with caching and de-duplication that works across a set of peer processes.
Package groupcache provides a data loading mechanism with caching and de-duplication that works across a set of peer processes.
github.com/golang/groupcache/consistenthash
Package consistenthash provides an implementation of a ring hash.
Package consistenthash provides an implementation of a ring hash.
github.com/golang/groupcache/lru
Package lru implements an LRU cache.
Package lru implements an LRU cache.
github.com/golang/groupcache/singleflight
Package singleflight provides a duplicate function call suppression mechanism.
Package singleflight provides a duplicate function call suppression mechanism.
github.com/yosssi/gohtml
Package gohtml provides an HTML formatting function.
Package gohtml provides an HTML formatting function.
gopkg.in/ini.v1
Package ini provides INI file read and write functionality in Go.
Package ini provides INI file read and write functionality in Go.
vimagination.zapto.org/json2xml
Package json2xml converts a JSON structure to XML.
Package json2xml converts a JSON structure to XML.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL