Hi, I'm Barnaby Keene, also known as Southclaws.
Experienced with a wide variety of creative tools and technical skills, I like to solve design, storytelling and technical problems in digital media.
Backups done right... by robots! Restic backup but the robot friendly version.
License: MIT License
Hi, I'm Barnaby Keene, also known as Southclaws.
Experienced with a wide variety of creative tools and technical skills, I like to solve design, storytelling and technical problems in digital media.
As far as I can see only one configuration is supported. In my use case with plain restic I am backing up to multiple servers. I'm also using multiple repos on the same server (in order to better handle deduplication vs locking ). These require different configurations for each invokation of restic. Is this supported or planned? Perhaps multiple instances of the service is the way to go?
Hi,
while experimenting with restic-robot for windows server 2022 backup, we noticed issues with paths that contain spaces.
While restic itself has no issues with restic.exe backup "C:\FTP TASKS" I could not find a working way with restic-robot.
I tried
"C:\FTP TASKS
""Is there a working solution somewhere that I could not find or is this a real bug? This might be even more complicated when multiple paths containing spaces have to be passed.
Any further information I can provide to help narrow this down? I think this should be quite easy to replicate.
I wanted to start a new backup but restic-robot finished after 2s backup time with "backup completed" even there was nothing transfered (server directory is conpletely empty).
There's also no sign of any error in the logs
❯ docker-compose up
Creating network "restic-robot_default" with the default driver
Pulling backup (southclaws/restic-robot:)...
latest: Pulling from southclaws/restic-robot
df20fa9351a1: Already exists
3c34c8da4207: Pull complete
5d88dfe983d2: Pull complete
5de6afcc5460: Pull complete
Digest: sha256:f763655497cf4916ceb880c04d7dfc560a2338745006a78ff5bec18f4b40f602
Status: Downloaded newer image for southclaws/restic-robot:latest
Creating restic-robot ... done
Attaching to restic-robot
restic-robot | {"level":"info","ts":"2020-10-07T18:54:41.991Z","caller":"restic-robot/main.go:207","msg":"ensuring backup repository exists"}
restic-robot | {"level":"info","ts":"2020-10-07T18:54:44.219Z","caller":"restic-robot/main.go:219","msg":"successfully created repository"}
restic-robot | {"level":"info","ts":"2020-10-07T18:54:44.219Z","caller":"restic-robot/main.go:85","msg":"backup started"}
restic-robot | {"level":"info","ts":"2020-10-07T18:54:46.519Z","caller":"restic-robot/main.go:136","msg":"backup completed","duration":2.299721993,"filesNew":5861,"filesChanged":0,"filesUnmodified":0,"filesProcessed":5861,"bytesAdded":34141634560,"bytesProcessed":31629246464}
I was using this docker-compose file:
---
# https://github.com/Southclaws/restic-robot#docker-compose
version: "3"
services:
backup:
container_name: 'restic-robot'
image: southclaws/restic-robot
# restart: always
environment:
# every day at 2am
SCHEDULE: 0 0 2 * * *
RESTIC_REPOSITORY: test
RESTIC_PASSWORD: ...
RUN_ON_BOOT: "true"
# restic-robot runs `restic backup ${RESTIC_ARGS}`
# so this is where you specify the directory and any other args.
RESTIC_ARGS: /data
volumes:
# Bind whatever directories to the backup container.
# You can safely bind the same directory to multiple containers.
- "/etc:/data/etc"
Apart from the path to backup source, restic supports a number of additional parameters, for example file/folder excluding based on a pattern. In our case the restic command looks like
restic backup --exclude="audit*" /backup-source/vault -r /backup-target/vault
We are trying to migrate to restic-robot (mainly for the prometheus' alerts sake) and have bumped into a problem that restic-robot does not support spaces in RESTIC_ARGS variable.
The code looks like this:
backup:
command: -c "RESTIC_PASSWORD=`cat /run/secrets/RESTIC_PASSWORD` restic-robot"
deploy:
mode: replicated
replicas: 1
entrypoint:
- sh
environment:
RESTIC_ARGS: --exclude='audit*' /backup-source/vault
RESTIC_REPOSITORY: /backup-target/vault
SCHEDULE: 0 15 13 * * *
And the backup fails with the following message:
{"level":"error","ts":"2020-07-20T13:15:00.011Z","caller":"restic-robot/main.go:106","msg":"failed to run backup","error":"exit status 1","output":"Fatal: nothing to backup, please specify target files/dirs\n","stacktrace":"main.(*backup).Run\n\t/restic-robot/main.go:106\ngithub.com/robfig/cron.(*Cron).runWithRecovery\n\t/go/pkg/mod/github.com/robfig/[email protected]/cron.go:165"}
With the argument looking like this:
RESTIC_ARGS: "/backup-source/vault --exclude=\"audit*\""
the error message changes a bit:
{"level":"error","ts":"2020-07-20T13:39:00.011Z","caller":"restic-robot/main.go:106","msg":"failed to run backup","error":"exit status 1","output":"/backup-source/vault --exclude=\"audit*\" does not exist, skipping\nFatal: all target directories/files do not exist\n","stacktrace":"main.(*backup).Run\n\t/restic-robot/main.go:106\ngithub.com/robfig/cron.(*Cron).runWithRecovery\n\t/go/pkg/mod/github.com/robfig/[email protected]/cron.go:165"}
Would it be possible to add support for multiple optional restic arguments?
Looking at the mission / vision / idea of resticr-robot, it really fit's exactly what i was looking at.
Currently we deploy rclone/restic jobs via chef, run them via cron an report issue via webhooks (mattermost).
While this works, the usual issue is, not getting a notification means:
So on that front, restic-robot seems to be a good pick, esp. with metrics being picked up by prometheus and you can then define alarms if the 'amount of jobs' / 'files' / 'data size' since below a value.
So all in all, i like your concept fairly much!
The final question is, as it is with such projects, roles change, companies change and as it was born it often dies. What is the current health of the project in you POV? Does adopting make sense?
I am not sure if/when the restic error message changed but the string search on line 184 in main.go is now:
if strings.HasSuffix(strings.Trim(out.String(), " \n\r"), "already initialized") {
instead of:
if strings.HasSuffix(strings.Trim(out.String(), " \n\r"), "already exists") {
Hopefully this is helpful.
Thank you for a great tool!
Restic robot does an amazing job creating snapshots, but if someone don't keep an eye on it, the snapshots size can increase indefinitely. A way to solve it is by calling restic forget
, which could be configured as an environment variable as well.
See https://prometheus.io/docs/practices/naming/#base-units.
Line 30 in 0ba420b
Sometimes it would come handy to run a script prior to the scheduled backup, for example to dump a database. Of course, such a dump could happen in a dedicated container, but getting the timing between dump and backup might be difficult.
Hello,
( I did not even try this wrapper ), would be nice to have also ERROR_COMMAND
, which will be triggered if backup will fail. Of course I can probably set up alermanager alert, but
ERROR_COMMAND
can be better for handling backup metadata directly from this wrappper.
For example:
ERROR_COMMAND
: curl $SLACK_URL -d "Backup $METADATA failed...,because $ERROR"
POST_COMMAND
: curl $SLACK_URL -d "Backup $METADATA success..."
It can be probably done with https://github.com/healthchecks/healthchecks, but thats another additonal component ( just like prometheus + alertmanager ).
Thanks :)
Hi Southclaws,
can you please add a license to this project?
Would be good to get Goreleaser set up on an Action so there's an automated release cycle.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.