Git Product home page Git Product logo

docker-rsync's Introduction

rsync

A container for rsync:ing stuff

Environment

These environment variables can be used to configure the container

DEBUG=
SSH_PRIVATE_KEY_FILE=/secrets/id_rsa
SSH_PRIVATE_KEY=<private key here> # Prioritized over SSH_PRIVATE_KEY_FILE if set
SSH_KNOWN_HOSTS_FILE=/config/know_hosts
SSH_KNOWN_HOSTS=<known_hosts contents here> # Prioritize dover SSH_KNOWN_HOSTS_FILE if set
RSYNC_SOURCE=/m/source/
RSYNC_TARGET=/m/target/
RSYNC_OPTIONS=-avz

SSH_PRIVATE_KEY_FILE should contain path to the private key to be used for accessing any remote hosts. Alternatively the key can be directly given in the SSH_PRIVATE_KEY. SSH_PRIVATE_KEY will be prioritized if both are set.

SSH_KNOWN_HOSTS_FILE should contain the public keys for the ssh hosts that will be accessed. Format is whatever will be accepted as UserKnownHostsFile in ssh_config. Alternatively the contents of the file can be given in SSH_KNOWN_HOSTS. SSH_KNOWN_HOSTS will be prioritized if both are set

RSYNC_SOURCE and RSYNC_TARGET will be fed to rsync as is. They can be either local (e.g. /path/to/file) or remote (e.g. [email protected]:/path/to/file) or whatever rsync normally accepts.

RSYNC_OPTIONS can be used to define extra options for rsync. Do not override the ssh command ('-e' -flag). Anything that would need the ssh command to be customized (e.g. different ssh port) are not well supported at the moment.

OpenShift

Make sure you have have the OpenShift CLI tools installed and that you are logged in

oc login

Setup ImageStream in OpenShift

Before using the rsync image, we need to import it from dockerhub to the OpenShift internal registry

Import the image:

oc import-image rsync:latest --from=docker.io/secoresearch/rsync:latest --confirm --scheduled true

Set the lookup policy for the imagestream. This makes it so that Kubernetes Resources (e.g. ubilds, Jobs) can refernece the imagestream directly.

oc set image-lookup rsync

If you wish, you can replace the imagestream name 'rsync' with something else.

Scheduled Rsync

TODO: Setting up known_hosts config not explained here

In the openshift/ folder, there is a template that can be used to schedule rsync of a folder/file between a volume and a remote host

First you need to have an OpenShift secret containing the private ssh key used to access the remote host. If you don't have one, create one e.g.

oc create secret generic <secret-name> --from-file=ssh-privatekey=<path/to/ssh/privatekey> --type=kubernetes.io/ssh-auth

To create an rsync CronJob using the template:

oc process -f 'template-rsync-cronjob.yaml' --param-file <template-parameters-file> | oc create -f -

or

oc process -f 'template-rsync-cronjob.yaml' -p CRONJOB_NAME=example-rsync -p ... | oc create -f -

See rsync-cronjob-example.params for an example parameters file.

docker-rsync's People

Contributors

piiroim1 avatar makerspaceministries avatar

Forkers

mkomuc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.