Browse Source

Initial commit

master
Inex Code 3 years ago
commit
dc1ce6ddb4
  1. 14
      LICENSE
  2. 5
      Mastodon database/backup.sh
  3. 5
      Mastodon database/mastodon-database-backup.conf
  4. 9
      Mastodon database/mastodon-database-backup.service
  5. 7
      Mastodon database/mastodon-database-backup.timer
  6. 8
      Mastodon database/mastodon-database-prune.service
  7. 7
      Mastodon database/mastodon-database-prune.timer
  8. 1
      Pixelfed/backup.sh
  9. 5
      Pixelfed/pixelfed-backup.conf
  10. 9
      Pixelfed/pixelfed-backup.service
  11. 7
      Pixelfed/pixelfed-backup.timer
  12. 8
      Pixelfed/pixelfed-prune.service
  13. 7
      Pixelfed/pixelfed-prune.timer
  14. 1
      README.md

14
LICENSE

@ -0,0 +1,14 @@ @@ -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

@ -0,0 +1,5 @@ @@ -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

@ -0,0 +1,5 @@ @@ -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

@ -0,0 +1,9 @@ @@ -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

@ -0,0 +1,7 @@ @@ -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

@ -0,0 +1,8 @@ @@ -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

@ -0,0 +1,7 @@ @@ -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

@ -0,0 +1 @@ @@ -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

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

9
Pixelfed/pixelfed-backup.service

@ -0,0 +1,9 @@ @@ -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

@ -0,0 +1,7 @@ @@ -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

@ -0,0 +1,8 @@ @@ -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

@ -0,0 +1,7 @@ @@ -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

@ -0,0 +1 @@ @@ -0,0 +1 @@
# Backup services of my servers
Loading…
Cancel
Save