Compare commits
20 Commits
001011ed76
...
main
Author | SHA1 | Date | |
---|---|---|---|
0196223ee1 | |||
2aab34b8ce | |||
de7f45083a | |||
f3f05cd014 | |||
3373ae8f08 | |||
ff1e2e6e4a | |||
b9bbbe7d55 | |||
b839038784 | |||
9eab1fc5d3 | |||
aff169fd40 | |||
192fd21dc5 | |||
413c629806 | |||
efde7a805b | |||
fffd94dd27 | |||
0daef0373f | |||
dc8e5cf27d | |||
d1b6f21623 | |||
9c0586263f | |||
5b746d9893 | |||
98403c3ac1 |
@ -2,63 +2,104 @@ version: 2
|
||||
|
||||
global:
|
||||
forget:
|
||||
keep-last: 2
|
||||
keep-monthly: 1
|
||||
|
||||
backends:
|
||||
hdd:
|
||||
type: local
|
||||
path: /home/yunohost.backup/restic
|
||||
path: /mnt/hdd/autorestic.backup
|
||||
|
||||
oiseauroch:
|
||||
type: sftp
|
||||
path: backup_oiseauroch:/backup_sagouin/backups
|
||||
|
||||
glacier:
|
||||
type: rclone
|
||||
path: scaleway-glacier:/autorestic-sagou.in
|
||||
|
||||
locations:
|
||||
databases:
|
||||
from: /var/backups/working/db-dumps
|
||||
from: /mnt/ssd/backup-working/db-dumps
|
||||
to:
|
||||
- hdd
|
||||
- oiseauroch
|
||||
cron: '0 3 * * 4' # At 3:00am on Thursday
|
||||
hooks:
|
||||
before:
|
||||
- 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
|
||||
- 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
|
||||
|
||||
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: /var/backups/working/gitea
|
||||
from: /mnt/ssd/backup-working/gitea
|
||||
to:
|
||||
- hdd
|
||||
- oiseauroch
|
||||
- glacier
|
||||
cron: '0 3 * * 4' # At 3:00am on Thursday
|
||||
hooks:
|
||||
before:
|
||||
- sudo -u gitea /opt/gitea/gitea dump -f /var/backups/working/gitea/gitea.zip
|
||||
- sudo -u gitea /var/www/gitea/gitea dump -f - > /mnt/ssd/backup-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:
|
||||
@ -66,15 +107,15 @@ locations:
|
||||
#after:
|
||||
#- sudo -u www-data php occ maintenance:mode --off
|
||||
|
||||
dokuwiki:
|
||||
bookstack:
|
||||
from:
|
||||
- /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
|
||||
- /var/www/bookstack/.env
|
||||
- /var/www/bookstack/public/uploads
|
||||
- /var/www/bookstack/storage/uploads
|
||||
to:
|
||||
- hdd
|
||||
- oiseauroch
|
||||
- glacier
|
||||
cron: '0 3 * * 4' # At 3:00am on Thursday
|
||||
|
||||
mail:
|
||||
@ -82,11 +123,20 @@ 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
|
||||
cron: '0 3 1 * *' # At 3:00am on the 1st
|
||||
- oiseauroch
|
||||
- glacier
|
||||
cron: '0 3 * * 4' # At 3:00am on Thursday
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
.autorestic.env
|
||||
.autorestic.lock.yml
|
BIN
.runforget.swp
BIN
.runforget.swp
Binary file not shown.
13
README.md
13
README.md
@ -1,4 +1,15 @@
|
||||
# Backup
|
||||
|
||||
Configuration (autorestic, cron) for the backup of [sagou.in](sagou.in).
|
||||
Refer to the [dedicated wiki page](https://wiki.rockpro.ynh.fr/tech:backup#autorestic).
|
||||
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).
|
||||
|
10
runcron
10
runcron
@ -1,13 +1,13 @@
|
||||
#! /usr/bin/env bash
|
||||
autorestic -c /etc/autorestic/.autorestic.yml --ci cron --lean 1> /tmp/autorestic.log 2>/tmp/autorestic-err.log
|
||||
autorestic -c /etc/autorestic/.autorestic.yml --ci cron 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
|
||||
printf "Command failed with return code $ret and log:\n$(cat /tmp/autorestic-err.log)" | mail -s "Autorestic Backup: Failed" root
|
||||
cat <(echo "Command failed with return code $ret and log:") /tmp/autorestic-err.log <(echo "===============") /tmp/autorestic.log | mail -s "Autorestic Backup: Failed" root
|
||||
else
|
||||
if [ -s /tmp/autorestic.log ]
|
||||
if [[ $(wc -l < /tmp/autorestic.log) -gt 15 ]]
|
||||
then
|
||||
printf "Command successfully finished with the following log:\n$(cat /tmp/autorestic.log)" | mail -s "Autorestic Backup: Success" root
|
||||
cat <(echo -e "Command successfully finished with the following log:") /tmp/autorestic-err.log <(echo "===============") /tmp/autorestic.log | mail -s "Autorestic Backup: Success" root
|
||||
fi
|
||||
fi
|
||||
|
@ -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
|
||||
printf "Command failed with return code $ret and log:\n$(cat /tmp/autorestic-prune-err.log)" | mail -s "Autorestic Pruning: Failed" root
|
||||
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
|
||||
else
|
||||
printf "Command successfully finished with the following log:\n$(cat /tmp/autorestic-prune.log)" | mail -s "Autorestic Pruning: Success" root
|
||||
fi
|
||||
cat <(echo "Command successfully finished with the following log:") /tmp/autorestic-prune.log | mail -s "Autorestic Pruning: Success" root
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user