Skip to content

rocketeers-app/backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 

Repository files navigation

Backup

Automated daily backup script for databases and sites to S3.

What it does

  • Dumps all MySQL databases (excluding system databases) and uploads them gzipped to S3 (if MySQL is installed)
  • Dumps all PostgreSQL databases (excluding postgres) and uploads them gzipped to S3 (if PostgreSQL is installed)
  • Archives site files (/var/www/*/) including .env, certs, conf, and persistent directories and uploads them gzipped to S3
  • Backups rotate on a 31-day cycle based on day of month
  • Uploads are rate-limited to 1 MB/s via pv

S3 structure

s3://rocketeers/backups/{server}/{name}/databases/{day}.sql.gz
s3://rocketeers/backups/{server}/{name}/files/{day}.tar.gz

Requirements

  • mysql / mysqldump (optional)
  • psql / pg_dump (optional)
  • s3cmd (at /usr/local/bin/s3cmd)
  • pv
  • gzip

Configuration

The following placeholders in backup.sh must be replaced before deployment:

Placeholder Description
%MYSQL_USER% MySQL username
%MYSQL_PASSWORD% MySQL password
%SERVER% Server identifier for S3
%POSTGRES_USER% PostgreSQL username

Usage

# typically run via cron, e.g. daily at 3:00 AM
0 3 * * * /path/to/backup.sh >> /var/log/backup.log 2>&1

TODO

  • Discord notifications on success/failure
  • Slack notifications on success/failure
  • Telegram notifications on success/failure

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages