Skip to content

Add the ability to backup over to Joyent's Manta Object Store #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -127,6 +134,26 @@ RSYNC_OPTS=--delete-after
</tr>
</table>


#### 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
Expand Down
19 changes: 18 additions & 1 deletion backup-mysql-databases
Original file line number Diff line number Diff line change
Expand Up @@ -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