Deploying WordPress with Capistrano
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


See the example at

Deploying WordPress with Capistrano

Although anyone can use this, I doubt for the WP hobbiest it would be easier than FTP.  However, I use Capistrano to deploy all of my Ruby on Rails application and thought it would be really nice to manage my WordPress blog with Capistrano.  There are dozens of tutorials on setting up Capistrano, so be sure to check them out.  This will require Ruby and the Capistrano Ruby Gem.

Intended Directory structure:

  /wp-config.php (this will be created upon deploy)

There is a deploy.rb file inside of config already.  Your WordPress installation should go in the public folder.  Move wp-config-sample.php from public to config so that it can be copied and used on different development machines (like a database.yml.example).

Once you have your files all set, you will need to convert this into a git repository so that you can do a Capistrano deployment.  Since you're getting this from github, I am assuming you know how to do this.

When you are ready to deploy your app for the first time, make sure you edit deploy.rb with your production environment specific information. You will need to set:

application: this is the name of your application and the folder it will reside in on your server
domain: this is the domain of your app as well as the git repository, you can setup a git_domain variable if they are different
user: this is the user that will be used to ssh for cloning the repository and copying your files to your server
port: this is the SSH port, I don't use 22 but if you do you won't need this
db_name, db_user, db_pass, db_host and db_prfx are all pretty self explanatory if you have ever read through wp-config-sample.php.  If you haven't, go do that right now.

Once that is all set, you need to run:

cap deploy:setup

This will create the basic files and folders that you need for using a Capistrano deployed app.  This will also create your wp-config.php and store it in the config folder.  You do not need to create a wp-config.php file for your production machine.  (Even the secret keys will be downloaded from WordPress).  You only need to run "cap deploy:setup" to first time you want to deploy your application.

cap deploy

This is the command that you will run every time that you want to deploy updates to your WordPress app.  It will symlink the wp-config from /config/wp-config.php to /root/wp-config.php because WordPress will look one directory up for a non public wp-config.php.

Once everything is deployed you will need to make sure apache is serving from the app_path/current/public folder NOT the root folder.

If you have any question or this isn't working for you, please let me know or fork it on github! If you can get the security keys to download over HTTPS (instead of HTTP) for auto-generating the wp-config.php that would be great!