diff --git a/README.md b/README.md index 564c146..9c0c1ec 100644 --- a/README.md +++ b/README.md @@ -74,13 +74,20 @@ PGSQL_DAYS_TO_KEEP=14 ### Offsite Backups -Presently supports backing up to a remote SFTP location. +Presently supports backing up to a remote SFTP location or to Joyent's Manta +Object Store. By default it assumes that you are using a SFTP location which +enables you to use rsync to upload the files. If you use Joyent's Manta +Object Store, the assumptions are that you are placing the backups under your +/$USERNAME/stor/backups/ directory which is configurable and that you will be +storing two copies of the object in Joyent's Manta. To upload to manta it +requires that you have the manta and manta-sync node.js packages installed. ``` # # Backup Host # BACKUP_OFFSITE_ENABLED=yes +BACKUP_OFFSITE_TYPE=ssh BACKUP_HOST=sftp.example.com BACKUP_USER=username BACKUP_REMOTE_DIR=/path/to/backups/ @@ -127,6 +134,26 @@ RSYNC_OPTS=--delete-after + +#### Joyent Manta Object Store + +When using the Joyent Manta Object Store, it assumes that you have the following +options in your configuration file: + +``` +MANTA_KEY_ID=your-ssh-key-id +MANTA_URL=https://us-east.manta.joyent.com +MANTA_USER=username +``` + +You can obtain your SSH key's fingerprint you use for Manta by running: + +``` +ssh-keygen -l -f ~/.ssh/id_rsa-manta.pub +``` + +And change the id_rsa-manta.pub with your public key's filename. + ### Generate a SSH public/private key-pair Generate a public/private key-pair without a passphrase so that backups can be diff --git a/backup-mysql-databases b/backup-mysql-databases index d96beb7..ae4c197 100755 --- a/backup-mysql-databases +++ b/backup-mysql-databases @@ -73,5 +73,22 @@ cd ${BACKUP_BASE_DIR}/mysql # Upload the backup files to a remote server # if [[ $BACKUP_OFFSITE_ENABLED == "yes" ]]; then - /opt/local/bin/rsync -avz ${RSYNC_OPTS} ${BACKUP_BASE_DIR}/mysql ${BACKUP_USER}@${BACKUP_HOST}:${BACKUP_REMOTE_DIR} + case "$BACKUP_OFFSITE_TYPE" in + # + # Remote server is a sftp/ssh/rsync share + # + ssh|sftp|rsync) + /opt/local/bin/rsync -avz ${RSYNC_OPTS} ${BACKUP_BASE_DIR}/mysql ${BACKUP_USER}@${BACKUP_HOST}:${BACKUP_REMOTE_DIR} + ;; + # + # Joyent's Manta Object Store + # + manta) + manta-sync ${BACKUP_BASE_DIR}/mysql ~~/stor/backups/ + ;; + *) + echo "Unknown backup type '${BACKUP_OFFSITE_TYPE}'" + exit 1 + ;; + esac fi