This shows you the differences between two versions of the page.
juju [2014/10/24 19:46] anashwan |
juju [2015/08/17 11:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======= Working with Juju and MaaS ======= | ||
- | :!: WARNING: reboot support is not yet merged. If you need to reboot please use old binaries :!: | ||
- | |||
- | :!: For the sake of this example, we will assume that your MaaS IP is **192.168.200.1** :!: | ||
- | |||
- | * Install Go | ||
- | |||
- | sudo apt-get -y install golang-go git mercurial bzr mongodb | ||
- | |||
- | * Set up your Go environment | ||
- | |||
- | echo ' | ||
- | echo ' | ||
- | . ~/.bashrc | ||
- | mkdir -p $GOPATH | ||
- | |||
- | This will add the necessary variables to facilitate building juju and to have juju (client) in your path once that's done. | ||
- | |||
- | * Get a copy of juju-core from launchpad. This will pull in all other dependencies: | ||
- | |||
- | go get github.com/ | ||
- | |||
- | * Get correct dependencies | ||
- | |||
- | go get launchpad.net/ | ||
- | cd $GOPATH\src\github.com\juju\juju | ||
- | godeps -f -u dependencies.tsv | ||
- | |||
- | * build juju | ||
- | |||
- | go install -v github.com/ | ||
- | |||
- | Binaries will be in $GOPATH/bin | ||
- | |||
- | :!: Instructions for the Windows version can be found [[juju-windows|HERE]] :!: | ||
- | |||
- | ===== Setting up your Juju environment ===== | ||
- | |||
- | |||
- | * Initialize your environment. This will create ~/ | ||
- | |||
- | juju init | ||
- | |||
- | |||
- | * Set up juju to work with MaaS | ||
- | |||
- | |||
- | ===== Generating local tools ===== | ||
- | |||
- | * 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 ~/ | ||
- | cd ~/ | ||
- | cp ~/ | ||
- | tar -czf juju-1.21.1-trusty-amd64.tgz jujud | ||
- | rm jujud | ||
- | | ||
- | Do this for every version of ubuntu that you want to have tools for. Trusty should be enough for development. | ||
- | |||
- | For windows machines: | ||
- | |||
- | cd ~/ | ||
- | cp / | ||
- | tar -czf juju-1.21.1-win2012hvr2-amd64.tgz jujud.exe | ||
- | rm *.exe | ||
- | | ||
- | do this for every version you want to support | ||
- | |||
- | * Generate the metadata necessary for uploading to MaaS: | ||
- | |||
- | juju-metadata generate-tools | ||
- | | ||
- | This will generate all metadata from the tools found in ~/ | ||
- | |||
- | ls -l / | ||
- | |||
- | |||
- | ===== Setting up your configuration ===== | ||
- | |||
- | Go to your MaaS web interface under: | ||
- | |||
- | http:// | ||
- | | ||
- | 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: | ||
- | |||
- | sed -i ' | ||
- | sed -i ' | ||
- | sed -i ' | ||
- | |||
- | * Upload tools to MaaS: | ||
- | |||
- | juju sync-tools --source=/ | ||
- | |||
- | * Bootstrap the state machine | ||
- | |||
- | juju bootstrap --debug | ||
- | |||
- | * If added in MaaS, you may optionally use constraints to tag particular node: | ||
- | |||
- | juju bootstrap --debug --constraints tags=StateMachine | ||
- | | ||
- | This will take a while. If your network is slow, the first time you try to bootstrap will fail. Juju has a timeout of 10 minutes. Don't panic, just run it again. MaaS caches your debs and the next time you try it will get from local cache. | ||
- | |||
- | * Set your nameserver to the MaaS IP address in resolv.conf (or equivalent) | ||
- | |||
- | echo ' | ||
- | |||
- | * Check that the state machine has been bootstrapped: | ||
- | |||
- | juju status | ||
- | |||
- | |||
- | this should output something similar to: | ||
- | |||
- | ubuntu@maas-controller: | ||
- | environment: | ||
- | machines: | ||
- | " | ||
- | agent-state: | ||
- | agent-version: | ||
- | dns-name: MaaS-StateMachine.maas | ||
- | instance-id: | ||
- | series: trusty | ||
- | state-server-member-status: | ||
- | |||
- | |||
- | If it does not, I have failed miserably to explain this procedure properly, and I am ashamed. | ||
- | |||
- | You should now be able to deploy new charms. To test it out, lets install MySQL: | ||
- | |||
- | juju deploy mysql | ||
- | |||
- | This will install mysql on a " |