The idea
We’re going to use a raspberry pi and juju to setup a wordpress blog on aws.
The raspberry pi is an amazing little gadget. Low power enough that I don’t feel guilty about leaving it turned on overnight, but flexible enough that I can shove leds into it to grab my attention if needed.
Juju is ubuntu’s answer to setting up services in the cloud. Once installed you simply setup your credentials with an existing cloud provider like aws or hp cloud and then deploy things into it. Setting up wordpress for example is as simple as
1 2 3 4 5 |
|
The Plan
- Install go onto the raspberry pi
- Install juju
- Deploy a wordpress blog
We’re going to be installing the latest version of juju which is written in go.
Installing Go
Dave Cheney has written an excellent article on Installing go on the raspberry pi. On my model B (1.0 revision) I had to update raspi-config so that I could select the 240M/16M memory split, but you might have to see how you get on here. I choose to skip the tests and just ran ./make.bash to build go rather than all.bash.
I was unable to build juju using go 1.0.3. I ended up building go 1.1.1 from source, which seemed to work fine. From memory I believe you need to setup a folder to be your GOPATH before you can install the latest version of go.
Installing Juju
Getting the latest tip of juju-core is easy using the go get command, it grabs all the dependencies for you, it does mean we’re grabbing tip, but there are ways to fix that later if we need to. juju-core is hosted on launchpad.net which uses bazaar for source control. This means you need to install it before you can run go get. I was able to install it on raspian using
1 2 |
|
Without doing the update I was unable to grab all of bzr’s dependencies, so I recommend running the update first.
Once bzr is installed you can install juju using go get:
1 2 |
|
When it’s finished you should find a juju binary installed. Mine ended up in my GOPATH, I think because I had something setup wrong somewhere. But if you’ve got this far I’m sure you’ll be able to find it.
Setting up Juju
There’s much better instructions for setting up juju here The basic steps come down to
- Setting up a public key
- Generating an environments.yaml file
- Filling the file in with the data for your cloud provider
I configured juju for aws. My ~/.juju/environments.yaml file looked like this:
1 2 3 4 5 6 7 8 |
|
Once you’ve done this, try running juju bootstrap. If it finishes without error wait a minute or so and run juju status, If all goes well you should see something like this
1 2 3 4 5 6 7 8 9 |
|
Now we can start the business of getting a blog up and running:
1 2 3 4 |
|
You might have to wait a few minutes for everything to start up, keep taking a look at the output of juju status until you see all the agent-states running and expose true on wordpress.
When it’s done you should see something like this in your juju status output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Now point your web browser to the url in public-address and there you go, you’re deploying stuff from your pi.
Juju doesn’t stop at just deploying blogs. Check out Juju to see what else it can do for you