====== Backrest ======
[[https://github.com/garethgeorge/backrest|Backrest]] is a web frontend to [[https://restic.net/|Restic]] which is my choice of backup tools for my home server. Check [[selfhost:backup|this]] page for mor einfo in Restic and how to use it for backups.
While Restic can be used from the command line and can use //cron// to schedule backups, navigating, checking and retrieving data might not be as intuitive from the command line.
Backrest comes to help and provides a nice web GUI to do all that, plus can be used instead of cron to performo periodical backups.
Backrest since 0.16 has been updated to support sub-paths, but still has some authentication issues. You need to disable backrest authentication (asked at first login) and use Proxy-authentication, but that will work only on sub-paths. On sub-domain, you still need to disable proxy auth and use backrest authentication.
Overall the UI is nice and efficient, and Backrest can be a good addition to your management web tools.
===== Installation =====
The official documentation ([[https://github.com/garethgeorge/backrest|here]]) suggest to use their proivided install script, but it requires SystemD and overall put it's hands deep into root-only parts of the system, which i don't like.
fortunately, installing is really easy all you need to do is download the release, unzip, setup autostart and run it, that's it.
You want/need to run this as root to make sure it can actually access all the data it needs to backup. This could be mitigated by running as non-root, but in this case you carefully check that all the files are properly backed-up, and most probably direct restore will not work.
Binary releases can be found on [[https://github.com/garethgeorge/backrest/releases|this page]], identify the one good for your architecture (ex: x86_64).
Since Backrest should work even when the RAID array is not mounted, you should place it under **/opt/backrest** instead of under **/data/daemons/backrest**:
mkdir /opt/backrest
cd /opt/backrest
wget https://github.com/garethgeorge/backrest/releases/download//backrest_Linux_x86_64.tar.gz
tar zvf backrest_Linux_x86_64.tar.gz
===== Reverse Proxy =====
It's really simple to run Backrest behing NGINX:
location /backrest/ {
proxy_pass http://127.0.0.1:9898/;
proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header Authorization "";
}
===== Startup and running =====
Since i prefer OpenRC, let's create backrest init script:
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
description="restic WEB GUI interface"
pidfile="/run/backrest.pid"
command_background=true
command="/opt/backrest/backrest"
command_args="-bind-address 127.0.0.1:9898 -restic-cmd /usr/bin/restic -config-file /opt/backrest/config.json -data-dir /opt/backrest/"
depend() {
need net
}
Now just make it executable and assign to a runlevel:
chmod +x /etc/init.d/backrest
rc-update add backrest default
That's it!
(you need backrest to run as root to ensure all files can be backupped)
===== Upgrades =====
Just download latest release binary and unzip replacing the older one.
Be advised when upgrading from pre 1.0 to above 1.0 releases, that you **must** run 1,0 once and set the instance_id.