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

Issues
  • 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
  • Snap packaging

    Snap packaging

    I'd quite like to have autorestic packaged as a Snap so I would be able to install it using a package manager, and so I could confine it in a security sandbox. I'm more than happy to contribute the package myself if there's interest!

    opened by mz2 1
  • Command to mount backups

    Command to mount backups

    Is your feature request related to a problem? Please describe. A simple command to mount backups would be very useful

    Describe the solution you'd like autorestic mount backend_name /destination And optonal parameters to filter by tag, just like restic

    opened by trenoduro 0
  • Unit tests

    Unit tests

    Hi, thanks for working on autorestic, it has been really helpful!

    I was looking to contribute to the project and noticed there are no unit tests, or there might be but I must have missed them.

    I think unit tests would make the development and release process much better and would love to contribute by writing some. Please let me know what you think.

    opened by kencx 2
  • Please be patient ❤️

    Please be patient ❤️

    Thanks to all the people that use and contribute, file bugs and feature requests. Means a lot to me!

    Please be patient that I don't always find the time to review and fix all the stuff and I know that it can be frustrating when people put work in an issue or even a PR and it lies around for a few weeks, plase understand that I will review at some point, I just can't give any time guarantees.

    documentation 
    opened by cupcakearmy 1
  • Disable auto key generation for config managment

    Disable auto key generation for config managment

    Is your feature request related to a problem? Please describe.

    I'm using config management to deploy autorestic on multiple servers. My ansible role creates autorestic config files in a declarative manner. Even though I like the idea of auto-generating keys, and adding them to the config file for interactive sessions, this functionality stands against the principle of declarative config management. Usually it works well when I provide a key with ansible, so autorestic doesn't need to modify the config file. However, there are situations where you try to setup a new backend and doen't supply the key yet, and a auto-modified config is pretty confusing.

    Describe the solution you'd like

    • Add a flag that disables auo key generation of the config file (i.e. --no-key-generation)

    First I thought it would be good to ask the user for permission to modify the config file but in automated backups using cron jobs i.e. this is not possible, so autorestic should just fail in case of a missing key, if this option is set.

    What do you think ?

    bug 
    opened by varac 2
  • Use YAML options when calling check or init

    Use YAML options when calling check or init

    This PR attempts to fix #198.

    It mimics the utility function that merges all options for a given command, but as check or init are backend-related, we don't have a Location object to call the existing function.

    It works, however I am not familiar with Go and I find my code little elegant. Feel free to improve it ! :)

    opened by Chostakovitch 2
Releases(v1.7.1)
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 10 Jun 13, 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 Jan 10, 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. 265 Jun 21, 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 120 Apr 1, 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 16 May 9, 2022
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 1 Mar 8, 2022
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 330 Jun 20, 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