Deployment with Juju

Juju is the game-changing service modelling tool that lets you build entire cloud environments with only a few commands. For detailed information about Juju please follow https://jujucharms.com/docs/stable/getting-started

DeviceHive service can be deployed with Juju in two ways - using bundle (all-in-one installation) or charm-by-charm.

All-in-one installation

Step 1 - Install Juju Quickstart

sudo add-apt-repository ppa:juju/stable 
sudo apt-get update 
sudo apt-get install juju-quickstart

Step 2 - Deploy DeviceHive bundle

juju-quickstart u/x3v947pl/devicehive-bundle/2

Charm-by-charm Deployment

To deploy DeviceHive charm-by-charm run the following commands:

juju add-machine --constraints mem=7G
created machine 4
juju add-machine --constraints mem=3G
created machine 5

let's remember the ids of machines created and install charms that make up DeviceHive

juju deploy cs:~x3v947pl/trusty/postgresql-dh --to 4
juju deploy cs:~x3v947pl/trusty/zookeeper-dh --to 4
juju deploy cs:~x3v947pl/trusty/kafka-dh --to 4
juju deploy cs:~x3v947pl/trusty/redis-dh --to 4
juju deploy cs:~x3v947pl/trusty/devicehive --to 4

juju add-relation zookeeper-dh kafka-dh
juju add-relation devicehive kafka-dh
juju add-relation devicehive zookeeper-dh
juju add-relation devicehive redis-dh
juju add-relation devicehive postgresql-dh
juju expose devicehive

If you want to store device data, you need to deploy Cassandra and it's worker worker:

juju deploy cs:~x3v947pl/trusty/devicehive-worker --to 5
juju deploy cs:~x3v947pl/trusty/cassandra-dh --to 5
juju add-relation devicehive-worker zookeeper-dh
juju add-relation devicehive-worker cassandra-dh
juju expose devicehive-worker

Using command juju status get the public addresses of two created machines, eg:

devicehive: charm: cs:~x3v947pl/trusty/devicehive-9 can-upgrade-to: cs:~x3v947pl/trusty/devicehive-worker-2 exposed: true relations: ka: - kafka-dh pg: - postgresql-dh re: - redis-dh zk: - zookeeper-dh units: devicehive/0: agent-state: started agent-version: 1.20.14 machine: "4" open-ports: - 8080/tcp public-address: juju-azure-p0v49kbwr1.cloudapp.net