Capistrano is an awesome tool to have in your toolbox. It was originally developed to simplify and automate the deployment of Rails web applications. Featuring built in support for typical deployment scenarios, it is also flexible enough to allow you to completely override certain behaviors. That being the case, it can be used to deploy non-Rails web application like those built on the Drupal and WordPress CMS platforms.
In order to use Capistrano, you must first install ruby and the ruby gem system. Now we can install the Capistrano gem along with the Rails-less-deploy gem which will allow use to remove all of the built-in Rails-specific behavior.
Now that Capistrano is installed on your system, we can prepare the application to use it.
You will notice that a few files have been created in your application directory.
Let’s update the Capfile to pull in the Rails-less-deploy magic. This gem is responsible for overriding all of the Rails-specific tasks so that we can implement our own custom behavior.
Now, just like any normal Capistrano setup, we must configure some basic details about our destination infrastructure.
Taking a typical WordPress install as an example, there a few custom tasks that we can write to make our lives easier. First, let’s extend the default setup task to include tasks for dropping our default configuration file and creating a uploads folder in the shared directory.
Now, log into your server and update your app/shared/config/wp-config.php file to match the server configuration. When that is done, you are ready to the deploy the application code. We will augment that process with a few tasks that will sync our uploads directory as well as symlink our shared config file to the current release.