User Tools

Site Tools


juju

This is an old revision of the document!


Working with Juju

Compiling juju-core

Set up your Go environment

echo "GOPATH=$HOME/golang" >> ~/.bashrc
. ~/.bashrc
mkdir -p $GOPATH

Get a copy of juju-core from launchpad. This will pull in all other dependencies:

go get launchpad.net/juju-core/...

Get our patched version from git. This contains the windows support

rm -rf $GOPATH/src/launchpad.net/juju-core
git clone git@github.com:cloudbase/juju-core.git $GOPATH/src/launchpad.net/juju-core
cd $GOPATH/src/launchpad.net/juju-core && git checkout rebase-1.19
cd $GOPATH/src/code.google.com/p/go.crypto/ssh && hg update -r 191:2990fc550b9f # hack for this particular checkout of juju

Build juju-core

go install launchpad.net/juju-core/...

Binaries will be in $GOPATH/bin

Setting up your Juju environment

  • Initialize your environment
juju init
  • Set up juju to work with MaaS

Go to your MaaS web interface under:

http://<MAAS_URL>/account/prefs/

Where you will find:

MAAS keys

Generate a new key for Juju and copy it to your clipboard. On the node where you have juju installed, edit the file that was generated by juju init:

vim ~/.juju/emvironments.yaml

Set the default environment to maas by editing:

default: maas

Find the section for MaaS and add the key you just copied to the clipboard. Also, make sure you edit the maas-server key. It will be the same URL you see the pie chart in (the one that you get when clicking on the circle next to “Nodes” in the MaaS web interface).

maas-server: 'http://<YOUR URL HERE>/'
maas-oauth: '4BRsFMtY8kTb5RM4eD:8SHtdJC4DzKJJTKNpY:zLKaH8hVb7HGMAK6c48CJMZ3cJFqnuhz'
  • Uploading juju tools to MaaS

If you want to upload your version of juju to MaaS to be used for deployment (and you do):

mkdir -p ~/.juju/tools/releases
cd ~/.juju/tools/releases
cp ~/golang/bin/jujud .
tar -czf juju-1.19.1-trusty-amd64.tgz jujud
rm jujud

Do this for every version of ubuntu that you want to have tools for. Precise and Trusty should be enough for development. While its good practice to build the binary on each platform to make sure no breakage will happen, I have found that the same binary works great on all versions.

For windows machines you will need the JujuService.exe service wrapper. It must be bundeled with the tools. You may download it from Here:

cd ~/.juju/tools/releases
wget http://wiki.cloudbase.it/_media/juju-service.tar.gz # this might need auth
tar -xzf juju-service.tar.gz
cp /location/to/jujud.exe ./ # this will have to be copied over from your windos machine
tar -czf juju-1.19.1-win2012r2-amd64.tgz *.exe
rm *.exe

do this for every version of windows we support

  • Generate the metadata necessary for uploading to MaaS:
juju-metadata generate-tools

This will generate all metadata from the tools found in ~/.juju/tools/releases. The metadata files can be found in:

ls -l /home/ubuntu/.juju/tools/streams/v1
  • Upload tools to MaaS:
juju sync-tools --source=/home/ubuntu/.juju/ --debug
  • Bootstrap the state machine
juju bootstrap --debug --constraints tags=StateMachine

The constraint is used to target a particular machine. If omited, juju will select a node at random.

juju.1398181151.txt.gz · Last modified: 2014/04/22 18:39 (external edit)