WIP: Dockerize #1

Closed
yksflip wants to merge 1 commits from yksflip/backup-bot-two:dockerize into main
Owner

Hey,
I gave the backup-bot a first shot on a Dockerfile.

open things:

  • make the crontab configurable by ENV
    For me, a per backupbot cron schedule would be sufficient. Per App would probably also be more complicated to implement.
  • How to handle ssh-key for sftp?
    Using a volume could be easy, but I think that wouldn't fit well in how abra usually works?
    Maybe secrets/envs (key, known-hosts) that are copied into ~/.ssh/ on startup.

Some inspiration was taken from https://github.com/djmaze/resticker

Hey, I gave the backup-bot a first shot on a Dockerfile. open things: * [ ] make the crontab configurable by ENV For me, a per backupbot cron schedule would be sufficient. Per App would probably also be more complicated to implement. * [ ] How to handle ssh-key for sftp? Using a volume could be easy, but I think that wouldn't fit well in how abra usually works? Maybe secrets/envs (key, known-hosts) that are copied into ~/.ssh/ on startup. Some inspiration was taken from https://github.com/djmaze/resticker
yksflip added 1 commit 2021-11-08 16:15:49 +00:00
Owner

Oh wow, this is fantastic!

I wrote my own Dockerfile at the weekend, I shamefully didn't push it at the time, but I'll have a careful look and grab the best bits from both!

make the crontab configurable by ENV
For me, a per backupbot cron schedule would be sufficient. Per App would probably also be more complicated to implement.

Having a global schedule seems like an amazing idea, I'll personally be using swarm-cronjob but I think your approach is likely to be useful to more people, so let's do both?

How to handle ssh-key for sftp?
Using a volume could be easy, but I think that wouldn't fit well in how abra usually works?
Maybe secrets/envs (key, known-hosts) that are copied into ~/.ssh/ on startup.

Again, I'd be leaning on docker secrets for these personally, and I'll put an example in the repo too -- but anything that works in more places seems like a huge plus!

Oh wow, this is fantastic! I wrote my own Dockerfile at the weekend, I shamefully didn't push it at the time, but I'll have a careful look and grab the best bits from both! > make the crontab configurable by ENV > For me, a per backupbot cron schedule would be sufficient. Per App would probably also be more complicated to implement. Having a global schedule seems like an amazing idea, I'll personally be using [swarm-cronjob](https://crazymax.dev/swarm-cronjob/usage/docker-labels/) but I think your approach is likely to be useful to more people, so let's do both? > How to handle ssh-key for sftp? > Using a volume could be easy, but I think that wouldn't fit well in how abra usually works? > Maybe secrets/envs (key, known-hosts) that are copied into ~/.ssh/ on startup. Again, I'd be leaning on [docker secrets](https://docs.docker.com/engine/swarm/secrets/) for these personally, and I'll put an example in the repo too -- but anything that works in more places seems like a huge plus!
Owner

OK, I think all these changes are now incorporated, thank you again!

  • crond is now default, swarm-cronjob is optional
  • compose.yml now includes your build: . line so we can do docker-compose build
  • S3 storage for Restic is working (tested using MinIO)
  • SSH host key can either be provided with SSH_HOST_KEY (use the full line from .ssh/known_hosts), or you can disable checking with SSH_HOST_KEY_DISABLE=1

make the crontab configurable by ENV

I added a CRON_SCHEDULE variable, and an entrypoint which loads that into the crontab.

How to handle ssh-key for sftp?

This is working as well! I had to use a raw docker secret create instead of the equivalent abra commands to load in the private key, otherwise it added newlines which SSH didn't like:

DOCKER_CONTEXT=swarm.example.com docker secret create backup_swarm_example_com_ssh_key_v1 id_rsa

@yksflip does this sound good? Down to close this PR, or is there anything I missed?

OK, I think all these changes are now incorporated, thank you again! - `crond` is now default, `swarm-cronjob` is optional - `compose.yml` now includes your `build: .` line so we can do `docker-compose build` - S3 storage for Restic is working (tested using MinIO) - SSH host key can either be provided with `SSH_HOST_KEY` (use the full line from `.ssh/known_hosts`), or you can disable checking with `SSH_HOST_KEY_DISABLE=1` > make the crontab configurable by ENV I added a [`CRON_SCHEDULE` variable](https://git.coopcloud.tech/coop-cloud/backup-bot-two/src/branch/main/.env.sample#L10), and an entrypoint which loads that into the crontab. > How to handle ssh-key for sftp? This is working as well! I had to use a raw `docker secret create` instead of the equivalent `abra` commands to load in the private key, otherwise it added newlines which SSH didn't like: `DOCKER_CONTEXT=swarm.example.com docker secret create backup_swarm_example_com_ssh_key_v1 id_rsa` @yksflip does this sound good? Down to close this PR, or is there anything I missed?
Author
Owner

awesome, thank you so much!

awesome, thank you so much!
yksflip closed this pull request 2021-11-15 14:20:39 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.