Giter Club home page Giter Club logo

backup's Introduction

Backup - Docker Container

This container is used to backup your data to a restic repository.

Usage

Pull the docker image from the GitHub Container Registry

docker pull ghcr.io/valentin-kaiser/backup:latest

Run the container with the following command or use docker compose

docker run -d \
    --name backup \
    -v /path/to/your/source:/source \
    -v /path/to/your/backup:/backup \
    -v /path/to/your/password:/run/secrets/backup_password \
    ghcr.io/valentin-kaiser/backup:latest

Volumes and secrets

  • /source: The source directory to backup
  • /backup: The target directory to backup to a restic local repository
  • /run/secrets/backup_password: The password file for the restic repository

Configuration via environment variables

The container schedules the backup and forget scripts using cron. Your data should be mounted to /source and your backup to /backup, but Restic can backup to different types of repositories. Possible values are local, sftp, rest, s3, gs, b2, azure, rclone. Per default the container uses a local repository. You should mount the repository to /backup or configure it using environment variables. To secure your backup you should use docker secrets/a password file. The password file should be mounted to /run/secrets/backup_password.

You can fine tune restic and the backup and forget commands using the following environment variables and restic environment variables.

  • BACKUP_SCHEDULE: The schedule for the backup. Default: 0 0 * * *
  • FORGET_SCHEDULE: The schedule for the forget command. Default: 0 0 * * *
  • RESTIC_SOURCE: The source directory to backup. Default: /source
  • RESTIC_REPOSITORY: The backup repository. Default local directory: /backup
  • RESTIC_PASSWORD_FILE: The password file for the restic repository. Default: /run/secrets/backup_password
  • RESTIC_BACKUP_ARGS: The arguments for the backup command. Default: --exclude-caches --exclude-if-present=.nobackup --exclude-file=/.backupignore
  • RESTIC_FORGET_ARGS: The arguments for the forget command. Default: --prune --keep-daily 7 --keep-weekly 4 --keep-monthly 6
  • RESTIC_COMMPRESSION: The compression algorithm to use. Default: auto

Scripts

The container ships with four scripts:

  • /entrypoint.sh: The entrypoint script ensures that the restic repository is initialized and the cron job is scheduled and daemon started
  • /backup.sh: The backup script runs the restic backup command and will be scheduled by cron to create new backups
  • /forget.sh: The forget script runs the restic forget command and will be scheduled by cron to prune old backups
  • /restore.sh: The restore script leads you through the restore process

Logging

The container logs to three different log files that can be found in /var/log:

  • /var/log/backup.log: The output of the backup command
  • /var/log/forget.log: The output of the forget command

backup's People

Contributors

valentin-kaiser avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

Simon Nils Rach avatar Simon Lukas avatar  avatar

backup's Issues

fusermount not installed

fusermount: exec: "fusermount": executable file not found in $PATH
unable to umount (maybe already umounted or still in use?): exec: "fusermount": executable file not found in $PATH

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.