Deploy WordPress Automatically with Capistrano

I volunteered to help my wife convert her aging website to WordPress. In a past life I used to be a WordPress developer (*) and during that time I worked with several WordPress experts and picked up a few best practices. One practice I learned was to deploy WordPress from version control (subversion) so when WordPress gets hacked, you can easily see the changes and rollback.

So when it came time to setup my wife’s WordPress site, I turned to the deployment tool that I use on every one of my Ruby on Rails projects: Capistrano. Since I’m familiar with Capistrano’s code base from my Ruby code reading, I wanted to see if it could handle WordPress. Looking around, I found a few projects that already hooked up WordPress to Capistrano but Adam Hunter’s wp-cap was the simplest and most recent.

Basically it takes advantage of the standard public/ directory in Rails and deploys WordPress to there. With a few extra recipes, the entire WordPress deployment is automated. The entire Capistrano configuration file with the WordPress recipes is only 71 lines of Ruby and will automatically generate a wp-config.php.

Now I can work on her WordPress site just like in Rails:

  1. Hack on code
  2. git commit -m "New code"
  3. git push the-wordpress-server
  4. cap deploy
  5. Sip some silver needle white tea and chill

* The first major upgrade of WordPress I did was 1.5, so I must have been using it before then.

Share

  • Facebook
  • Twitter
  • HackerNews
  • Reddit
  • Tumblr
  • Delicious
  • Email
  • RSS

No related posts.

About Eric Davis

I founded Little Stream Software where I provide Redmine and ChiliProject services to help projects teams. I also created an ebook, Redmine Tips, were I show you how to become more productive using Redmine. I am also the author of Refactoring Redmine, where I go about refactoring Rails using Redmine as an example.

, , ,

Chirk HR     Reuse your existing job applicants »
WP Socializer Aakash Web