Deploying Wordpress on Dreamhost with Capistrano

September 2, 2006 Link to post  Permalink

I’m playing around a little with Wordpress, and one of the first things I want to do is have a development environment at home, deploying to my Dreamhost account

This information is based very heavily on Duncan Ponting’s post on Wordpress and Capistrano with a few changes for my personal use, and to work with Dreamhost.

Here are my steps:

1. Create a new domain (or sub-domain) in the Dreamhost control panel – I set mine to run PHP5 and use my account. I then set the web directory field to be ‘’ instead of the default of ‘’. I also removed the WWW using the radio buttons.

2. I used the Dreamhost one-click install to install Wordpress on my domain, and I followed the options through to setup a database with a specific user for Wordpress only. Remember these settings, they will be used in the deploy.rb later.

3. Using WinSCP, I copied all the Wordpress files from Dreamhost to my local machine and delete the Wordpress files on the server. Here’s the local directory structure

  |- config
  |    |- deploy.rb
  |- public
  |    |- <files from Dreamhost>

4. I added my deploy.rb to the config directory.

5. Edit the deploy.rb file to have all the correct settings – anything with the prefix of my should be changed and the file saved as deploy.rb

6. Import the whole wordpress tree into an SVN server that is accessible from your Dreamhost account – Dreamhost can host this too – look under Goodies!

7. Dreamhost has created a the ‘current/public’ tree in your domain directory – delete this so Capistrano can do its symlink magic.

8. Run cap setup from the wordpress directory to setup the directory tree on the Dreamhost server from the client.

8a. Create a shared/uploads directory on the Dreamhost server for wordpress uploaded files to be placed into.

9. Copy the wordpress/public/wp-config.php file to wordpress/config/wp-config-dreamhost.php on the client and add to SVN. This file already contains your Dreamhost database configuration information.

9a. The second to last line of wp-config.dreamhost.php needs to be changed to this to work with the symlinked wp-config.php:

1efine('ABSPATH', dirname(__FILE__).'/../public/');

10. Edit the wp-config.php file to allow you to run locally with your own MySQL and copy this file to wordpress/config/wp-config-local.php and add to SVN.

11. Make sure to commit your SVN changes to the server

12. Run cap deploy and type your Dreamhost password when prompted.

Congratulations! You should now have Wordpress deployed.

Now you can make code changes locally – plugins, themes etc – test them on your own machine and deploy those changes to your production Wordpress system.

This system should work with most PHP based applications, with only minor modifications to the files and directory names that are symlinked into the public directory at deploy time.

Update: Added step 9a