From 59f95e0442b43f33db6308ed51b3911518563e46 Mon Sep 17 00:00:00 2001 From: Jacques Marneweck Date: Thu, 12 Jun 2014 12:45:00 +0200 Subject: [PATCH 1/5] Updating README --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 564c146..2e789b0 100644 --- a/README.md +++ b/README.md @@ -74,13 +74,19 @@ 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. ``` # # Backup Host # BACKUP_OFFSITE_ENABLED=yes +BACKUP_OFFSITE_TYPE=ssh BACKUP_HOST=sftp.example.com BACKUP_USER=username BACKUP_REMOTE_DIR=/path/to/backups/ From 332ec2c0b7cdb256b869b73a1eb98240fd4e94a7 Mon Sep 17 00:00:00 2001 From: Jacques Marneweck Date: Thu, 12 Jun 2014 13:20:03 +0200 Subject: [PATCH 2/5] Start making multiple backup types work. Manta bits not written as we may need to write a sync script to do the upload / cleanup parts --- backup-mysql-databases | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/backup-mysql-databases b/backup-mysql-databases index d96beb7..b6efb0d 100755 --- a/backup-mysql-databases +++ b/backup-mysql-databases @@ -73,5 +73,21 @@ 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) + ;; + *) + echo "Unknown backup type '${BACKUP_OFFSITE_TYPE}'" + exit 1 + ;; + esac fi From 77a05d0e467682f4ba65380029027d7d77d0e90f Mon Sep 17 00:00:00 2001 From: Jacques Marneweck Date: Thu, 12 Jun 2014 13:33:31 +0200 Subject: [PATCH 3/5] Use manta-sync to upload --- backup-mysql-databases | 1 + 1 file changed, 1 insertion(+) diff --git a/backup-mysql-databases b/backup-mysql-databases index b6efb0d..ae4c197 100755 --- a/backup-mysql-databases +++ b/backup-mysql-databases @@ -84,6 +84,7 @@ if [[ $BACKUP_OFFSITE_ENABLED == "yes" ]]; then # Joyent's Manta Object Store # manta) + manta-sync ${BACKUP_BASE_DIR}/mysql ~~/stor/backups/ ;; *) echo "Unknown backup type '${BACKUP_OFFSITE_TYPE}'" From 4fb4d042e0dec4514384efb072e3ebeb8b02b61d Mon Sep 17 00:00:00 2001 From: Jacques Marneweck Date: Thu, 12 Jun 2014 13:36:02 +0200 Subject: [PATCH 4/5] Updated README for Manta bits --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e789b0..c2a8ef8 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,8 @@ 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. +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. ``` # @@ -133,6 +134,18 @@ 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 +``` + ### Generate a SSH public/private key-pair Generate a public/private key-pair without a passphrase so that backups can be From 44c397e5fc03a8a9f628145d7106be48b72d8ed3 Mon Sep 17 00:00:00 2001 From: Jacques Marneweck Date: Thu, 12 Jun 2014 13:39:14 +0200 Subject: [PATCH 5/5] Explain how to obtain a ssh keys fingerprint --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c2a8ef8..9c0c1ec 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,14 @@ 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