Initial commit

This commit is contained in:
Inex Code 2020-01-17 17:39:13 +03:00
commit dc1ce6ddb4
14 changed files with 93 additions and 0 deletions

14
LICENSE Normal file
View File

@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -0,0 +1,5 @@
RETENTION_DAYS=7
RETENTION_WEEKS=4
RETENTION_MONTHS=6
RETENTION_YEARS=3
RESTIC_PASSWORD=

View File

@ -0,0 +1,5 @@
RETENTION_DAYS=7
RETENTION_WEEKS=4
RETENTION_MONTHS=6
RETENTION_YEARS=3
RESTIC_PASSWORD=

View File

@ -0,0 +1,9 @@
[Unit]
Description=Mastodon database backup service
[Service]
User=mastodon
Group=restic
Type=oneshot
ExecStart=/bin/bash /home/mastodon/backup.sh
ExecStartPost=/usr/bin/restic forget -r /backups/mastodon/database --tag systemd.timer --group-by "paths,tags" --keep-daily $RETENTION_DAYS --keep-weekly $RETENTION_WEEKS --keep-monthly $RETENTION_MONTHS --keep-yearly $RETENTION_YEARS
EnvironmentFile=/home/mastodon/.config/mastodon-database-backup.conf

View File

@ -0,0 +1,7 @@
[Unit]
Description=Backup mastodon database with restic daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,8 @@
[Unit]
Description=Mastodon database backup service (data pruning)
[Service]
User=mastodon
Group=restic
Type=oneshot
ExecStart=/usr/bin/restic -r /backups/mastodon/database prune
EnvironmentFile=/home/mastodon/.config/mastodon-database-backup.conf

View File

@ -0,0 +1,7 @@
[Unit]
Description=Prune data from the restic repository monthly (Mastodon db)
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=multi-user.target

1
Pixelfed/backup.sh Normal file
View File

@ -0,0 +1 @@
pg_dump -Fc pixelfed -f /home/pixelfed/database.bak && restic backup -r /backups/pixelfed/database --tag systemd.timer.database /home/pixelfed/database.bak && rm /home/pixelfed/database.bak && restic backup -r /backups/pixelfed/database --tag systemd.timer.media /home/pixelfed/pixelfed/storage/app/public

View File

@ -0,0 +1,5 @@
RETENTION_DAYS=7
RETENTION_WEEKS=4
RETENTION_MONTHS=6
RETENTION_YEARS=3
RESTIC_PASSWORD=

View File

@ -0,0 +1,9 @@
[Unit]
Description=Pixelfed data backup service
[Service]
User=pixelfed
Group=restic
Type=oneshot
ExecStart=/bin/bash /home/pixelfed/backup.sh
ExecStartPost=/usr/bin/restic forget -r /backups/pixelfed/database --group-by "paths,tags" --keep-daily $RETENTION_DAYS --keep-weekly $RETENTION_WEEKS --keep-monthly $RETENTION_MONTHS --keep-yearly $RETENTION_YEARS
EnvironmentFile=/home/pixelfed/.config/pixelfed-backup.conf

View File

@ -0,0 +1,7 @@
[Unit]
Description=Backup pixelfed with restic daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,8 @@
[Unit]
Description=Pixelfed data backup service (data pruning)
[Service]
User=pixelfed
Group=restic
Type=oneshot
ExecStart=/usr/bin/restic -r /backups/pixelfed/database prune
EnvironmentFile=/home/pixelfed/.config/pixelfed-backup.conf

View File

@ -0,0 +1,7 @@
[Unit]
Description=Prune data from the restic repository monthly (pixelfed)
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=multi-user.target

1
README.md Normal file
View File

@ -0,0 +1 @@
# Backup services of my servers