Thursday, October 09, 2008

Capistrano, Rails < 2.1 and executable files permission problems.

Last days I worked with Capistrano 2.5.0 and a 2.0.2 Rails application using the peepserver plugin, after the deploy.rb configuration and the capistrano setup, I ran the cap deploy:cold command and I got some error problems related to Permission issues, something like:


*** [err :: xxx.xxx.xxx..xxx] 
script/spin: 6: 
/var/www/test_app/current/script/process/spawner: Permission denied


I checked the file permission status in the server and everything was fine, later, googling it and asking a friend, we found the problem raises when the Rails generated script files don't have a +x or 755 mod, the important thing here is that Rails versions under 2.1 don't set this mode for the generated scripts when you create your application running the 'Rails Foo' command, in this case you have to change it manually or make a program to change all the scripts in your rails folder, and then upload the changes to your repository, the good thing here is that Rails 2.1 make this for you and the problems shouldn't raise after the capistrano deploy process.