Description | Notes | Author | ProjectPage |
---|---|---|---|
Backup your essential Mastodon files to an S3 bucket! |
This uses some simple scripts and cronjobs to create backups to a specified S3 bucket.
|
HasHooves |
Backup your essential Mastodon files to an S3 bucket!
This set of scripts was created to automate some of the basic maintenance that I would normally use to cleanup and make backups of my mastodon instance.
Feel free to use this backup script to help keep your instance clean too!
- Install the
AWS CLI
-
NOTE: This script requires that
aws configure
has already been completed for theroot
user before being ran for the first time
-
- Fill out the
example_config.sh
file with your information for AWS, and then move it toconfig/config.sh
- Set the two files as executable:
chmod +x backup.sh
chmod +x config/config.sh
- Add this line to your
root
crontab to ensure that the backups are being randaily
and a log is being generated:
0 3 * * * /opt/mastodon-backup/backup.sh > /opt/mastodon-backup/logs/backup.log 2>&1
- Add this line to the
root
crontab to ensure that aweekly
restart is occuring:
0 0 * * 0 /sbin/shutdown -r now
-
NOTE: This should be set for the
mastodon
account and not set as theroot
user - Add this line to the
mastodon
user's crontab to ensure that the media is being cleaned out daily and capped at7
days:
@daily cd /home/mastodon/live && RAILS_ENV=production bin/tootctl media remove --days=7
- After making changes to crontab, restart the cron service:
sudo service cron restart