posts by tag

capistrano (1)
Deploying with Capistrano (trying to)

I want a better deployment method. Right now I’m uploading the files using an FTP client, which is a pain and unnecessary. I can’t stand dealing with the .online versions of those certain files. The past week or so I’ve been trying to setup Capistrano to help me out with deployment. Well, the core of Capistrano is within the deploy.rb file. That’s where you tell it your subversion repository, application name, roles, username, password, etc. Also, I have some code in there to go and grab the .online versions (environments.rb, routes.rb, database.yml, .htaccess) and replace the existing files on the server with those, just in case there are changes. I’m forgetful and it’s a much better solution (for me) to have all of this execute consistently.

The first thing to do is to install Capistrano. Once it’s installed, you modify your deploy.rb file as I mentioned above. Now it’s time to build the folder structure on the server. Running rake remote:exec ACTION=setup will created a releases folder (to hold the versions), a shared folder (files shared between multiple releases), and a current folder (a symlink to the most recent release). Within the deployment recipe, you define tasks to be performed upon deploying. Things like disable_web (puts up a maintenance page), upload_code (obvious), symlink (point to the current release), migrate (update any database changes), restart (restart fcgi processes), enable_web (remove the maintenance page), and so on. Once all that is done, run rake deploy or cap deploy (what’s the difference?) which will do the following:

  1. Checkout the latest revision of your application into the releases directory
  2. Update (or create) the current symlink so it points to the newest revision
  3. Invoke the restart task

All of that works find and dandy. Everything get’s posted properly, all .online files are updated (and the .online part is removed), the symlink points to the correct revision each time, and the shared log is updated to reflect a new revision. However, the entire reason I’m posting is in hopes that someone knows why the application is hanging after all of this. I know it’s hard to make guesses without actually seeing/writing the code yourself, but I’m running out of ideas and there may be standard things to look for. The application will just hang until Apache times out in the effort to start FastCGI (180 seconds I think?). It’s extremely frustrating because the Capistrano deployment is working fine in terms of connecting and putting everything where it needs to go. But apparently I’m missing something. It seems like it’s something in the environment (like when I had the wrong GEM_VERSION it did the same thing), but I’ve checked all I know to check. Does anyone have any guesses why this isn’t working??? Is there a better way to deploy than using Capistrano???

2008 by Ryan Heath | Get In Touch

flickr

DesolateInfinityLooking upDazedBlurred