Compare commits

..

No commits in common. "main" and "001011ed7615e7204636b91aeb66c9c4f84fe26e" have entirely different histories.

6 changed files with 28 additions and 87 deletions

View File

@ -2,104 +2,63 @@ version: 2
global:
forget:
keep-monthly: 1
keep-last: 2
backends:
hdd:
type: local
path: /mnt/hdd/autorestic.backup
oiseauroch:
type: sftp
path: backup_oiseauroch:/backup_sagouin/backups
glacier:
type: rclone
path: scaleway-glacier:/autorestic-sagou.in
path: /home/yunohost.backup/restic
locations:
databases:
from: /mnt/ssd/backup-working/db-dumps
from: /var/backups/working/db-dumps
to:
- hdd
- oiseauroch
cron: '0 3 * * 4' # At 3:00am on Thursday
hooks:
before:
- sudo -u postgres /usr/bin/pg_dumpall > /mnt/ssd/backup-working/db-dumps/postgres.dump
- /usr/bin/mysqldump --all-databases > /mnt/ssd/backup-working/db-dumps/mysql.dump
- sudo -u postgres /usr/bin/pg_dumpall > /var/backups/working/db-dumps/postgres.dump
- sudo /usr/bin/mysqldump --all-databases > /var/backups/working/db-dumps/mysql.dump
configs:
from:
- /etc
- /home/yunohost.conf
- /var/spool/cron/crontabs/
- /opt/yunohost/wireguard/db/
to:
- hdd
- oiseauroch
- glacier
cron: '0 3 * * 4' # At 3:00am on Thursday
options:
forget:
keep-weekly: 5
bludit:
from:
- /var/www/bludit/bl-content/pages/
to:
- hdd
- oiseauroch
- glacier
cron: '0 3 * * 4' # At 3:00am on Thursday
options:
forget:
keep-weekly: 5
gitea:
from: /mnt/ssd/backup-working/gitea
from: /var/backups/working/gitea
to:
- hdd
- oiseauroch
- glacier
cron: '0 3 * * 4' # At 3:00am on Thursday
hooks:
before:
- sudo -u gitea /var/www/gitea/gitea dump -f - > /mnt/ssd/backup-working/gitea/gitea.zip
- sudo -u gitea /opt/gitea/gitea dump -f /var/backups/working/gitea/gitea.zip
home:
from:
- /home/agathe
- /home/antoine
- /home/baptiste
- /home/con
- /home/josephine
- /home/mariage
- /home/marieclaire
- /home/oiseauroch
- /home/raphaeldutrieux
- /home/roxane
- /home/shrek
- /home/thomas
- /home/tobias
to:
- hdd
- oiseauroch
- glacier
cron: '0 3 * * 4' # At 3:00am on Thursday
nextcloud:
from:
- /home/yunohost.app/nextcloud
options:
backup:
exclude:
- '**/cache'
- '**/files_versions'
- '**/files_trashbin'
- '**/appdata_ocfigi57i0ri'
to:
- hdd
- oiseauroch
- glacier
cron: '0 3 * * 4' # At 3:00am on Thursday
#hooks:
#before:
@ -107,15 +66,15 @@ locations:
#after:
#- sudo -u www-data php occ maintenance:mode --off
bookstack:
dokuwiki:
from:
- /var/www/bookstack/.env
- /var/www/bookstack/public/uploads
- /var/www/bookstack/storage/uploads
- /var/www/dokuwiki/conf
- /var/www/dokuwiki/data/pages
- /var/www/dokuwiki/data/meta
- /var/www/dokuwiki/data/media
- /var/www/dokuwiki/data/media_meta
to:
- hdd
- oiseauroch
- glacier
cron: '0 3 * * 4' # At 3:00am on Thursday
mail:
@ -123,20 +82,11 @@ locations:
- /var/mail
to:
- hdd
- oiseauroch
- glacier
cron: '0 3 * * 4' # At 3:00am on Thursday
# All multimedia folders but the shared (separate location)
multimedia:
from:
- /home/yunohost.multimedia/
options:
backup:
exclude:
- '/home/yunohost.multimedia/share'
to:
- hdd
- oiseauroch
- glacier
cron: '0 3 * * 4' # At 3:00am on Thursday
cron: '0 3 1 * *' # At 3:00am on the 1st

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.autorestic.env
.autorestic.lock.yml

BIN
.runforget.swp Normal file

Binary file not shown.

View File

@ -1,15 +1,4 @@
# Backup
Configuration (autorestic, cron) for the backup of [sagou.in](sagou.in).
Refer to the [dedicated wiki page](https://wiki.sagou.in/tech:backup#autorestic).
## Installation
To install, clone the repo, create the `/etc/autorestic` folder and symbolically link
```bash
git clone https://git.sagou.in/sagou.in/Autorestic
cd Autorestic
mkdir /etc/autorestic
ln -s $(pwd)/autorestic/{.autorestic.yml,runcron,runforget} /etc/autorestic
```
Once initialized, move the repository keys into a `/etc/autorestic/.autorestic.env` file as described in [the doc](https://autorestic.vercel.app/backend/env).
Refer to the [dedicated wiki page](https://wiki.rockpro.ynh.fr/tech:backup#autorestic).

10
runcron
View File

@ -1,13 +1,13 @@
#! /usr/bin/env bash
autorestic -c /etc/autorestic/.autorestic.yml --ci cron 1> /tmp/autorestic.log 2>/tmp/autorestic-err.log
autorestic -c /etc/autorestic/.autorestic.yml --ci cron --lean 1> /tmp/autorestic.log 2>/tmp/autorestic-err.log
ret=$?
if [[ "$ret" != 0 || -s /tmp/autorestic-err.log ]]
if [ "$ret" != 0 ] || [ -s /tmp/autorestic-err.log ]
then
cat <(echo "Command failed with return code $ret and log:") /tmp/autorestic-err.log <(echo "===============") /tmp/autorestic.log | mail -s "Autorestic Backup: Failed" root
printf "Command failed with return code $ret and log:\n$(cat /tmp/autorestic-err.log)" | mail -s "Autorestic Backup: Failed" root
else
if [[ $(wc -l < /tmp/autorestic.log) -gt 15 ]]
if [ -s /tmp/autorestic.log ]
then
cat <(echo -e "Command successfully finished with the following log:") /tmp/autorestic-err.log <(echo "===============") /tmp/autorestic.log | mail -s "Autorestic Backup: Success" root
printf "Command successfully finished with the following log:\n$(cat /tmp/autorestic.log)" | mail -s "Autorestic Backup: Success" root
fi
fi

View File

@ -2,9 +2,9 @@
autorestic -c /etc/autorestic/.autorestic.yml --ci forget --all --prune 1> /tmp/autorestic-prune.log 2>/tmp/autorestic-prune-err.log
ret=$?
if [[ "$ret" != 0 || -s /tmp/autorestic-prune-err.log ]]
if [ "$ret" != 0 ] || [ -s /tmp/autorestic-prune-err.log ]
then
cat <(echo "Command failed with return code $ret and log:") /tmp/autorestic-prune-err.log <(echo "===============") /tmp/autorestic-prune.log | mail -s "Autorestic Pruning: Failed" root
printf "Command failed with return code $ret and log:\n$(cat /tmp/autorestic-prune-err.log)" | mail -s "Autorestic Pruning: Failed" root
else
cat <(echo "Command successfully finished with the following log:") /tmp/autorestic-prune.log | mail -s "Autorestic Pruning: Success" root
fi
printf "Command successfully finished with the following log:\n$(cat /tmp/autorestic-prune.log)" | mail -s "Autorestic Pruning: Success" root
fi