Practical advice for rapidly delivering customer value

How to set up wordpress on ec2 using puppet and git

Having started out on a Joyent appliance, migrating to Linode, and, finally, to Amazon with a Bitnami stack, we noticed the common pain of manually configuring each of these environments. Bitnami caused us an even bigger headache by being very difficult to update (apt-get doesn’t update the bitnami wrapped AMP stack). We decided to get full control of our box by setting up a stock Debian LAMP stack on AWS using Puppet and git to manage our sites. Here’s a gentle introduction on how we did it.

AWS and unfuddle

Setup a t1.micro instance with aws.amazon.com for your blog. Remember, if you don’t have an AWS account yet, this micro instance is free for 12 months! We get ~20KPIs per month so the micro instance is just enough to cover this (with significant tuning).

Sign up with unfuddle.com for 200MB worth of free, private git repositories.

Now, you can clone this to your local dev env and start creating manifests! After you push your local changes to git, do a git pull on the remote instance. To apply manifest updates while building up your site, use the --test option (otherwise puppet will start in daemon mode).

$ puppet agent --test

Congratulations! Now you’ve got a running puppet standalone environment backed with a git repository. Time for the real work.

Base environment (L)

Here’s what our nodes.pp file looks like:

node default {include setenv
include ntp
include users
include mysql
include apache
include php
include blogs
}

This puts all the pieces of the puzzle together: our custom apache configuration, enabling the site with an easy one-liner, and bootstrapping the WordPress database and user (only if they don’t exist).

We don’t do a WordPress install per-se. We’ve been running this site for almost four years, and we have it in a git repository (conveniently hosted next to the puppet repo with unfuddle). All the migrations we’ve performed in the past have shown us the “famous 5-minute installation” can’t beat the ease of a git clone.

Crafting and finding the above manifests on the Internet took me about 12 hours total work effort, but I have a few years of puppet experience under my belt as well. Hopefully, this guide gives you some ideas and pointers about how to get control of your WordPress environment with puppet. I’ve published an “anonymized” version of the entire configuration over at github – hope this helps you get a jump start on your server setup. Let me know if you have any questions!

Blog Updates

The Book

The Chef Infrastructure Automation Cookbook contains practical recipes on everything you will need to automate your infrastructure using Chef. The book is packed with illustrated code examples to automate your server and cloud … Read more...