I was deploying my latest code to live site today using Capistrano, and suddenly I stuck. When I tried to deploy the code, it checked out the latest version on the server and while executing after_symlink task it rolled back. I was surprised because the deploy script was working fine earlier and I haven’t made any change in deploy.rb or deploy procedure. I tried many times but not succeed, and then I found the root of problem.

The problem was that I mistakenly created a file in releases directory and Capistrano uses ln -x1 command to create symbolic link to current release. And Capistrano links last output of ‘ln -x1′ as ‘current’, so in this case ‘current’ was linking to a file. This was doing all the mess, as ‘current’ was pointing to a file instead of latest release directory. I deleted that file from releases and then it worked fine…

Share this: