An image for deploing applications via rsync and ssh with public/private-key-authentication.
4.7K
This image contains some additional functions to handle rsync deployments via ssh. It uses ssh-private-key instead of username+password to do this.
There is just one version of the image at the moment. You can simply use the tag latest.
First of all: all instructions described in https://hub.docker.com/r/instrumentisto/rsync-ssh are also valid for this repository.
Additionaly you can use public/private-key-authentication for syncing files via rsync and ssh with more ease. Therefore 3 scripts are added:
| name | purpose | usage |
|---|---|---|
| init-ssh-agent | start the ssh-agent | . init-ssh-agent (notice the dot and the space before the command) |
| add-ssh-host-key | add an host-key to the ssh-agent | add-ssh-host-key ${MY_HOST_KEY} |
| add-ssh-private-key | add an private-key to the ssh-agent | add-ssh-private-key ${MY_PRIVATE_KEY} |
It is always necessary to add the host key for security reasons (param StrictHostKeyChecking will be automatically enabled when initializing the ssh-agent). Take a look at the following examples for cli and gitlab-ci usage
docker run --rm -i -v <volume-name>:/volume -v $(pwd):/mnt instrumentisto/rsync-ssh \
. init-ssh-agent \
&& add-ssh-host-key ${MY_HOST_KEY} \
&& add-ssh-private-key ${MY_PRIVATE_KEY} \
&& rsync -vare "ssh" /volume/ [email protected]:/my/remote/path
The following snippet assumes that ssh-host-key and ssh-private-key are set up via gitlab ci-variables.
[...]
deploy:develop:
stage: deploy
image: haendlerbund/rsync-deploy
script:
- . init-ssh-agent
- add-ssh-private-key "$SSH_PRIVATE_KEY"
- add-ssh-host-key "$SSH_SERVER_HOSTKEY"
- rsync -vare "ssh" ./ [email protected]:/my/remote/path --delete-after
environment:
name: develop
url: https://dev.example.com/
only:
- develop
[...]
Content type
Image
Digest
Size
15.1 MB
Last updated
about 6 years ago
docker pull haendlerbund/rsync-deploy