The Way to Run WordPress in the Cloud
Today Marco Ceppi finished up the new and improved WordPress Charm in the juju charm store. Feel free to throw away whatever Wordpress tutorial you’ve been finding on the web, this is the easiest and most performant way to run WordPress on Ubuntu (at least until you tells us better and we can improve it, heh).
Set up and tuning
juju deploy wordpress juju deploy mysql juju add-relation wordpress mysql juju expose wordpress
This gives you WordPress in a single configuration. Pulled from upstream’s latest release and served with Nginx microcache, APC OpCode caching, WordPress caching module, and the ability to sync files via NFS.
This allows you to deploy a very fast configuration out of the box. It’s probably better than most of the out-of-the-box set ups you’ve seen around the web. This configuration is designed for small scale, so you’d run it on a small or medium and just
juju add-unit wordpress when you get a traffic spike.
But what about larger sites, like say OMG!Ubuntu-like traffic? Ok. We’ve done this before and learned a ton, and now thanks to Marco all the lessons learned are now deployable to every Ubuntu user. Here we go:
juju set wordpress tuning=optimized
… and now your environment reconfigures itself to run in a multinode wordpress configuration designed to be admin’ed by multiple users with load balancing. The works. Want the basics with no options so you can do it yourself? Here you go, nothing but raw vanilla wordpress and nginx:
juju set wordpress tuning=bare
Want to stick your wp-content in version control? No worries with built in bzr and git support:
juju set wordpress wp-content=git@host:path/repo.git
or juju set wordpress wp-content=lp:~username/path/repo
Now you have your content in version control. You can find all the configuration options and how to use the charm on the charm’s page, including a hack for running it all on one node for those of you trying to maximize your dollar.
Rocking with memcached
Putting memcached with Wordpress is a best practice for caching high traffic sites, you can add this with:
juju deploy memcached juju add-relation memcached wordpress
This will automagically install WP-FFPC (regardless of your tuning settings) and configure it to cache rendered pages to the memcache server. In addition to this layer of caching, Nginx will pull directly from memcache bypassing PHP altogether.
Think you can do a better job optimizing Wordpress? Here’s the code, and here’s how to submit fixes and improvements. This charm is already better than any WordPress we’ve shipped in Ubuntu, and we’re confident that through peer review and testing that it will continue to get better. Remember folks, the Charm Store doesn’t freeze, you can enjoy these improvements today; that means when Marco is done with the glusterfs charm that you can just switch to it if NFS isn’t your thing. It’s like cloud Legos!
Thanks to Marco Ceppi for backporting all the scaling lessons back into the store for 12.04 users, and thanks to Brandon Holtsclaw for iterating and testing a great deal of this, and for Joey for going all in with this idea. As I explained before, this changes everything. New WordPress release?
juju upgrade-charm wordpress and you’re good to go. You get pure fresh WordPress with all the goodness out of the box, and then the OS gets out of your way.
This is just the beginning, over the next few weeks you’ll see optimized nginx and optimized nagios start to hit as we start to really “go deep” into charm scaling and quality. It will be an exciting time as we totally deprecate wide swaths of “How to run $foo on Ubuntu” around the web and get the goodness in the charm store where anyone can deploy it.
You can catch Marco’s talk about juju and this charm at the Washington DC PHP Meetup for those of you in the beltway.