High level CLI utility for restic

Overview




autorestic logo

Config driven, easy backup cli for restic.
»»» Docs & Getting Started »»»

discord badge contributor badge downloads badge version badge



💭 Why / What?

Autorestic is a wrapper around the amazing restic. While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different locations that you want to backup to multiple locations. This utility is aimed at making this easier 🙂 .

🌈 Features

  • YAML config files, no CLI
  • Incremental -> Minimal space is used
  • Backup locations to multiple backends
  • Snapshot policies and pruning
  • Fully encrypted
  • Pre/After hooks
  • Exclude pattern/files
  • Cron jobs for automatic backup
  • Backup & Restore docker volume
  • Generated completions for [bash|zsh|fish|powershell]

Questions / Support

Check the discussions page or join on discord

Contributing / Developing

PRs, feature requests, etc. are welcomed :) Have a look at the dev docs

Comments
  • panic: runtime error: invalid memory address or nil pointer dereference

    panic: runtime error: invalid memory address or nil pointer dereference

    Describe the bug

    After a few runs of autorestic, I receive this panic and I can no longer use the program.

    Expected behavior

    This should never happen.

    Environment

    • OS: Arch Linux
    • Version: N/A

    Additional context

    The full backtrace is as follows:

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7edbf9]
    
    goroutine 1 [running]:
    github.com/cupcakearmy/autorestic/internal.GetAllOrSelected(0xb8a0a0, 0x0, 0x0, 0x4aba2a, 0x203000, 0x203000, 0x203000)
    	/home/ethin/go/pkg/mod/github.com/cupcakearmy/[email protected]/internal/config.go:157 +0x659
    github.com/cupcakearmy/autorestic/cmd.glob..func1(0xb8a0a0, 0xc000047380, 0x0, 0x1)
    	/home/ethin/go/pkg/mod/github.com/cupcakearmy/[email protected]/cmd/backup.go:22 +0x9d
    github.com/spf13/cobra.(*Command).execute(0xb8a0a0, 0xc000047370, 0x1, 0x1, 0xb8a0a0, 0xc000047370)
    	/home/ethin/go/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x2c2
    github.com/spf13/cobra.(*Command).ExecuteC(0xb8a5a0, 0xb4b4d8, 0x94f570, 0x942128)
    	/home/ethin/go/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x375
    github.com/spf13/cobra.(*Command).Execute(...)
    	/home/ethin/go/pkg/mod/github.com/spf13/[email protected]/command.go:897
    github.com/cupcakearmy/autorestic/cmd.Execute()
    	/home/ethin/go/pkg/mod/github.com/cupcakearmy/[email protected]/cmd/root.go:33 +0x2d
    main.main()
    	/home/ethin/go/pkg/mod/github.com/cupcakearmy/[email protected]/main.go:41 +0x2a
    
    bug question 
    opened by ethindp 21
  • Support for multiple folders

    Support for multiple folders

    I read the docs but couldn't find any way to backup multiple folders in one snapshot.

    This is how you would do it in restic: restic backup /root /compose /var/lib/docker/volumes

    I tried two things in .autorestic.yml:

    A:

    locations:
      docker-compose:
        from: /root /compose /var/lib/docker/volumes
        to: wasabi-linode1
    

    B:

    locations:
      docker-compose:
        from:
          - /root
          - /compose
          - /var/lib/docker/volumes
        to: wasabi-linode1
    

    Any way to do this with autorestic?😊

    enhancement 
    opened by SebDanielsson 17
  • log file doesn't contain backend/location details

    log file doesn't contain backend/location details

    Example below. All the dynamic text which is displayed in the console is not visible so you don't know what backend and backup location were processed.

    Is it possible to generate more flat-file-log-friendly output via a switch/flag?

    Configuring Backends
    
    Backing Up
    Files:           0 new,     0 changed,     1 unmodified
    Dirs:            0 new,     0 changed,     0 unmodified
    Added to the repo: 0 B
    
    processed 1 files, 0 B in 0:04
    snapshot 8a093c2a saved
    
    Finished! ð
    
    enhancement 
    opened by sumnerboy12 16
  • [Feature Request] Support for restic copy command

    [Feature Request] Support for restic copy command

    Hi, just discovered this awesome project and I wonder if we could support the restic copy command: https://restic.readthedocs.io/en/stable/045_working_with_repos.html#copying-snapshots-between-repositories

    When backing up to multiple backends, the current solution is to run restic backup command multiple times. However, if all the backends have similar options, then: 1) backing up to one repository first; 2) then copying the whole repository to all other backends; would save a lot of time and disk I/Os. However, since all data is needed to be downloaded and then uploaded, the first repository (the one as the destination of restic copy) must be fast and responsive.

    The ideal solution is: For configuration, add a copy section in the location nodes in locations. This section consists of two elements:

    • from - must be one name from backends in to list of the current location;
    • to - a list of backends

    When the backup is completed for the current location + from backend specified in the copy section, (should the time and whether to run the copy command be customizable?) autorestic should run restic copy for all to backends specified in the copy section to synchronize the snapshots.

    enhancement ready 
    opened by cqjjjzr 15
  • Add Brew formula

    Add Brew formula

    As suggested here https://github.com/cupcakearmy/autorestic/issues/57#issuecomment-826794504 it would be really handy being able to install autorestic with brew on macos.

    enhancement help wanted 
    opened by cupcakearmy 15
  • Using autorestic with cron or systemd timer and service units for automatic unattended backups.

    Using autorestic with cron or systemd timer and service units for automatic unattended backups.

    I was just wondering if it would be possible to automate autorestic backup and prune commands do backup and pruning jobs unattended at regular intervals using system units or anacron. For example like in https://github.com/erikw/restic-systemd-automatic-backup

    enhancement 
    opened by aanjaneyam 13
  • Error :

    Error : "panic: runtime error: invalid memory address or nil pointer dereference"

    Hello,

    First of all, thanks for your work.

    I don't know if the following error is a bug or a misconfiguration.

    Anyway, here it is:

    Describe the bug When I run autorestic info or autorestic backup -a, I get this error message:

    [email protected]:~$ autorestic backup -a panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7e95d9]

    goroutine 1 [running]: github.com/cupcakearmy/autorestic/internal.GetAllOrSelected(0xb84de0, 0x0, 0x0, 0x4a9dca, 0x203000, 0x203000, 0x203000) /home/runner/work/autorestic/autorestic/internal/config.go:157 +0x659 github.com/cupcakearmy/autorestic/cmd.glob..func1(0xb84de0, 0xc000045380, 0x0, 0x1) /home/runner/work/autorestic/autorestic/cmd/backup.go:22 +0x9d github.com/spf13/cobra.(*Command).execute(0xb84de0, 0xc000045370, 0x1, 0x1, 0xb84de0, 0xc000045370) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:856 +0x2c2 github.com/spf13/cobra.(*Command).ExecuteC(0xb852e0, 0xb46278, 0x94a3f0, 0x93d088) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:960 +0x375 github.com/spf13/cobra.(*Command).Execute(...) /home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:897 github.com/cupcakearmy/autorestic/cmd.Execute() /home/runner/work/autorestic/autorestic/cmd/root.go:33 +0x2d main.main() /home/runner/work/autorestic/autorestic/main.go:41 +0x2a

    Expected behavior Having some info on autorestic or doing a backup of my listed folders and docker volumes.

    Environment

    • OS: Ubuntu 20.04 LTS in a Byhive VM
    • Version: autorestic 1.1.1

    Additional context

    opened by greentin 12
  • crontab -e on doc

    crontab -e on doc

    Hi again

    Should 0 * * * * /usr/local/bin/autorestic -c /srv/.autorestic.yml be 0 * * * * /usr/local/bin/autorestic -c /srv/.autorestic.yml cron on https://cupcakearmy.github.io/autorestic/location/cron ?

    Checking autorestic -a exec snapshots, there hasn't been an updated. When I manually ran autorestic cron new backup is created.

    bug 
    opened by jin-park-dev 11
  • [Feature Request] Support for backing up docker bind mounts

    [Feature Request] Support for backing up docker bind mounts

    One of my primary backup use cases is stopping a container, backing up the bind mounted host folders, and starting the container again. It would be awesome if autorestic had this kind of functionality for locations.

    enhancement 
    opened by jacobblock 11
  • Error message for invalid YAML

    Error message for invalid YAML

    Describe the bug I installed autorestic using wget and the install script as mentioned in the instructions. Created my first yml and ended up right here :D when running autorestic as a user, but even with sudo it does not change much.

    [email protected]:~$ autorestic check
    cannot find configuration file '.autorestic.yml' or '.autorestic.yaml'.
    [email protected]:~$ autorestic check -c .autorestic.yml
    cannot find configuration file '.autorestic.yml' or '.autorestic.yaml'.
    [email protected]:~$ autorestic check -c /home/herbert/.autorestic.yml
    cannot find configuration file '.autorestic.yml' or '.autorestic.yaml'.
    [email protected]:~$ ls -la
    total 88
    drwxr-xr-x 7 herbert herbert  4096 Mar  8 10:02 .
    drwxr-xr-x 4 root    root     4096 Apr 11  2019 ..
    -rwxrwxrwx 1 herbert herbert   193 Mar  8 10:02 .autorestic.yml
    -rw------- 1 herbert herbert 30521 Mar  7 21:19 .bash_history
    -rw-r--r-- 1 herbert herbert   220 Apr 11  2019 .bash_logout
    -rw-r--r-- 1 herbert herbert  3526 Apr 11  2019 .bashrc
    drwx------ 4 herbert herbert  4096 Jul 19  2019 .config
    drwx------ 3 herbert herbert  4096 Jul 19  2019 .gnupg
    drwxr-xr-x 2 herbert herbert  4096 Oct 19  2020 .nano
    -rw-r--r-- 1 herbert herbert   675 Apr 11  2019 .profile
    drwxr-xr-x 2 herbert herbert  4096 Dec 21  2019 .ssh
    [email protected]:~$
    

    I also changed the permissions of the file to 777, same behavior.

    The file includes the following

    # cat .autorestic.yml
    locations
      files:
        from:
          - /media/files
        to: backuppi
    
    backends:
      backuppi:
        type: rest
        path: http://x.x.x.x:8000/files
    

    Environment OS: Debian Autorestic: autorestic version 1.5.5

    Thanks

    bug question 
    opened by feutl 10
  • Healthchecks integration

    Healthchecks integration

    Hi, I have a feature request: An Integration of Healthchecks. There is a hosted version, but it can also be selfhosted. It should do the following things:

    1. Webhook when starting a location
    2. Webhook when finishing a location, including status (or success/fail) as well as a (truncated?) log.

    Suggested config:

    locations:
      my-location-name:
        from: path/to/backup
        to: name-of-backend
        healthcheck: <uuid> (assume hc-ping.com) OR <url> (for selfhosting)
    

    For comparison, here is a shell script I currently use:

    HEALTHPING="https://hc-ping.com/<uuid>"
    curl -fsS -m 10 --retry 5 -o /dev/null ${HEALTHPING}/start
    LOG=$(restic [or other programs] 2>&1)
    curl -fsS -m 10 --retry 5 --data-raw "$LOG" -o /dev/null ${HEALTHPING}/$?
    

    The benefit of having that directly integrated here is that it is one thing less to break. Or in a Windows case, one thing less to properly install [curl] as well as not having to fight with shitty Windows batch syntax just to set up a backup for my moms pictures (especially once #68 is merged).

    opened by Zottelchen 8
  • Allow env variables in path for rest backend

    Allow env variables in path for rest backend

    Hi, this commit enables env variables for the rest backend.

    For the restic rest-server it isn't possible to hide the password in the autorestic config file behind a env variable, although rest-server supports this feature. This results in writing the password in clear text into the config file.

    This change enables env vars like $var and ${var} to be replaced by autorestic. You can then add your password in the config file like so:

    backends:
      rest:
        type: rest
        path: http://restic:${RESTIC_PASSWORD}@restic_server:8000
    

    Maybe a note in the documentation is helpful.

    opened by a-waider 1
  • Do not override config file when using key from environment

    Do not override config file when using key from environment

    Describe the bug My goal is to have my key in a separate file. I am following https://autorestic.vercel.app/backend/env to do that.

    However, since I elide the key field in the backend in the YAML, the config file gets overwritten with some key. I have to add key: fake to make this not happen

    Expected behavior There is some mechanism to not have the key in the YAML and not overwrite the file.

    This could possibly be documenting key: fake or equivalent. Environment

    • OS: [e.g. iOS]
    • Version: [e.g. 22]

    Additional context

    opened by howardjohn 0
  • Unable to start docker in unraid as it is not clear by the documentation where the .autorestic.yml file needs to be located

    Unable to start docker in unraid as it is not clear by the documentation where the .autorestic.yml file needs to be located

    Describe the bug I am unable to run the container as the location to .autorestic.yml is unclear from the documentation.

    Expected behavior run container

    Environment

    • OS: [e.g. iOS]
    • Version: [e.g. 22]

    Additional context

    Current Docker run command

    docker run
      -d
      --name='autorestic'
      --net='bridge'
      -e TZ="America/Chicago"
      -e HOST_OS="Unraid"
      -e HOST_HOSTNAME="EDITH"
      -e HOST_CONTAINERNAME="autorestic"
      -e 'Community_Applications_Conversion'='true'
      -l net.unraid.docker.managed=dockerman
      -v '/mnt/user/':'/data':'rw'
      -v '/mnt/user/appdata/autorestic/':'/home/':'rw' 'cupcakearmy/autorestic'
    
    opened by miguelarios 1
  • Bump ws from 5.2.2 to 5.2.3 in /docs/.codedoc

    Bump ws from 5.2.2 to 5.2.3 in /docs/.codedoc

    Bumps ws from 5.2.2 to 5.2.3.

    Release notes

    Sourced from ws's releases.

    5.2.3

    Bug fixes

    • Backported 00c425ec to the 5.x release line (76d47c14).
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies javascript 
    opened by dependabot[bot] 1
  • Bump prismjs from 1.23.0 to 1.29.0 in /docs/.codedoc

    Bump prismjs from 1.23.0 to 1.29.0 in /docs/.codedoc

    Bumps prismjs from 1.23.0 to 1.29.0.

    Release notes

    Sourced from prismjs's releases.

    v1.29.0

    Release 1.29.0

    v1.28.0

    Release 1.28.0

    v1.27.0

    Release 1.27.0

    v1.26.0

    Release 1.26.0

    v1.25.0

    Release 1.25.0

    v1.24.1

    Release 1.24.1

    v1.24.0

    Release 1.24.0

    Changelog

    Sourced from prismjs's changelog.

    1.29.0 (2022-08-23)

    New components

    Updated components

    Updated plugins

    • Line Highlight
    • Normalize Whitespace

    Other

    ... (truncated)

    Commits
    Maintainer changes

    This version was pushed to npm by rundevelopment, a new releaser for prismjs since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies javascript 
    opened by dependabot[bot] 1
  • Bump express from 4.17.1 to 4.18.2 in /docs/.codedoc

    Bump express from 4.17.1 to 4.18.2 in /docs/.codedoc

    Bumps express from 4.17.1 to 4.18.2.

    Release notes

    Sourced from express's releases.

    4.18.2

    4.18.1

    • Fix hanging on large stack of sync routes

    4.18.0

    ... (truncated)

    Changelog

    Sourced from express's changelog.

    4.18.2 / 2022-10-08

    4.18.1 / 2022-04-29

    • Fix hanging on large stack of sync routes

    4.18.0 / 2022-04-25

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
Releases(v1.7.4)
Owner
Nicco
Keyboard Surfer ⌨️
Nicco
Utility CLI to convert Spring Boot Yaml configuration into external configuration

boot-config-export Utility CLI to convert Spring Boot Yaml configuration into external configuration (as environment variables). The variables are tra

Lucian 0 Nov 17, 2021
Easy to use library and CLI utility to generate Go struct from CSV files.

csv2struct Easy to use library and CLI utility to generate Go struct from CSV files. As a benefit, it's fully compatible with csvutil. So, structs gen

Ivan Maliovaniy 12 Nov 7, 2022
A dead simple cli utility to help you manage your git stash

A dead simple cli utility to help you manage your git stash.

Fadi Khadra 3 Aug 2, 2022
Go library and CLI utility for /etc/hosts management.

Etc Hosts Management Utility & Go Library /etc/hosts Management It is easy to open your /etc/hosts file in text editor and add or remove entries. Howe

txn2: Kubernetes apps and system utilities. 277 Nov 27, 2022
Related is a simple cli utility tool to create files or a group of files.

Related - Create files based on individual definitions or groups Related helps with common file-creation-based tasks. You can predefine single types a

Andrej Benz 3 Apr 16, 2022
Flag is a simple but powerful command line option parsing library for Go support infinite level subcommand

Flag Flag is a simple but powerful commandline flag parsing library for Go. Documentation Documentation can be found at Godoc Supported features bool

null 123 Sep 26, 2022
a Go language free and open-source document for learning from zero level

Go document a GO language free and open-source document for learning from zero level Please publish and collaborate OPEN-SOURCE Sections About go lang

Erfan Hanifezade 15 Jan 8, 2023
27 solved tasks on Golang (level 1)

golang-tasks-lvl1 Решение задач level# 1 (Golang) Запуск программы go run main.go Описание Проект состоит из файла main.go, директории с решением зада

Vitaly Gudza 0 Dec 3, 2021
Jsos - A operating system that runs system-level javascript, based on the Linux kernel

JsOS ?? An linux-based operating system that runs Javascript code at the system-

Theo Paris 2 Jan 6, 2023
Elegant CLI wrapper for kubeseal CLI

Overview This is a wrapper CLI ofkubeseal CLI, specifically the raw mode. If you just need to encrypt your secret on RAW mode, this CLI will be the ea

Elm 4 Jan 8, 2022
CLI to run a docker image with R. CLI built using cobra library in go.

BlueBeak Installation Guide Task 1: Building the CLI The directory structure looks like Fastest process: 1)cd into bbtools 2)cd into bbtools/bin 3)I h

Aniruddha Chattopadhyay 0 Dec 20, 2021
A wrapper of aliyun-cli subcommand alidns, run aliyun-cli in Declarative mode.

aliyun-dns A wrapper of aliyun-cli subcommand alidns, run aliyun-cli in Declarative mode. Installation Install aliyun-cli. Usage $ aliyun-dns -h A wra

许嘉华 0 Dec 21, 2021
Symfony-cli - The Symfony CLI tool For Golang

Symfony CLI Install To install Symfony CLI, please download the appropriate vers

Symfony CLI 394 Dec 28, 2022
Go-file-downloader-ftctl - A file downloader cli built using golang. Makes use of cobra for building the cli and go concurrent feature to download files.

ftctl This is a file downloader cli written in Golang which uses the concurrent feature of go to download files. The cli is built using cobra. How to

Dipto Chakrabarty 2 Jan 2, 2022
Cli-algorithm - A cli program with A&DS in go!

cli-algorithm Objectives The objective of this cli is to implement 4 basic algorithms to sort arrays been Merge Sort Insertion Sort Bubble Sort Quick

Leonardo Brombilla Antunes 0 Jan 2, 2022
Nebulant-cli - Nebulant's CLI

Nebulant CLI Website: https://nebulant.io Documentation: https://nebulant.io/docs.html The Nebulant CLI tool is a single binary that can be used as a

Develatio 2 Jan 11, 2022
News-parser-cli - Simple CLI which allows you to receive news depending on the parameters passed to it

news-parser-cli Simple CLI which allows you to receive news depending on the par

Maxym 0 Jan 4, 2022
Go-api-cli - Small CLI to fetch data from an API sync and async

Async API Cli CLI to fetch data on "todos" from a given API in a number of ways.

Pete Robinson 0 Jan 13, 2022