All Projects → johanneslamers → backup-suite

johanneslamers / backup-suite

Licence: MIT license
Backup database, static files and config to AWS S3 with Cronjob

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to backup-suite

terraform-aws-efs-backup
Terraform module designed to easily backup EFS filesystems to S3 using DataPipeline
Stars: ✭ 40 (+25%)
Mutual labels:  backup, s3, cronjob
M Wiz
Install Metasploit And Repair Metasploit In Termux With Easy Steps
Stars: ✭ 148 (+362.5%)
Mutual labels:  backup, bash-script
Wal G
Archival and Restoration for Postgres
Stars: ✭ 1,974 (+6068.75%)
Mutual labels:  backup, s3
awesome-storage
A curated list of storage open source tools. Backups, redundancy, sharing, distribution, encryption, etc.
Stars: ✭ 324 (+912.5%)
Mutual labels:  backup, s3
Backup
Easy full stack backup operations on UNIX-like systems.
Stars: ✭ 4,682 (+14531.25%)
Mutual labels:  backup, s3
Pgbackrest
Reliable PostgreSQL Backup & Restore
Stars: ✭ 766 (+2293.75%)
Mutual labels:  backup, s3
Git S3 Push
Deploy your git repo to an S3 bucket
Stars: ✭ 182 (+468.75%)
Mutual labels:  backup, s3
Burry.sh
Cloud Native Infrastructure BackUp & RecoveRY
Stars: ✭ 260 (+712.5%)
Mutual labels:  backup, s3
Duplicacy Autobackup
💾 Painless automated backups to multiple storage providers with Docker and duplicacy.
Stars: ✭ 214 (+568.75%)
Mutual labels:  backup, s3
Craft Do Forge Recipe
Digital Ocean / Forge Recipe for CraftCMS websites
Stars: ✭ 24 (-25%)
Mutual labels:  digitalocean, bash-script
S3 Beam
🚀 direct-to-S3 uploading using ClojureScript
Stars: ✭ 91 (+184.38%)
Mutual labels:  digitalocean, s3
Clickhouse Backup
Tool for easy ClickHouse backup and restore with cloud storages support
Stars: ✭ 359 (+1021.88%)
Mutual labels:  backup, s3
S3cmd
Official s3cmd repo -- Command line tool for managing Amazon S3 and CloudFront services
Stars: ✭ 3,767 (+11671.88%)
Mutual labels:  backup, s3
Safeharbor
local mirror of your Github stars (including ALL branches)
Stars: ✭ 16 (-50%)
Mutual labels:  backup, bash-script
Wal E
Continuous Archiving for Postgres
Stars: ✭ 3,313 (+10253.13%)
Mutual labels:  backup, s3
Docker S3 Volume
Docker container with a data volume from s3.
Stars: ✭ 166 (+418.75%)
Mutual labels:  backup, s3
mindav
A self-hosted file backup server which bridges WebDAV protocol with @minio written in @totoval. Webdav ❤️ Minio
Stars: ✭ 64 (+100%)
Mutual labels:  backup, s3
docker base images
Vlad's Base Images for Docker
Stars: ✭ 61 (+90.63%)
Mutual labels:  backup, s3
s3-mongo-backup
Mongodb backups to S3
Stars: ✭ 18 (-43.75%)
Mutual labels:  backup, s3
Walrus
🔥 Fast, Secure and Reliable System Backup, Set up in Minutes.
Stars: ✭ 197 (+515.63%)
Mutual labels:  backup, s3

Amazon S3 Backup Bot

Relax, it's backed up. Off site, on line, in case. 🤖

Features

  • All configuration is done in the .env file, rather than in the scripts themselves
  • Uploads the backups to Amason AWS S3
  • After upload deletes the tarred files from the local server
  • Dumps each backup folder into its own file
  • Checks, repairs, and optimizes each MySQL database
  • Compress files before upload
  • Detailed information and comments
  • S3 storage class options to cut costs
  • Clear folder structure in S3

Summary

You’ve setup your server (for example with Serverpilot or Laravel Forge on Digital Ocean), but have you thought about backups? This script backups important data, such as database and file dumps, uploads it securely to S3, than deletes the local backups for security reasons. Amazon S3 can be an interestingly safe and cheap way to store your important data.

Folder structure in S3

Backups are stored in the following directory structure separated by client and week number (10) and type

Files: S3://yourbucket/client/10/files/backup_name_2017-03-01_10h18m_Wednesday-folder.tar.gz

Database: S3://yourbucket/client/10/db/backup_name_2017-03-01_10h18m_Wednesday-db.tar.gz

Getting started

1. Install AWS CLI

Logon your server with SSH We'll install the AWS CLI tool using Python PIP, a Python package manager.

# Install Pip
sudo apt-get install -y python-pip

# Install AWS CLI tool globally
sudo pip install awscli

# Check to ensure it exists
which aws

Tip: Do NOT configure AWS CLI with your root AWS credentials - yes it will work, but would you store your root server password in a plaintext file? No, and your AWS credentials give the holder access to unlimited resources, your billing details, your machine images, everything. Just create a new user/group that only has access to S3 and use those credentials to configure S3.

# Configure AWS - adding the KEY, SECRET KEY, default zone and default output format

aws configure
> YOUR KEY HERE
> YOUR SECRET KEY HERE
> eu-west-2
> json

2. Setup backup location and configuration

Now we create the backup folder and the environment file that holds our credentials.

mkdir ~/backup
cd ~/backup

All configuration is done in the .env file, rather than in the scripts themselves. So don’t forget to add your credentials in the appropriate variables, as well as to modify the paths based on your server and AWS setup. Open .env with vim and paste the .env credentials.

vim .env

Now close vim with ESC followed by :wq

3. Setup backup scripts

Now we can create our backup shell scripts.

  • backup-db.sh: This will export the database, compress it, and upload it to our S3 bucket.
  • backup-files.sh: This will export the files, tarball's it, and upload it to our S3 bucket.
vim backup-db.sh
vim backup-files.sh

Paste your scripts and close vim with ESC followed by :wq

4. Test your scripts

Make the scripts executable with chmod

chmod +x backup-db.sh
chmod +x backup-files.sh

And test the scripts

bash backup-db.sh
bash backup-files.sh

5. Add cronjob

Add these commands to the scheduled job.

Backup database
/usr/bin/env bash /home/forge/backup/backup-db.sh &>> /home/forge/backup/backup-db.log
Backup files
/usr/bin/env bash /home/forge/backup/backup-files.sh &>> /home/forge/backup/backup-files.log

Cleanup S3 Backups

Within S3 locate your bucket properties and find the “Lifecycle” option. Then just create a rule and you can delete old backups any number of days after they were created. I created a rule called “Delete Old Backups” that runs on the whole bucket and permanently deletes items created 30 days ago.

Alternative DB backup with automysqlbackup

Backup your datasbase with automysqlbackup. Installation is pretty simple: sudo apt-get install automysqlbackup You’re done! Backups will be made daily. All your databases will be stored in /var/lib/automysqlbackup. If you like to make manual backup just run sudo automysqlbackup.

For more information on installing automysqlbackup go to: Install automysqlbackup on Ubuntu

Sources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].