borgmatic-collective / docker-borgmatic

Borgmatic in Docker
GNU General Public License v3.0
341 stars 92 forks source link

Remote SSH repositories #1

Closed witten closed 6 years ago

witten commented 6 years ago

Author of borgmatic here. This is super cool! I want to use it. However, I create backups with borgmatic and Borg to repositories on a remote host via SSH, instead of a local repository that can be conveniently mounted into a container.

So consider this a feature request for your Docker container to support SSH repositories. I'm not that familiar with Alpine, but I think all you may need to do is apk install "openssh-client", and then document how to mount an "~/.ssh/" volume into a container so that passwordless SSH will work when cron runs borgmatic automatically. I'm happy to beta test this if you like.

For background, here are the Borg docs on remote SSH repositories: https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls

grantbevis commented 6 years ago

Good Afternoon Dan,

Firstly, thank you for your fantastic work with borgmatic. I was fumbling around with a silly shell script for ages before I found your repo.

You’re absolutely right, adding in ‘openssh-client’ should do the trick. I have noticed some other Borg containers also install sshfs which I have added which installs openssl-client as a dependancy.

I’ve just pushed an update to my repo for this which should trigger a rebuild on the Docker Hub.

Please let me know how you get on.

Kind regards, b3vis

On 9 Oct 2017, at 05:21, Dan Helfman notifications@github.com wrote:

Author of borgmatic here. This is super cool! I want to use it. However, I create backups with borgmatic and Borg to repositories on a remote host via SSH, instead of a local repository that can be conveniently mounted into a container.

So consider this a feature request for your Docker container to support SSH repositories. I'm not that familiar with Alpine, but I think all you may need to do is apk install "openssh-client", and then document how to mount an "~/.ssh/" volume into a container so that passwordless SSH will work when cron runs borgmatic automatically. I'm happy to beta test this if you like.

For background, here are the Borg docs on remote SSH repositories: https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls https://borgbackup.readthedocs.io/en/stable/usage/general.html#repository-urls — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/b3vis/docker-borgmatic/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ATTvpXJw-_CtlSLJ84a9x7TyI_qUuw51ks5sqZ88gaJpZM4Px_fN.

witten commented 6 years ago

Awesome, thanks for doing this so quickly! I'll give it a shot. Note that you have "sshfs" twice in the apk upgrade command. Looks like it was already there prior to this change.

grantbevis commented 6 years ago

So I did… well that’s embarrasing! I’ve just removed the duplicate and pushed it to GitHub. It needed the linux-headers package adding anyway as something had changed and Borg was no longer building.

On 10 Oct 2017, at 04:41, Dan Helfman notifications@github.com wrote:

Awesome, thanks for doing this so quickly! I'll give it a shot. Note that you have "sshfs" twice in the apk upgrade command. Looks like it was already there prior to this change.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/b3vis/docker-borgmatic/issues/1#issuecomment-335351757, or mute the thread https://github.com/notifications/unsubscribe-auth/ATTvpfnQcRqrF2GiN5gSbnp2ILKEm7m3ks5squdYgaJpZM4Px_fN.

witten commented 6 years ago

This appears to be working out just fine in testing! I'm using Docker Compose, and here's the configuration I'm using to make use of your container:

version: '3'

services:
    backup:
        image: b3vis/borgmatic
        hostname: "${NODE_NAME}-calendar-server"
        volumes:
            - /my/source:/source:ro
            - /root/.ssh:/root/.ssh:ro
            - /etc/borgmatic:/config
            - /var/cache/borg:/cache
        environment:
            BORG_PASSPHRASE: "${BORG_PASSPHRASE}"

Pretty neat!

grantbevis commented 6 years ago

Thanks for the update Dan I'm glad it worked for you :)