Deploying ColdFusion Apps With Capistrano Part 1

I love developing in ColdFusion, but one of the reasons I spend time learning other languages/frameworks is so I can get a feel for what things others are doing that could help make our jobs a little easier. Lets face it, the ColdFusion community is a little slow to progress sometimes and there is alot of innovation happening in other communities.

One of those areas is application deployment. There have been a few attempts in the past using Ant to help automate deployment. I even wrote a CF based deployment tool that used Ant under the covers and would auto-version and tag your builds and push them to your deployment servers from SVN about 5 years ago. All of the Ant based solutions have had their strengths and weaknesses and are certainly better than FTP’ing to your server and pushing files. However, after working on a few Ruby on Rails projects, I knew there had to be a better way.

There is a deployment tool used by alot of Rubyists called Capistrano. Its a gem that runs locally on your workstation and can handle a wide array of deployment tasks. It sets up a nice structure to easily allow you to rollback your deployments if you need to as well as run several server side tasks as part of your deployment. I never gave much thought (other than pure envy) to Capistrano as it was tightly coupled to rails deployments. Until now.

I recently found a gem called railsless-deploy developed by Lee Hambley. It simply allows you to use Capistrano to deploy your application without it being a Rails app. So I thought, if I dont need Rails, perhaps the application being deployed doesnt need to be a Ruby app, which means I might be able to deploy a CF app with it! So with much enthusiasm I set out to see what I could do with it.

I was amazed at how easily I was able to start deploying a CFWheels application that I had been working on up to one of my Rackspace Cloud instances. Once the initial configuration was done, deploying a new version was as easy as typing $ cap deploy in the terminal. Capistrano would grab the latest release from GitHub and deploy it to my cloud server, symlink a few config files for me that are shared and save the last 3 releases on the server. How great is that?!

There are a few things you will need to use Capistrano to deploy and I will list them here as well as a basic setup. In part 2 of this post, I will walk you through configuring your application for deployment, setting up your server and deploying your code.

What you’ll need

Since capistrano is a gem, you will need Ruby installed. If your developing on a Mac, you should have it installed already. If you are on Windows, you will have to install Ruby for this to work. There are quite a few blog posts on installing Ruby on Windows, so I will let you handle that on your own.

You will also need SSH access to your server and your server should have a POSIX compatible shell. Most Linux servers should be fine for this. If you are deploying to Windows, I understand there is an extension to Capistrano called capistrano_winrm that may work for you but I havent tried it out.

My workstation is running Mac OS X 10.6 with Ruby 1.9.2 and Git. My server is a Rackspace Cloud Instance running Ubuntu Server 10.10 but any Linux flavor should be fine.


Once you have ruby and rubygems installed, setup is easy. Simply open your command prompt and install the 2 gems:

$ gem install capistrano
$ gem install railsless-deploy

Thats it, your ready to start configuring your application for deployment and we will do just that in part 2 of this post.

3 thoughts on “Deploying ColdFusion Apps With Capistrano Part 1”

  1. Great idea. I’ve cheated and are using a deployment service called I have a free account because I also use their project management service Codebase.

    Of course Capistrano is free which always helps… 🙂

    Whatever tool you choose, it makes uploading updates a painless experience. Well worth it.

    ~ David

Leave a Reply

Your email address will not be published. Required fields are marked *