Deploying a Juju Cluster on Brightbox Cloud
by Canonical on 24 August 2015
Juju is described as a state-of-the-art, open source, universal model for service oriented architecture and service oriented deployments.
It takes the configuration scripts written in other tools and wraps them into a charm which can be deployed either with the Juju CLI tool or its GUI interface.
And it’s really easy to run up a cluster to play with on Brightbox Cloud.
Install
In the Brightbox Platforms repository on GitHub there is a juju directory that will build a Juju cluster automatically.
So once you have the Brightbox CLI installed and SSH working, then clone the repository.
git clone https://github.com/brightbox/brightbox-platforms.git
Change into the Juju directory
cd juju
and run the cluster build script
./build-cluster
This will build a Juju management station running the GUI and a single 4gb SSD server to be managed by by it.
Building Juju cluster from trusty base image img-548oh
Juju Cluster #1 security group id is grp-ytzon
Building Juju Cluster #1 Management Jumpstation
Creating a 512mb.ssd (typ-1j3zh) server with image ubuntu-trusty-14.04-amd64-server (img-548oh) in groups grp-ytzon with 0.82k of user data
id status type zone creat... image_id cloud... name
-------------------------------------------------------------------------------
srv-z0iwb creating 512mb.ssd gb1-a 2015-... img-5... Juju ...
-------------------------------------------------------------------------------
Waiting for server srv-z0iwb to complete build.......
Mapping cip-h9v3l to interface int-nxdiz on srv-z0iwb
id status public_ip destination reverse_dns name
-------------------------------------------------------------------------------
cip-h9v3l mapped 109.107.35.57 srv-z0iwb cip-109-107-35-57.gb1...
-------------------------------------------------------------------------------
id status public_ip destination reverse_dns name
-------------------------------------------------------------------------------
cip-h9v3l mapped 109.107.35.57 srv-z0iwb cip-109-107... Juju Cluste...
-------------------------------------------------------------------------------
Waiting for ssh logon for ubuntu@cip-h9v3l.gb1.brightbox.com.........
Bootstrapping Juju GUI
Bootstrapping environment "manual"
Starting new instance for initial state server
Installing Juju agent on bootstrap instance
Logging to /var/log/cloud-init-output.log on remote host
Running apt-get update
Installing package: curl
Installing package: cpu-checker
Installing package: bridge-utils
Installing package: rsyslog-gnutls
Installing package: cloud-utils
Installing package: cloud-image-utils
Fetching tools: curl -sSfw 'tools from %{url_effective} downloaded: HTTP %{http_code}; time %{time_total}s; size %{size_download} bytes; speed %{speed_download} bytes/s ' --retry 10 -o $bin/tools.tar.gz <[https://streams.canonical.com/juju/tools/releases/juju-1.22.6-trusty-amd64.tgz]>
Bootstrapping Juju machine agent
Starting Juju machine agent (jujud-machine-0)
Bootstrap complete
Added charm "cs:trusty/juju-gui-38" to the environment.
Building cluster service machines
Creating a 4gb.ssd (typ-sdipw) server with image ubuntu-trusty-14.04-amd64-server (img-548oh) in groups grp-ytzon with 0.00k of user data
id status type zone creat... image_id cloud... name
-------------------------------------------------------------------------------
srv-y3z8f creating 4gb.ssd gb1-a 2015-... img-548oh Juju C...
-------------------------------------------------------------------------------
Waiting for server srv-z0iwb to complete build
Waiting for server srv-y3z8f to complete build........
Adding machines to cluster...
srv-y3z8f
Waiting for ssh logon for ubuntu@cip-h9v3l.gb1.brightbox.com..
Logging to /var/log/cloud-init-output.log on remote host
Running apt-get update
Installing package: curl
Installing package: cpu-checker
Installing package: bridge-utils
Installing package: rsyslog-gnutls
Installing package: cloud-utils
Installing package: cloud-image-utils
Fetching tools: curl -sSfw 'tools from %{url_effective} downloaded: HTTP %{http_code}; time %{time_total}s; size %{size_download} bytes; speed %{speed_download} bytes/s ' --noproxy "*" --insecure -o $bin/tools.tar.gz <[https://srv-z0iwb.gb1.brightbox.com:17070/tools/1.22.6-trusty-amd64]>
Starting Juju machine agent (jujud-machine-1)
created machine 1
Juju bootstrapping complete.
Juju GUI will shortly be available at:
https://cip-h9v3l.gb1.brightbox.com/
The username is "admin" and the password, taken from
~/.juju/environments/manual.jenv on cip-h9v3l.gb1.brightbox.com is:
password: 52029095a7947f349f392fd34455ff70
Add additional service machines from the management server by creating
them with the Brightbox CLI or the management GUI and then add them into
the cluster by running:
juju add-machine srv-xxxxx
Point a browser at the url given and login with the username and password shown. You’re then ready to deploy a charm!
Deploy a charm
Once you have the GUI working, you can deploy ‘charms’ by dragging them from the search bar on the left to the main canvas.
Let’s run through a simple WordPress/MySQL combination to get the idea. First find the wordpress and mysql charms using the search tool on the left and drag them to the canvas.
Click on the wordpress icon to reveal the build relation menu
drag across to the wordpress icon to create a relationship.
Next click on the machines tab and for each ‘new unit’ on the left hand side select a machine and container that unit should be deployed to – in this case machine #1.
once you’ve placed all the units on machines, hit the Commit button
Go back to the canvas screen and wait for the icon indicators to go green to show they have installed and configured. You’re then ready to use WordPress.
About the author
Neil Wilson is a consultant at BrightBox and an expert in finance and information systems. He is an advocate for the free software community and loves to make things happen. You can read more from Neil on the BrightBox blog.