mirror of
https://github.com/inexcode/backup-facility
synced 2024-11-23 22:31:28 +00:00
Initial commit
This commit is contained in:
commit
dc1ce6ddb4
14
LICENSE
Normal file
14
LICENSE
Normal 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.
|
||||
|
5
Mastodon database/backup.sh
Normal file
5
Mastodon database/backup.sh
Normal file
|
@ -0,0 +1,5 @@
|
|||
RETENTION_DAYS=7
|
||||
RETENTION_WEEKS=4
|
||||
RETENTION_MONTHS=6
|
||||
RETENTION_YEARS=3
|
||||
RESTIC_PASSWORD=
|
5
Mastodon database/mastodon-database-backup.conf
Normal file
5
Mastodon database/mastodon-database-backup.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
RETENTION_DAYS=7
|
||||
RETENTION_WEEKS=4
|
||||
RETENTION_MONTHS=6
|
||||
RETENTION_YEARS=3
|
||||
RESTIC_PASSWORD=
|
9
Mastodon database/mastodon-database-backup.service
Normal file
9
Mastodon database/mastodon-database-backup.service
Normal 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
|
7
Mastodon database/mastodon-database-backup.timer
Normal file
7
Mastodon database/mastodon-database-backup.timer
Normal file
|
@ -0,0 +1,7 @@
|
|||
[Unit]
|
||||
Description=Backup mastodon database with restic daily
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
Persistent=true
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
8
Mastodon database/mastodon-database-prune.service
Normal file
8
Mastodon database/mastodon-database-prune.service
Normal 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
|
7
Mastodon database/mastodon-database-prune.timer
Normal file
7
Mastodon database/mastodon-database-prune.timer
Normal 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
1
Pixelfed/backup.sh
Normal 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
|
5
Pixelfed/pixelfed-backup.conf
Normal file
5
Pixelfed/pixelfed-backup.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
RETENTION_DAYS=7
|
||||
RETENTION_WEEKS=4
|
||||
RETENTION_MONTHS=6
|
||||
RETENTION_YEARS=3
|
||||
RESTIC_PASSWORD=
|
9
Pixelfed/pixelfed-backup.service
Normal file
9
Pixelfed/pixelfed-backup.service
Normal 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
|
7
Pixelfed/pixelfed-backup.timer
Normal file
7
Pixelfed/pixelfed-backup.timer
Normal file
|
@ -0,0 +1,7 @@
|
|||
[Unit]
|
||||
Description=Backup pixelfed with restic daily
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
Persistent=true
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
8
Pixelfed/pixelfed-prune.service
Normal file
8
Pixelfed/pixelfed-prune.service
Normal 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
|
7
Pixelfed/pixelfed-prune.timer
Normal file
7
Pixelfed/pixelfed-prune.timer
Normal 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
|
Loading…
Reference in a new issue