Sign inSign up

cjimti/irsync

By cjimti

Updated over 8 years ago

Containerized rsync on interval.

Image
1

3.7K

cjimti/irsync repository overview

irsync: interval rsync

Interval rsync

Source: https://github.com/cjimti/irsync

Maintainability Go Report Card GoDoc

Docker Container Image Size Docker Container Layers Docker Container Pulls

Command line utility and Docker container for running rsync on an interval.

Demo

Setup a quick demo using Dockers docker-compose command. Included with this project is a docker-compose.yaml with a simple client/server setup. In this composer configuration irsync is set to check the server every 30 seconds (after sync is complete. The server mounts the ./data/source directory and the client mounts the ./data/dest directory. Drop files in ./data/source and see them appear in ./data/dest.

Setup and run demo (requires Docker):

# create a source and dest directories (mounted from the docker-compose)
mkdir -p ./data/source
mkdir -p ./data/dest

# make a couple of sample files
touch ./data/source/test1.txt
touch ./data/source/test2.txt

# get the docker-compose.yml
curl https://raw.githubusercontent.com/cjimti/irsync/master/docker-compose.yml >docker-compose.yml

# run docker-compose in the background (-d flag)
docker-compose up -d

# view logs
docker-compose logs -f

# drop some more files in the ./data/source directory
# irsync is configured to check every 30 seconds in this demo.

#### Cleanup

# stop containers
docker-compose stop

# remove containers
docker-compose rm

Run Container

Example #1

Sync files from a remote server on 30 second interval

docker run --rm \
    -v "$(pwd)"/data:/data \
    -e RSYNC_PASSWORD=password \
    -e IRSYNC_INTERVAL=30 \
    -e IRSYNC_FROM=rsync://[email protected]:873/data/"\
    -e IRSYNC_TO=./data \
    -e IRSYNC_DELETE=true \
    cjimti/irsync

Environment Configuration

  • IRSYNC_INTERVAL=10 Start next interval 10 seconds after the last completion.
  • IRSYNC_TIMEOUT=7200 Timeout rsync and start next interval if the time exceeds 7200 seconds.
  • IRSYNC_FROM=./ rsync from location
  • IRSYNC_TO=./data rsync to location
  • IRSYNC_FLAGS=-pvrt` rsync flags (verbose is required)
  • IRSYNC_DELETE=false resync --delete flag added if set to true.

Development

Building and Releasing

Interval rsync uses GORELEASER to build binaries and Docker containers.

Test Release Steps

Install GORELEASER with brew (MacOS):

brew install goreleaser/tap/goreleaser

Build without releasing:

goreleaser --skip-publish --rm-dist --skip-validate
Release Steps
  • Commit latest changes
  • Tag a version git tag -a v1.4 -m "my version 1.4"
  • Push tag git push origin v1.5
  • Run: GITHUB_TOKEN=$GITHUB_TOKEN goreleaser --rm-dist

Resources

Tag summary

Content type

Image

Digest

Size

4.7 MB

Last updated

over 8 years ago

docker pull cjimti/irsync