Website: https://camptocamp.github.io/bivac
Bivac lets you backup all your containers volumes deployed on Docker Engine or Kubernetes using Restic, Duplicity or RClone.
$ go get github.com/camptocamp/bivacUsage:
bivac [OPTIONS]
Application Options:
-V, --version Display version.
-l, --loglevel= Set loglevel ('debug', 'info', 'warn', 'error', 'fatal', 'panic'). (default: info) [$BIVAC_LOG_LEVEL]
-b, --blacklist= Volumes to blacklist in backups. [$BIVAC_VOLUMES_BLACKLIST]
-m, --manpage Output manpage.
--no-verify Do not verify backup. [$BIVAC_NO_VERIFY]
-j, --json Log as JSON (to stderr). [$BIVAC_JSON_OUTPUT]
-E, --engine= Backup engine to use. (default: restic) [$BIVAC_ENGINE]
-o, --orchestrator= Container orchestrator to use. [$BIVAC_ORCHESTRATOR]
-u, --target-url= The target URL to push to. [$BIVAC_TARGET_URL]
--check-every= Time between backup checks. (default: 24h) [$BIVAC_CHECK_EVERY]
--remove-older-than= Remove backups older than the specified interval. (default: 30D) [$BIVAC_REMOVE_OLDER_THAN]
--label-prefix= The volume prefix label. [$BIVAC_LABEL_PREFIX]
--extra-env= Extra environment variables to share with workers. [$BIVAC_EXTRA_ENV]
Restic Options:
--restic-image= The restic docker image. (default: restic/restic:latest) [$RESTIC_DOCKER_IMAGE]
--restic-password= The restic backup password. [$RESTIC_PASSWORD]
RClone Options:
--rclone-image= The rclone docker image. (default: camptocamp/rclone:1.33-1) [$RCLONE_DOCKER_IMAGE]
Duplicity Options:
--duplicity-image= The duplicity docker image. (default: camptocamp/duplicity:latest) [$DUPLICITY_DOCKER_IMAGE]
--full-if-older-than= The number of days after which a full backup must be performed. (default: 15D) [$BIVAC_FULL_IF_OLDER_THAN]
Metrics Options:
-g, --gateway-url= The prometheus push gateway URL to use. [$PUSHGATEWAY_URL]
AWS Options:
--aws-access-key-id= The AWS access key ID. [$AWS_ACCESS_KEY_ID]
--aws-secret-key-id= The AWS secret access key. [$AWS_SECRET_ACCESS_KEY]
Swift Options:
--swift-username= The Swift user name. [$SWIFT_USERNAME]
--swift-password= The Swift password. [$SWIFT_PASSWORD]
--swift-auth_url= The Swift auth URL. [$SWIFT_AUTHURL]
--swift-tenant-name= The Swift tenant name. [$SWIFT_TENANTNAME]
--swift-region-name= The Swift region name. [$SWIFT_REGIONNAME]
Docker Options:
-e, --docker-endpoint= The Docker endpoint. (default: unix:///var/run/docker.sock) [$DOCKER_ENDPOINT]
Kubernetes Options:
--k8s-namespace= Namespace where you want to run Bivac. [$K8S_NAMESPACE]
--k8s-kubeconfig= Path to your kubeconfig file. [$K8S_KUBECONFIG]
--k8s-worker-service-account= Specify service account for workers. [$K8S_WORKER_SERVICE_ACCOUNT]
Cattle Options:
--cattle-env= The Cattle environment. [$CATTLE_ENV]
--cattle-accesskey= The Cattle access key. [$CATTLE_ACCESS_KEY]
--cattle-secretkey= The Cattle secretkey. [$CATTLE_SECRET_KEY]
--cattle-url= The Cattle url. [$CATTLE_URL]
Help Options:
-h, --help Show this help message$ bivac \
-u s3:http://s3-eu-west-1.amazonaws.com/<my_bucket>/<my_dir> \
--aws-access-key-id=<my_key_id> \
--aws-secret-key-id=<my_secret_key> \
--restic-password=<my_restic_password>$ docker run -v /var/run/docker.sock:/var/run/docker.sock:ro --rm -ti \
-e BIVAC_TARGET_URL=s3:http://s3-eu-west-1.amazonaws.com/<my_bucket>/<my_dir> \
-e AWS_ACCESS_KEY_ID=<my_key_id> \
-e AWS_SECRET_ACCESS_KEY=<my_secret_key> \
-e RESTIC_PASSWORD=<my_restic_password> \
camptocamp/bivacThe parameters used to backup each volume can be fine-tuned using volume labels (requires Docker 1.11.0 or greater):
io.bivac.ignore=trueignores the volumeio.bivac.no_verify=trueskips verification of the volume's backup (faster)io.bivac.duplicity.full_if_older_than=<value>sets the time period after which a full backup is performed. Defaults to theBIVAC_FULL_IF_OLDER_THANenvironment variable valueio.bivac.duplicity.remove_older_than=<value>sets the time period after which to remove older backups. Defaults to theBIVAC_REMOVE_OLDER_THANenvironment variable value
If you cannot use volume labels, you can drop a .bivac.overrides file at the root of the volume:
engine = "rclone"
no_verify = true
ignore = false
target_url = "s3:http://s3-us-east-1.amazonaws.com/foo/bar"
[duplicity]
full_if_older_than = "3D"
remove_older_than = "5D"Bivac supports runing on either Docker Engine (using the Docker API), Kubernetes (using the Kubernetes API) or Rancher Cattle (using the Cattle API).
Bivac will backup all named volumes by default.
Bivac will backup all Persistent Volume Claims by default.
Bivac will backup all Volumes by default.
Bivac detects automatically the kind of data that is stored on a volume and adapts its backup strategy to it. The following providers and associated strategies are currently supported:
- PostgreSQL: Run
pg_dumpallbefore backup - MySQL: Run
mysqldumpbefore backup - OpenLDAP: Run
slapcatbefore backup - Default: Backup volume data as is
Bivac supports various engines for performing the backup:
- Restic
- RClone: use for heavy data that Restic or Duplicity cannot manage efficiently
- Duplicity
You can set the engine with either:
- an
io.bivac.enginevolume label (requires Docker 1.11.0 or great) - a global setting using the
BIVAC_ENGINEenvironment variable - the
engineparameter in the.bivac.overridesfile at the root of the volume
Bivac returns:
0if nothing failed1if a backup failed2if pushing metrics to Prometheus failed
