Compare commits

...

20 Commits

Author SHA1 Message Date
0196223ee1 Update gitea command after gitea update 2025-01-16 08:17:17 +00:00
2aab34b8ce Add all homes and fix gitea command 2024-03-21 08:40:01 +00:00
de7f45083a Revert "Replace oiseauroch-sftp with garage S3 cluster with rhizome"
This reverts commit f3f05cd014f97c5aa41a98e15b9648e48430244a.
Because sagouin is no longer in the garage experiment, snif
2024-01-18 16:56:46 +00:00
f3f05cd014 Replace oiseauroch-sftp with garage S3 cluster with rhizome 2023-10-19 20:47:56 +00:00
3373ae8f08 removed share_multimedia and dokuwki 2023-04-07 18:48:31 +00:00
ff1e2e6e4a fix(runcron): typos 2023-03-23 22:02:20 +00:00
b9bbbe7d55 Improved cron/forget scripts 2023-03-17 00:01:01 +00:00
b839038784 Implemented bludit backup 2023-03-17 00:00:33 +00:00
9eab1fc5d3 Added sftp backend 2022-08-11 10:01:20 +00:00
aff169fd40 Updated doc to reflect that the repo is not cloned directly in /etc 2022-08-11 09:16:16 +00:00
192fd21dc5 Added bludit 2022-08-11 09:15:38 +00:00
413c629806
Extended forget to one month 2022-04-16 18:07:29 +00:00
efde7a805b
Split multimedia and shared multimedia
As shared multimedia contains heavier and less important data, it can be backuped less often
2022-04-16 17:47:37 +00:00
fffd94dd27
Exclude some nextcloud folders 2022-04-16 17:35:32 +00:00
0daef0373f Replaced printf with a simple cat in runcron & runforget 2022-01-04 08:48:23 +00:00
dc8e5cf27d Updated wiki link 2021-12-28 23:46:27 +00:00
d1b6f21623 Added S3 Glacier backend 2021-12-28 23:43:51 +00:00
9c0586263f Fixed cron job sending useless mails 2021-12-28 23:43:02 +00:00
5b746d9893 Adapted to new server architecture 2021-12-28 14:36:10 +00:00
98403c3ac1 Removed swap files 2021-12-28 13:42:24 +00:00
6 changed files with 87 additions and 28 deletions

View File

@ -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
View File

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

Binary file not shown.

View File

@ -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
View File

@ -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

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
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