Skip to main content

Python package for backing up and managing digitalocean droplets.

Project description

# Dio

### Python package for backing up and managing digitalocean droplets.

#### version 0.2.1

### How to install

You can install dio using **pip**

pip install -U dio

or via sources:

python setup.py install


### Features
* **DROPLET BACKUP!!! (rsync and snapshot a droplet)**
* **Uses digitalocean v2.0 API**
* Running API call count
* Running API remaining call count
* All objects have a details function to return properties and values
* Get user's Droplets
* Get user's Images (Snapshot and Backups)
* Get public Images
* Create and Remove a Droplet
* Resize a Droplet
* Shutdown, restart and boot a Droplet
* Power off, power on and "power cycle" a Droplet
* Perform Snapshot
* Enable/Disable automatic Backups
* Restore root password of a Droplet


### Example cronjob:

```sh
# DigitalOcean backup script
30 * * * * /usr/bin/python /Users/username/bin/backup.py
```

### Example usage:

```python

import dio

""" Your digitalocean API v2.0 token """
token = "YOUR_TOKEN"

""" Ignore list of droplets to bypass in operations """
ignore = ["production.example.com"]

""" Droplet backup options. Only needed when doing backup """
options = {
"dev.example.com": {
"ssh_user" : "root",
"ssh_key" : "ssh_key",
"backup_dir" : "/Users/username/Droplets",
"remote_dir" : "/root",
"use_ip" : True,
"snapshot_hour" : 3,
"snapshots_keep" : 2,
"snapshot_delete" : True,
},
"production.example.com": {
"ssh_user" : "root",
"ssh_key" : "ssh_key",
"backup_dir" : "/Users/username/Droplets",
"remote_dir" : "/var/www",
"use_ip" : True,
"snapshot_hour" : 3,
"snapshots_keep" : 7,
"snapshot_delete" : True,
}
}

""" Manager init will automaticly get the droplets """
manager = dio.Manager( token, ignore )

""" backup your droplet with rsync """
for droplet in manager.droplets:
dio.Backup( options, droplet )

""" See how many api calls you used """
print dio.api.calls

""" See how many remaining api calls you have left for the hour """
print dio.api.remaining

```

Designed to be compatible with [python-digitalocean](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

dio-0.2.1.tar.gz (8.7 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