4
These instructions will help you deploy your first charm with Juju to
7
A few assumptions are made:
9
- You have a MAAS cluster set-up, and you have at least 2 nodes
12
- You're running MAAS on your local machine. If not you'll need to
13
adjust some of the URLs mentioned accordingly.
15
- You're running Juju from the PPA (``ppa:juju/pkgs``) or from a
16
branch of ``lp:juju``. At the time of writing MAAS support had not
17
made it into the main Ubuntu archives. However, following the
18
release of Ubuntu Precise, all the necessary package revisions will
21
If you're using a branch, note that you'll need to set
22
``PYTHONPATH`` carefully to ensure you use the code in the branch.
25
Your API key and environments.yaml
26
----------------------------------
28
You'll need an API key from MAAS so that the Juju client can access
29
it. Each user account in MAAS can have as many API keys as desired.
30
One hard and fast rule is that you'll need to use a different API key
31
for each Juju *environment* you set up within a single MAAS cluster.
39
#. Go to your `MAAS preferences page`_, or go to your `MAAS home
40
page`_ and choose *Preferences* from the drop-down menu that
41
appears when clicking your username at the top-right of the page.
42
#. Optionally add a new MAAS key. Do this if you're setting up another
43
environment within the same MAAS cluster.
44
.. _MAAS preferences page: http://localhost:5240/account/prefs/
45
.. _MAAS home page: http://localhost:5240/
48
Creating environments.yaml
49
^^^^^^^^^^^^^^^^^^^^^^^^^^
51
Create or modify ``~/.juju/environments.yaml`` with the following content::
57
maas-server: 'http://localhost:5240'
58
maas-oauth: '${maas-api-key}'
59
admin-secret: 'nothing'
61
Substitute the API key from earlier into the ``${maas-api-key}``
62
slot. You may need to modify the ``maas-server`` setting too; if
63
you're running from the maas package it should be something like
64
``http://hostname.example.com/MAAS``.
74
**Note**: if Juju complains that there are multiple environments and
75
no explicit default, add ``-e ${environment-name}`` after each
80
As you've not bootstrapped you ought to see::
82
$ juju environment not found: is the environment bootstrapped?
88
This will return quickly, but the master node may take a *long* time
89
to come up. It has to completely install Ubuntu and Zookeeper and
90
reboot before it'll be available for use. It's probably worth either
91
trying a ``juju status`` once in a while to check on progress, or
92
following the install on the node directly.
94
**Beware** of `bug 413415`_ - *console-setup hangs under chroot
95
debootstrap with a console login on ttyX* - when monitoring an
96
installation on the node.
99
https://bugs.launchpad.net/ubuntu/+source/console-setup/+bug/413415
101
If you're using ``vdenv`` (included in ``lp:maas``) then ``virsh``
102
makes it easy to follow on progress::
106
----------------------------------
108
2 odev-node02 running
110
$ gnome-terminal -e 'virsh console odev-node02' &
114
``zimmer`` is the machine on which MAAS is running. Here
115
``odev-node02`` is the machine being bootstrapped as the Juju master
118
Once the master node has been installed a status command should come
119
up with something a bit more interesting:
122
<https://bugs.launchpad.net/maas/+bug/965101>`_ - *MAAS provider
123
does not raise an exception when get_machines(...) does not find
124
the requested machines* - prevented capturing of output here.
126
Now it's possible to deploy a charm::
128
$ juju deploy --repository /usr/share/doc/juju/examples local:mysql
131
If you have another node free you can finish off the canonical and by
132
now familiar example::
134
$ juju deploy --repository /usr/share/doc/juju/examples local:wordpress
135
$ juju add-relation wordpress mysql
136
$ juju expose wordpress
139
Note that each charm runs on its own host, so each deployment will
140
actually take as long as it took to bootstrap. Have a beer, drown your
141
sorrows in liquor, or, my preference, have another cup of tea.