https://github.com/informaticsmatters/docker-volume-replicator
A small image that replicates a (kubernetes) volume
https://github.com/informaticsmatters/docker-volume-replicator
Last synced: about 1 month ago
JSON representation
A small image that replicates a (kubernetes) volume
- Host: GitHub
- URL: https://github.com/informaticsmatters/docker-volume-replicator
- Owner: InformaticsMatters
- Created: 2020-05-28T11:26:31.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2023-08-02T21:30:36.000Z (almost 3 years ago)
- Last Synced: 2025-03-20T21:49:26.252Z (about 1 year ago)
- Language: Shell
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-volume-replicator (3.0)

[](https://www.codefactor.io/repository/github/informaticsmatters/docker-volume-replicator)

[](https://github.com/informaticsmatters/docker-volume-replicator/actions/workflows/build-latest.yaml)
[](https://github.com/informaticsmatters/docker-volume-replicator/actions/workflows/build-tag.yaml)
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.
## Building the image
To build an image tagged `3.1.0` just run docker compose...
$ export IMAGE_TAG=3.1.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
---