Sign inSign up

haendlerbund/rsync-deploy

By haendlerbund

•Updated about 6 years ago

An image for deploing applications via rsync and ssh with public/private-key-authentication.

Image
0

4.7K

haendlerbund/rsync-deploy repository overview

This image contains some additional functions to handle rsync deployments via ssh. It uses ssh-private-key instead of username+password to do this.

⁠Included configuration

  • base-image: instrumentisto/rsync-ssh:latest
  • software: bash, git, curl

⁠Versions

There is just one version of the image at the moment. You can simply use the tag latest.

⁠Usage

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:

namepurposeusage
init-ssh-agentstart the ssh-agent. init-ssh-agent (notice the dot and the space before the command)
add-ssh-host-keyadd an host-key to the ssh-agentadd-ssh-host-key ${MY_HOST_KEY}
add-ssh-private-keyadd an private-key to the ssh-agentadd-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

⁠cli
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
⁠gitlab-ci

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
[...]

Tag summary

Content type

Image

Digest

Size

15.1 MB

Last updated

about 6 years ago

docker pull haendlerbund/rsync-deploy