This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
juju [2014/04/22 18:39] gsamfira [Setting up your Juju environment] |
juju [2015/08/17 11:37] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Working with Juju ====== | + | ======= 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 Go environment | + | :!: For the sake of this example, we will assume that your MaaS IP is **192.168.200.1** :!: |
- | | + | |
- | . ~/.bashrc | + | |
- | mkdir -p $GOPATH | + | |
- | Get a copy of juju-core from launchpad. This will pull in all other dependencies: | + | sudo apt-get -y install golang-go git mercurial bzr mongodb |
- | | + | |
- | Get our patched version from git. This contains the windows support | + | echo ' |
+ | echo ' | ||
+ | . ~/.bashrc | ||
+ | mkdir -p $GOPATH | ||
- | rm -rf $GOPATH/ | + | This will add the necessary variables to facilitate building |
- | git clone git@github.com: | + | |
- | cd $GOPATH/ | + | |
- | cd $GOPATH/ | + | |
- | + | ||
- | Build juju-core | + | |
- | | + | |
- | + | ||
- | Binaries | + | |
- | ==== Setting up your Juju environment ==== | + | go get -v github.com/ |
+ | * Get correct dependencies | ||
- | | + | |
+ | cd $GOPATH/ | ||
+ | godeps -f -u dependencies.tsv | ||
- | juju init | + | |
+ | go install -v github.com/ | ||
- | * Set up juju to work with MaaS | + | Binaries will be in $GOPATH/bin |
- | Go to your MaaS web interface under: | + | :!: Instructions for the Windows version can be found [[juju-windows|HERE]] :!: |
- | http://< | + | ===== Setting up your Juju environment ===== |
- | + | ||
- | 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: | + | * Initialize |
- | | + | juju init |
- | + | ||
- | 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 " | ||
- | | + | |
- | maas-oauth: ' | + | |
+ | |||
+ | ===== Generating local tools ===== | ||
* Uploading juju tools to MaaS | * Uploading juju tools to MaaS | ||
Line 64: | Line 55: | ||
mkdir -p ~/ | mkdir -p ~/ | ||
cd ~/ | cd ~/ | ||
- | cp ~/ | + | cp ~/ |
- | tar -czf juju-1.19.1-trusty-amd64.tgz jujud | + | tar -czf juju-1.21.1-trusty-amd64.tgz jujud |
rm 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. | + | Do this for every version of ubuntu that you want to have tools for. Trusty should be enough for development. |
- | For windows machines | + | For windows machines: |
cd ~/ | cd ~/ | ||
- | | + | cp / |
- | tar -xzf juju-service.tar.gz | + | tar -czf juju-1.21.1-win2012hvr2-amd64.tgz |
- | | + | |
- | tar -czf juju-1.19.1-win2012r2-amd64.tgz | + | |
rm *.exe | rm *.exe | ||
| | ||
- | do this for every version | + | do this for every version |
* Generate the metadata necessary for uploading to MaaS: | * Generate the metadata necessary for uploading to MaaS: | ||
Line 86: | Line 75: | ||
| | ||
This will generate all metadata from the tools found in ~/ | This will generate all metadata from the tools found in ~/ | ||
- | |||
ls -l / | 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: | * Upload tools to MaaS: | ||
Line 96: | Line 100: | ||
* Bootstrap the state machine | * 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 | juju bootstrap --debug --constraints tags=StateMachine | ||
| | ||
- | The constraint | + | This will take a while. If your network |
+ | |||
+ | * Set your nameserver to the MaaS IP address in resolv.conf (or equivalent) | ||
+ | |||
+ | echo ' | ||
+ | |||
+ | * Check that the state machine | ||
+ | |||
+ | 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: | ||
+ | |||
+ | | ||
+ | |||
+ | This will install mysql on a " |