S3 with the official restic package

What app is this about, and its version: 0.18.0~ynh3
What YunoHost version are you running: 12.1.23
What type of hardware are you using: Other(?)

Describe your issue

Hardware: OVH Kimsufi dedicated x86 server

Since the update from restic 0.12 to 0.18, my backups fail systematically.
With the package provided scripts, the script fails without much explanation. If I switch back the script in /etc/yunohost/hooks.d/backup_method to my old, after swapping /usr/local/bin/restic for /var/www/restic/restic, I get a failure on s3.getCredentials.

And of course, restic_check is in failure state no matter the script in backup_method.

Instead of debugging a set old script that are doomed to break again at some point, I would like to ask: what would be the “Yunohost’s restic” way to backup on a S3 bucket?

Thanks!

Share relevant logs or error messages

With package’s scripts:
REMOVED FROM NOW, PASSWORD WAS INCLUDED

With old custom script (different server but normally exact same config and settings):
REMOVED FROM NOW, PASSWORD WAS INCLUDED

Hi,

The latest YunoHost Restic version includes a new way to export backups to an S3 server (and whatever else supported by Restic). This was not possible before so this is very new and lacks real-world testing

Firt you need to set the Repository address as explained in Restic documentation (Preparing a new repository — restic 0.18.0 documentation). It should start with “s3:”. Set it in YunoHost Admin app config page or with command-line:

yunohost app setting restic repository -v "s3:https://server:port/bucket_name"

Then, use YunoHost Admin app config page to set environment variables (in “Advanced configuration” section). You’ll need to add:

AWS_ACCESS_KEY_ID=<MY_ACCESS_KEY>
AWS_SECRET_ACCESS_KEY=<MY_SECRET_ACCESS_KEY>

Then start a new backup and check the logs (journalctl -u restic -e, tail /var/log/restic/backup-error.log…) and tell me if you have some errors

1 Like

Hi there!
So I did that on my 2 instances, and it worked!
Script launched:

/var/www/restic/backup-with-restic

The only error message I got in /var/log/restic/backup-error.log was:

unable to open cache: unable to open cache directory: neither $XDG_CACHE_HOME nor $HOME are defined

(repeated many times)

That seems a minor issue to me right now.
I then launched /var/www/restic/check-with-restic and I got no error again!

Nice ! Now you can verify that your backups are working (for example app roundcube):

cd /var/www/restic/
source .env
RESTIC_REPOSITORY=$(yunohost app setting restic repository) 
./restic -r "$RESTIC_REPOSITORY/auto_roundcube" ls latest

And if you want to restore : Restoring from backup — restic 0.18.1-dev documentation

(the files have to be put inside a .tar archive and this archive should be moved in /home/yunohost.backup/archives/ to be detected by YunoHost)

1 Like

It works! I can list some fresh entries from last night auto backup!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.