Skip to content

Latest commit

 

History

History
108 lines (74 loc) · 4.57 KB

README.rdoc

File metadata and controls

108 lines (74 loc) · 4.57 KB

Dreamhost Personal Backup Gem - No longer supported (not like it ever really was, I guess!)

Dreamhost has decided to discontinue the backup service that this gem relied upon. Instead they have said that we could instead use DreamObjects for backup storage.

This gem was really just a learning experience anyway. I’m going to take the opportunity to learn more about Go and S3/Swift (which DreamObjects uses for their API) and write something that will perform backup syncs like this gem attempted to do.

<img src=“https://travis-ci.org/ptrimble/dreamhost-personal-backup.png” /> <img src=“https://coveralls.io/repos/ptrimble/dreamhost-personal-backup/badge.png?branch=master” />

Provides functionality to perform personal backups (on Linux or OSX) to a Dreamhost personal backup server.

Dreamhost provides a ‘personal backup’ that allows you to back up your personal files to special Dreamhost backup servers. I use it as an offsite mirror of my personal files (documents, music, photos, etc).

This backup is a mirror of what is on your home machine. It does not have versioning. If you want to restore from backup then you simply copy what is on the Dreamhost server to your home machine.

Currently you must set up your own schedule to execute this gem.

This gem uses rsync to perform the backups.

Dreamhost Personal Backup Wiki: wiki.dreamhost.com/Personal_Backup

Usage

Install the usual way:

gem install dreamhost-personal-backup

You can then call it from the command line.

$ dreamhost_personal_backup

The gem accepts only one parameter (which is optional): a config file path.

$ dreamhost_personal_backup '/path/to/you/config/file'

Calling without a config file parameter will cause the gem to look for a config file at ‘~/.dreamhost_personal_backup/default_config.yml’. If this file does not exist then an error will be returned.

Dreamhost Setup

This gem currently assumes that you have activated your Dreamhost Backup User via the Dreamhost Panel and that you have set up SSH trust with your backup server.

Dreamhost Backup Servers use rssh, which is a restricted shell. As such setting up SSH via their instructions is the only way to truly automate backups. See their wiki (wiki.dreamhost.com/Personal_Backup) for step-by-step instructions on how to set up SSH trust between your host and the backup server.

Configuration

This gem can be called either by passing a configuration YAML filepath or by setting up a configuration file in a default location. The default location that this gem will reference for a configuration file is ‘~/.dreamhost_personal_backup/default_config.yml’. If this file does not exist and no config file is passed then an error will be returned.

The following parameters are available:

* user (required)
* host (required)
* targets (required)
* logfile (optional, default: STDOUT)
* logrotationsizeinbytes (optional, default: 105000000)
* logkeepcount (optional, default: 3)
* notifyemail (optional, default: nil)

Here is an example config file:

user: <username>
host: <host>

logfile: ~/logs/backup.log
logrotationsizeinbytes: 500000000
logkeepcount: 5

notifyemail: target_address@email.com

targets:
  music: /media/drive/Music
  documents: ~/Documents
  writing: ~/Writing
  scripts: ~/scripts
  gmail-archive: ~/gmail-archive
  patches: ~/Code/patches

cron

Tasks with this gem can be scheduled to execute at regular intervals. Example:

# Run the backup script every 3 hours every day
0 0,3,6,9,12,15,18,22 * * * dreamhost_personal_backup

rsync details

The following parameters are used with rsync:

* Archive (-a) - ensures that all symbolic links, devices, attributes, permissions, ownerships, etc are preserved
* Verbose (-v) - Shows verbose logging
* Compress (-z) - Compresses files during transfer
* Partial/ Progress (-P) - Keeps partially tranferred files and shows progress in the logs
* Deletes (--delete) - Deletes files on the Dreamhost side that do not exist on the sending side

In practice what this means is that it keeps a mirror of what is on the sending side. Deleting a file on the home host will remove it from the backup server.

Credits and code