This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
juju [2014/04/21 13:56] gsamfira created |
juju [2015/08/17 11:37] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ======= Working with Juju and MaaS ======= |
- | ===== Compiling juju-core ===== | + | :!: WARNING: reboot support is not yet merged. If you need to reboot please use old binaries :!: |
- | Set up your environment | + | :!: For the sake of this example, we will assume that your MaaS IP is **192.168.200.1** :!: |
- | echo "GOPATH=$HOME/ | + | |
+ | |||
+ | sudo apt-get -y install golang-go git mercurial bzr mongodb | ||
+ | |||
+ | * Set up your Go environment | ||
+ | |||
+ | | ||
+ | echo ' | ||
. ~/.bashrc | . ~/.bashrc | ||
mkdir -p $GOPATH | mkdir -p $GOPATH | ||
- | Get a copy of juju-core from launchpad. | + | This will add the necessary variables to facilitate building juju and to have juju (client) |
- | | + | |
- | Get our patched version from git. This contains the windows support | + | go get -v github.com/ |
- | | + | |
- | | + | |
- | cd $GOPATH/src/ | + | go get -v launchpad.net/ |
+ | cd $GOPATH/ | ||
+ | godeps | ||
+ | |||
+ | | ||
+ | |||
+ | 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/environments.yaml | ||
+ | |||
+ | | ||
+ | |||
+ | |||
+ | * 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 ~/.juju/tools/ | ||
+ | cp ~/ | ||
+ | tar -czf juju-1.21.1-trusty-amd64.tgz jujud | ||
+ | rm jujud | ||
| | ||
- | Build juju-core | + | Do this for every version of ubuntu that you want to have tools for. Trusty should be enough for development. |
- | go install launchpad.net/juju-core/... | + | For windows machines: |
+ | |||
+ | cd ~/.juju/tools/ | ||
+ | cp / | ||
+ | tar -czf juju-1.21.1-win2012hvr2-amd64.tgz jujud.exe | ||
+ | rm *.exe | ||
| | ||
- | Binaries | + | 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 " |