Restic app works, kind of. Now what?

My YunoHost server

Hardware: VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / …
YunoHost version: latest
I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen | …
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no / yes
If yes, please explain:

Description of my issue

Hello all.

Just looking to fill in the gaps with Restic. I have installed the Yunohost app. I installed it with the default time settings, changing of course the location of my external USB drive. I received the email regarding the ssh key and followed the instructions.

If my understanding is correct Restic is supposed to do a backup at 00:15 every day? I looked today and nothing has happened, If I use the CLI I can do backups/restore manually, I can do everything via the CLI with Restic with no problem what I’m trying to do now is tell the Restic app what to backup and at what time which is what I thought was in the app set up at install, and there is no config available via the app once installed.

If I look at the YNH WebUI log I see the attached.

Can anyone help me with this by any chance?

Is it best to just uninstall the app and install Restic via the CLI and create a CRON job etc?
Where do I find the YNH app of Restic log to see what has happened (so far nothing using the app)?

I have confirmed Restic works I just can’t find a way to tell it what apps and when.

Basically, I want the whole server, users, emails, apps etc backed up at 01:00

Many thanks

Dj

Sorry, I forgot to add.

I did get an email:

SUBJECT: YunoHost Restic backup log on xxxxxxxxxxxx.co.uk (SUCCESS)

The rest of the email was empty. Again when I look at the repository I only have the two snapshots I did manually via the CLI

you can share one of those failed logs, so we could get more detail on the subject.

also, check ownership for the mounted point in that USB, your restic user should have write permission (at least)

Hello.

I’m not sure where to recover the log on this occasion. Also restic is working, I have already started creating snapshots and restoring to test it but that all through the cli

Dj

yes, if you understand what cron is and to make basic scripts, i would do that. I do this.

@arkadi Thanks for your reply. Yes I thought it might be the way. I have tried the app several times and the result is the same, so yes I’ll just install from the cli and not use the app.

I understand Cron and systemd, I think. How do you get Restic to back up everything? I can backup directories etc, so during testing etc I backed up home and www with success.

Anything that you can share would be very much appreciated. I’ve had more success with Restic than Borg… :rofl:

Many thanks again

Dj

This is what I did.

If you know how to use Ansible, we have integrated a restic role into our Ansible collection for Yunohost, you can check it out: Ansible Galaxy
With it, I can easily install and configure Restic in one ansible-playbook run and it’s working in production :slight_smile:

2 Likes

@lydra Hmmm says that

Yunohost shouldn’t be already installed.

I have a perfectly working system right now and not ready for a reinstall… Yet :rofl:

@arkadi thanks very much… I’ll give this one a go.

I’ll let you know how it goes…

dj

@arkadi thanks very much. I followed the tutorial at Daily Automated Backups with Restic so I now have an external USB drive at the following:

/media/storage/resticbackups

I have initialized the directory for use with Restic and I’ve tested it…

I tried your:

restic backup /home/yunohost.backup/archives --verbose --tag yunohost

but this returned:

open repositoryFatal: Please specify repository location (-r or --repository-file)

if append the statement with my location /media/storage/resticbackups I get the same result
Is something missing in the sytax?

I figured it out, eventually, and used the following:

restic -r /media/storage/resticbackup backup /var/www/wordpress

Bang! the password was asked for and entered and the backup happened. Yeah!! I can see the snapshots, look in them, restore and delete them. Excellent. I spent a half hour or so playing with snapshots etc.

I expanded the command to:

restic -r /media/storage/resticbackup backup /var/www/ /home/ /opt/yunohost --verbose --tag Restic_test

This backs up the home folder, all the www servers, and the odd yunohost server (Navidrome)

However, I like your option which saves the yunohost.archive. My yunohost.archive is quite large right now so I used other directories to backup.

The next step is to automate the process of course.

I tried your:

cd ~ nano .restic-backup export RESTIC_REPOSITORY=""/mnt/backup/my-backups"" export RESTIC_PASSWORD=""YOURPASSWORDHERE""

replaced it with my info to:

cd ~ nano .restic-backup export RESTIC_REPOSITORY=""/media/storage/resticbackup"" export RESTIC_PASSWORD=""REPO_PASSWORD_HERE""

I assume that this hidden file is saved in the root?

I tried it but it didn’t work sadly. To be honest I’m not sure whats going on.

I guess the first step is to create an executable script that runs:

restic -r /media/storage/resticbackup backup /var/www/ /home/ /opt/yunohost --verbose --tag Restic_test

Then Cron that script?

Sorry to be a pain, but I’m just having difficulties creating the file .restic-backup then Croning that script.

Restic works fine I just want to get the script to run first manually so that I understand what’s going on then set up a cron job.

I do like the idea of backing up the archive directory though, very useful.

Many thanks

Dj

You need to supply it with the command

source /home/admin/.restic-backup

This will load those variables into the shell.
Then when you do the command, restic will look for those variables so you don’t have to type this.

I showed this in the shell script I made:

#!/bin/bash
source /home/admin/.restic-backup
restic backup /home/yunohost.backup/archives --tag yunohost
restic backup /home/admin/ --tag home
etc.

You need a source file like this so cron can just run by itself without intervention from yourself.

You could store this wherever you like. I run the cron script as root.

Yes. Of course test everything out first.

Basic Script Example, filename: restic-backups

#!/bin/bash
source /home/admin/.restic-backup
restic backup /home/yunohost.backup/archives --tag yunohost
restic backup /home/admin/ --tag home
etc.

Make sure your shell script is executable
chmod +x restic-backups

Cron task:
0 11 * * * root /home/admin/restic-backups

Hope that clears up a few points. I guess I should revisit this tutorial to fill in a few of the blanks.

BONUS: Good link to learn more about source files.