Skip to main content

Python module to manage Digitalocean droplet backups.

Project description

## Synopsis:

This module works with [python-digitalocean](https://github.com/koalalorenzo/python-digitalocean) to allow you to rsync and snapshot your droplets with ease. **Great for hourly cron jobs!**

###### Works with posix (*nix, osx, cygwin)
Tested with Python 2.7.8(CYGWIN), 2.7.9(OS X/Linux), 3.4.3(OS X/Linux)


## How to install:

via pip

pip install -U python-digitalocean-backup

via source

python setup.py install


##### PyPI package
[https://pypi.python.org/pypi/python-digitalocean-backup](https://pypi.python.org/pypi/python-digitalocean-backup)

##### Example backup script (backup.py):

```python
import digitalocean
from digitaloceanbackup import Backup

"""Uncomment to disable logging for InsecurePlatformWarning"""
"""
import sys
if sys.version_info[:3] < (2, 7, 9):
import logging
logging.captureWarnings(True)
"""

token = 'YOUR_TOKEN'
rsync_excludes = ['cache', '.DS_Store', 'man3']
remote_dirs = ['/home', '/var/log', '/var/www']

manager = digitalocean.Manager(token=token)
for droplet in manager.get_all_droplets():
Backup(
debug=False, # print debug info so you can see shell commands
droplet=droplet, # pass in a droplet obj
ssh_user='droplet_ssh_user', # ssh user
ssh_key='droplet_ssh_key', # ssh key file name or full path
remote_dirs=remote_dirs, # remote directories to rsync
rsync_excludes=rsync_excludes, # rsync excludes
snapshot_hour=3, # hour of day to take snapshot
keep_snapshots=7 # keep this many snapshots
)
```

##### Example hourly cron job:
```sh
0 * * * * /usr/bin/python /Users/username/bin/backup.py
```

###### Requires:
[python-digitalocean>=1.5](https://github.com/koalalorenzo/python-digitalocean)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-digitalocean-backup-1.0.5.tar.gz (6.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page