Thursday, March 25, 2010

Capistrano Deploy Issue in 2.5.10

When using set :keep_releases = (number) and Capistrano 2.5.10, it deleted the release it created on the server at the end of deployment. This would royally screw the deploy up, because in the end, the "current" symlink on the server would point to a non-existing release directory. I am very thankful that issue has been fixed between that version and current version, Capistrano 2.5.18.

Since there were no errors in the log and you don't really pay attention to the release numbers in the log since they are so long, this really wasn't obvious at first. I couldn't find the bug for it when searching, but perhaps you can. Update: Lee helped me find the bug (#88) as discussed in bug #155.

I figured this out when I was doing text-replacement to remove the release numbers from the old log and new to help with the diff. Doing that I noticed that in the end of the log of the deploy using Capistano 2.5.10 removed the release it had deployed (!) in the end of the log.

  * executing "rm -rf /path/to/project/releases/(number of release just deployed)"
    servers: [""]
    [] executing command
    command finished
I'm fairly sure that this had to do with the set :keep_releases, 3 that we were using for this particular project.

So, the moral of the story is, if you are using Capistrano 2.5.10, be wary of :keep releases screwing up your deploy and leaving you with a current symlink pointed at a non-existant release dir. To fix, update capistrano via:

gem update capistrano
and redo your deployment.

No comments: