Skip to content

InformaticsMatters/docker-volume-replicator

Repository files navigation

docker-volume-replicator

Architecture CodeFactor

GitHub tag (latest SemVer pre-release)

build latest build tag

A simple container image that expects two volume mounts "/volume-a" and "/volume-b" where data is replicated (using rsync) from one to the other based on an environment variable whose value is either AtoB or BtoA.

When running the image...

  1. Mount volumes onto the paths /volume-a and /volume-b
  2. Set environment variable REPLICATE_DIRECTION (to either AtoB or BtoA)
  3. Set environment variable REPLICATE_DELETE to anything other than yes to avoid wiping the destination

In 2.0 you can use S3 as a destination or source. To do this you must set VOLUME_A_IS_S3 (where '/volume-a' is expected to be the S3 volume). See the docker-entrypoint.sh for details of these and other related environment variables.

In 3.0 rclone can be used to synchronise the volume to an S3 bucket. We do this by setting USE_RCLONE (to yes) and providing values for AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION, and S3_BUCKET_NAME.

In 3.1 you can use rclone to replicate to a sub-directory that is different for each day of the week. By setting USE_DOW_FOR_RCLONE (to yes) you can keep backups for up to a week i.e. using sub-directories 1-Monday, 2-Tuesday, etc.

In 3.2 you can append arbitrary options to the rclone command by setting RCLONE_EXTRA_OPTIONS. If it is not set an empty string is used, leaving the rclone command unchanged. For example, to limit the transfer bandwidth you might set RCLONE_EXTRA_OPTIONS to --bwlimit 10M.

Building the image

To build an image tagged 3.2.0 just run docker compose...

$ export IMAGE_TAG=3.2.0
$ docker compose build

And run typically with something like: -

$ docker run --rm -e REPLICATE_DIRECTION=AtoB \
        -v $PWD/a:/volume-a \
        -v $PWD/b:/volume-b \
        informaticsmatters/volume-replicator:$IMAGE_TAG

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors