I'll try my best (sorry for my bad English 😉 )
I'll try to make a summary, if you need more info, let me know.
1. Install RClone
First Install en config RClone to sync to onedrive or sharepoint. I followed these instructions: https://rclone.org/onedrive/
Keep in mind that is you want to use autorestic, you should not us a configpassword because autorestic can't handle that.
In my case I sync to a private SharePoint folder.
2. Install Restic
Then you need to install restic. In my case (for this purpose) it just needs to be installed on your server and doesn't need any further config. See: https://restic.net/#installation
3. Install autorestic
With Autorestic it is easier to (automaticly) create and restore backups. Use this to install: https://autorestic.vercel.app/installation
4. Config autorestic
In my case I create a .autorestic.yaml (see my example below) file as the root user (on /root/.autorestic.yml
) because I backup the complete SQL folder (including database) and to do that I first stop MariaDB and after that I start it back up. I also run the commands as root. You might also create a user with the neede right to do so if you don't want to use root.
my .autorestic.yaml
file.
version: 2
global:
forget:
keep-within: '14d'
locations:
itflow_files:
from: /var/www
to: remote
apache2:
from: /etc/apache2
to: remote
php:
from: /etc/php
to: remote
mariadb:
from: /var/lib/mysql
to: remote
hooks:
before:
- systemctl stop mariadb
after:
- systemctl start mariadb
failure:
- systemctl start mariadb
backends:
remote:
type: rclone
path: backups:onedrive
key: <your secret password>
5. Use autorestic
To check (or initialize) you can use: autorestic --verbose check
(from the location where the .autorestic.yaml
is)
To manually create a backup (snapshot) you can use: autorestic --verbose backup -a
In my Cron (crontab -e
as root user) I have this:
0 6 * * * autorestic -c /root/.autorestic.yml backup -a
0 18 * * * autorestic -c /root/.autorestic.yml backup -a
This automaticly starts the job at 6.00 an 18.00.
To restore you can do something like: autorestic -c .autorestic.yml exec -av -- restore <snapshot_id> --target /tmp/
where <snapshot_id> can be found when listing youre snapshots using: autorestic exec -av -- snapshots
I hope this will give you a kickstart. If you have any questions please ask, i'll try my best to answer,