Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.
/ borg-rclone Public archive

Borgmatic and rclone in Docker

License

Notifications You must be signed in to change notification settings

tuetenk0pp/borg-rclone

Repository files navigation

borg-rclone

Warning

This Repository is now archived, because the feature got implemented upstream. See this PR for reference: borgmatic-collective/docker-borgmatic#324.

You might still want to follow part of the instructions to setup rclone initially.

Description

This repository extends the Docker image for Borgmatic. It adds rclone to the image to make it easy to sync backups to remotes other than ssh.

Usage

Important

Before you start, head over to the Borgmatic repository to find out how to use the image.

  1. Copy .env.template to .env and modify them to match your setup.

  2. Place your existing Borgmatic config in ./data/borgmatic.d or create a new one with this command:

    docker run -it --rm --mount type=bind,src="$(pwd)/data/borgmatic.d",target="/etc/borgmatic.d" ghcr.io/tuetenk0pp/borg-rclone bash -c "borgmatic config generate -d /etc/borgmatic.d/config.yaml"
  3. Create a file rclone.conf with a valid remote config and place it here: ./data/.config/rclone/rclone.conf

    docker run -it --rm --mount type=bind,src="$(pwd)/data/.config/rclone",target="/root/.config/rclone" ghcr.io/tuetenk0pp/borg-rclone bash -c "rclone config"
  4. Add this to your Borgmatic config and replace RCLONE_DEST with your remote:bucket you configured in the previous step:

    after_everything:
        - rclone sync /mnt/borg-repository RCLONE_DEST -P --stats 1m -v 2>&1 && echo Completed actions.
  5. Optional: If you are starting new, initialize the repository with the following command:

    # Borg 1.x
    docker compose run -it --rm borgmatic init --encryption repokey
    
    # Borg 2.x
    docker compose run -it --rm borgmatic rcreate --encryption repokey-aes-ocb
  6. Use docker compose up -d to start the container and start taking backups 😎 .

Build

docker build . -t tuetenk0pp/borg-rclone:dev