Skip to main content

Digital Ocean integration with juju

Project description

This package provides a cli plugin for juju that allows for cli based provisioning of machines on digital ocean. I like to call it JuDo :-)

Digital ocean is linux vps provider utilizing kvm and ssd across multiple data centers at a very competitive price with hourly billing.

Juju provides for workloads management and orchestration using a collection of workloads definitions (charms) that can be assembled lego fashion at runtime into complex application topologies.

You can find out more about juju at its home page.


This plugin requires a development version of juju (>= 1.17.2)

A usable dev version of juju is available via the dev ppa:

$ sudo add-apt-repository ppa:juju/devel
$ apt-get update && apt-get install juju
$ juju version

Plugin installation is done via pip/easy_install which is the python language package managers, its available by default on ubuntu. Also recommended is virtualenv to sandbox this install from your system packages:

$ pip install -U juju-docean

Fwiw, currently the transitive dependency tree is PyYAML, requests, dop.


There are three steps for configuration and setup of this provider. Configuring your digital ocean api keys, adding an environment to juju’s config file, and setting up an ssh key for usage on digital ocean machines.


A digital ocean account is a pre-requisite, If you don’t have a digital ocean account you can sign up here.

Credentials for the digital ocean api can be obtained from your account dashboard at

The credentials can be provided to the plugin via.

  • Environment variables DO_CLIENT_ID and DO_API_KEY

This digital ocean plugin uses the manual provisioning capabilities of juju core. As a result its required to allocate machines in the environment before deploying workloads. We’ll explore that more in a moment.


An ssh key is required for use by this plugin and the public key must be uploaded to the digital ocean control panel. By default all keys in the digital ocean account will be tried, so no user configuration is needed. A specific key to utilize can be specified with the environment variable DO_SSH_KEY=”key_name” where key_name is the name of the key in the digital ocean management console.

Juju Config

Next let’s configure a juju environment for digital ocean, add an a null provider environment to ‘environments.yaml’, for example:

     type: manual
     bootstrap-host: null
     bootstrap-user: root


We need to tell juju which environment we want to use, there are several ways to do this, either of the following will do the trick:

$ juju switch digitalocean
$ export JUJU_ENV=digitalocean

Now we can bootstrap our digital ocean environment:

$ juju docean bootstrap --constraints="mem=2g, region=nyc1"

Which will create a droplet with 2Gb of ram in the nyc1 data center.

All machines created by this plugin will have the juju environment name as a prefix for their droplet name if your looking at the DO control panel.

After our environment is bootstrapped we can add additional machines to it via the the add-machine command, for example the following will add 3 machines with 2Gb each:

$ juju docean add-machine -n 2 --constraints="mem=2G, region=nyc2"
$ juju status

environment: docean
    agent-state: started
    instance-id: 'manual:'
    series: precise
    hardware: arch=amd64 cpu-cores=1 mem=2002M
    agent-state: started
    instance-id: manual:
    series: precise
    hardware: arch=amd64 cpu-cores=1 mem=2002M
    agent-state: started
    instance-id: manual:
    series: precise
    hardware: arch=amd64 cpu-cores=1 mem=2002M
services: {}

We can now use standard juju commands for deploying service workloads aka charms:

$ juju deploy wordpress

Without specifying the machine to place the workload on, the machine will automatically go to an unused machine within the environment.

There are hundreds of available charms ready to be used, you can find out more about what’s out there from Or alternatively the ‘plain’ html version at

We can use manual placement to deploy target particular machines:

$ juju deploy mysql --to=2

And of course the real magic of juju comes in its ability to assemble these workloads together via relations like lego blocks:

$ juju add-relation wordpress mysql

We can terminate allocated machines by their machine id. By default with the docean plugin, machines are forcibly terminated which will also terminate any service units on those machines:

$ juju docean terminate-machine 1 2

And we can destroy the entire environment via:

$ juju docean destroy-environment

All commands have builtin help facilities and accept a -v option which will print verbose output while running.

You can find out more about using from


Constraints are selection criteria used to determine what type of machine to allocate for an environment. Those criteria can be related to size of the machine, its location, or other provider specific criteria.

This plugin accepts the standard juju constraints

  • cpu-cores
  • memory
  • root-disk

Additionally it supports the following provider specific constraints.

  • ‘region’ to denote the digital ocean data center to utilize. All digitalocean data centers are supported and various short hand aliases are defined. ie. valid values include ams2, nyc1, nyc2, sfo1, sg1. The plugin defaults to nyc2.
  • ‘transfer’ to denote the terabytes of transfer included in the instance montly cost (integer size in gigabytes).

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
juju-docean-0.2.1.tar.gz (16.3 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page