Quickly Getting Started with Juju
A few weeks ago, my peers accosted me and informed me that we really need something to help with people getting started on Juju. While Juju is a really awesome, people just want to start using and playing with it. What they wanted was a Juju image that could enable someone to run Juju on their MacOS X, Windows or Ubuntu installation without much effort.The result of that conversation is the Juju Vagrant images. The initial image is based on the Ubuntu Cloud Images. Juju is configured to use the local LXC provider and is preseeded with the latest 12.04 LTS release so deployments should be relatively fast.
The image gives you a couple of things:
- A Vagrant development environment for developing your charms
- the Juju GUI accessible locally through your browser
- A functional, self-contained Juju environment
Dependencies
Ubuntu (and other Linux's), Windows and MacOS are all target platforms. The following instructions will help you get setup.
Ubuntu:
- sudo apt-get update
- sudo apt-get -y install virtualbox vagrant
- (optional): sudo apt-get -y install sshuttle
MacOS
- Fetch and install VirtualBox from https://www.virtualbox.org/
- Install Vagrant from http://downloads.vagrantup.com/tags/v1.3.3
- (optional) Install Sshuttle:
- via homebrew: brew install sshuttle
Windows
- Fetch and install VirtualBox from https://www.virtualbox.org/
- Install Vagrant from http://downloads.vagrantup.com/tags/v1.3.3
- (optional) Install Sshuttle:
- Requires nodejs is installed
- Run: "npm install sshuttle"
Chose the box
Vagrant uses "boxes," as a way of distributing the virtual machine images. We have put all our boxes on the Ubuntu Cloud Images site. The quick links are:
- http://cloud-images.ubuntu.com/vagrant/saucy/current/precise-server-cloudimg-amd64-juju-vagrant-disk1.box
- http://cloud-images.ubuntu.com/vagrant/saucy/current/precise-server-cloudimg-i386-juju-vagrant-disk1.box
Fire it up!
Vagrant makes getting started really easy. The easy steps are:
- Choose a directory to work in. This directory will be shared with the guest, and contain the vagrant configuration for the machine.
- Run: "vagrant box add JujuQuickStart <URL>",
- for example: "vagrant box add JujuQuickStart http://cloud-images.ubuntu.com/vagrant/saucy/current/precise-server-cloudimg-amd64-juju-vagrant-disk1.box"
- This will download the box from the URL you chose above.
- The box will be given the name of "JujuQuickStart"
- The box will start and configure Juju for you
- In order to access the GUI, go to "http://127.0.0.1:6080"
- While the Juju GUI is deployed, you will see a status page
- Once the GUI is deployed, it will display the password on the login page
- The GUI is only accessible from your local host
- From this GUI you can deploy any charm from the store, and it will be launched inside an LXC container in the Vagrant image - no other configuration required!
- If you “vagrant ssh” into the image, you can run the Juju CLI tool if you prefer to use that.
- For development, “/vagrant” is shared with the host, this means you can hack on your charm/application locally without having to spend money in a cloud. We recommend 12.04 images for this.
- Mess up? “vagrant destroy” and “vagrant up” on the host will create a pristine environment for you to work with, all while preserving “/vagrant” within the Vagrant Box.
- to shut down the machine run "vagrant halt"
- to destroy it, run "vagrant destroy"
- to ssh in, run "vagrant ssh"
- to remove a box, run "vagrant box remove JujuQuickStart virtualbox"
(optional) SSHuttle
If you want to use this for developing Juju Charms, you can do so with the aid of SSHuttle. SSHuttle is a slick tool for using SSH as a VPN. When used with the Juju Quickstart images, it means that you can have a completely disposable development environment, you can use your preferred editor, and access your charms locally.The Juju Quickstart uses 10.0.3.0/24 as the LXC network. To grant local access to that group, run:
- sshuttle -e 'ssh -o UserKnownHostsFile=/dev/null vagrant@localhost:2222' 10.0.3.0/24
- Use the password of "vagrant"