new deploy.rb file?
|
|
Hi! I am trying to deploy my rail application using Capistrano. I am facing a problem though, it seems the guide ( http://docs.railsboxcar.com/Deploying_your_Rails_application ) is outdated: Among other things, “cap—apply-to” does not work on new versions of Capistrano, it is now “capify”. And, bigger problem: The deploy.rb file provided there doesnt seem to work on capistrano 2.0. When trying to deploy my application with cap deploy:setup, it give me this error message: …/Capistrano/configuration/variables.rb:122:in ‘method_missing’ : undefined method ‘render’ for #<capistrano::configuration:0x3477860> (NoMethodError) Which apparently is caused by this line in deploy.rb in the code that creates the database.yml file: database_configuration = render :template => <<-eof> I guess this is railsboxcar specific code and I am not very familiar with its settings… Can anybody help me on this? Is there any updated version of deploy.rb ? Thank you for your attention, Francois EDIT: I am not really sure where to post this, as it is both a Deployment and a railsboxcar issue… |
|
|
Yeah, Capistrano2 came out the week after we finished documenting this process. Are you deploying with Capistrano 2 for any other projects? We’ll work on updating the documentation, but in the meantime, it might be much quicker for you to downgrade to Capistrano 1.4.x. First, remove 2.0, with:
Then install that latest 1.4.x version:
Then it should work with the current documentation. We’re using capistrano 1.x on several sites without any problems. We’ll get the documentation updated asap to reflect change in Capistrano 2 and also plan to include documentation for using Vlad the Deployer. Cheers |
|
|
Thank you for your help – here and by email! Ill try that for the next deployment and will let you know how it goes :) |
|
|
Hi Robby, I’m afraid I’m going to need your help again. I’ve installed Capistrano 1.4.1 but still cannot find how to deploy my application. At first, I got an error message when deploying telling me the reaper script couldnt be executed. I fixed the authorization problem, but it is still not working, I get this error every time i try to deploy: Couldn’t find any pid file in ‘home/railsapps/sites/events/current/tmp/pids’ matching ‘dispatch.[0-9]*.pid’ Followed by another one: undefined local variable or method ‘chmod755’ for #Capistrano::Actor:0×478464c> Do you have any idea what could cause this problem? I’m still searching and will let you know if I manage to find a solution by myself :) Francois |
|
|
Small update: I believe my rake remote:... tasks change some config files with default settings. As discussed with support, the shared/config/database.yml had default settings that do not work with my application ( postgres instead of mysql, wrong port number, no socket, wrong username …) and this was to be caused by the deploy.rb file. I managed to fix most of it for this single file but I suspect the deployment to make other changes that I’m not aware of… EDIT: I get the same problem ( Couldn’t find any pid file in ‘home/railsapps/sites/events/current/tmp/pids’ matching ‘dispatch.[0-9]*.pid’) on our development box. I cannot deploy the applicaiton since I downgraded to Capistrano 1.4.1. :( I guess I am doing something wrong, but I have no idea what… |
|
|
Francois, When you do a gem list capistrano, what is the output? |
|
|
Should it have a ”/” before “home”? Most often when you ssh in you end up in a home directory. So you would either be in /home/railsapps/, or /root/. Which would make that filesystem path ”/home/railsapps/home/railsapps/sites/events/current/tmp/pids” which most likely doesn’t exist. Can you put the deploy.rb someplace I can look at it? — Daniel |
|
|
Hi, thank you for your replies, The gem list capistrano output is : bq. LOCAL GEMS capistrano (1.4.1) Capistrano is a framework and utility for executing commands in parallel on multiple remote machines, via SSH. The primary goal is to simplify and automate the deployment of web applications. Sorry Daniel, I didnt copy the error message properly. The last lines I get when deploying are: executing task restart executing ”/home/railsapps/sites/events/current/script/process/reaper—dispatcher=dispatch.fcgi” servers: “198.145.115.78” 198.145.115.78 executing command out :: 198.145.115.78 Couldn’t find any pid file in ’/home/railsapps/sites/events/current/tmp/pids’ matching ‘dispatch.[0-9]*.pid’ out :: 198.145.115.78 (also looked for processes matching “dispatch.fcgi”) command finished rake aborted! undefined local variable or method `chmod755’ for #<capistrano::actor:0x478045c>] I am sending you my deploy.rb file by email, I hope that will help! Thank you! Francois |
|
|
It looks like it is trying to restart a fastcgi process, but no fastcgi processes are going to exist as it uses mongrel_rails not fastcgi. Change the options to use mongrel instead. |
|
|
Hi Daniel! Could you tell me what options need to be changed exactly? Where is it located? I’m not quite sure… Anyway, I’ll try to find something like that to change in my files. Thank you, Francois Edit : could it be because of my dispatch.fcgi file in public directory? Even though it’s the default one… I can’t find any other file that could start a fastcgi process… !/usr/local/bin/ruby#
RailsFCGIHandler.process! |
|
|
I think I just caught the culprit: My Capfile! This is what I found in there: namespace :deploy do#
Could you tell me what it’s supposed to be exactly? |
|
|
Francois, I believe that Capfile is a 2.0 thing. Could you try removing this file or are you now trying to use Cap2? |
|
|
Hi Robby, thanks! I’m still on 1.4.1 and apparently simply removing that file helped solving a problem… But It is still not working. Sorry for all the trouble and thanks again for all your help. Apparently, my mongrel servers cannot restart because their .pid files are not in the pids folder. I just checked, it’s empty. After trying to restart them, capistrano launches 2 servers, but their .pid does not appear in the pids folder either: executing task restart executing “cd /home/railsapps/sites/events/current/ && mongrel_rails cluster ::restart”
executing command
mongrel::stop reported an error. Use mongrel_rails mongrel::stop -h to get help. mongrel_rails stop -P tmp/pids/mongrel.8001.pid -c /home/railsapps/sites/events/current Starting 2 Mongrel servers… command finished Any idea what could cause the problem? I sent my deploy.rb file by email to support yesterday in case you need it… Francois |
|
|
Francois, Usually when that missing pid error happens, it’s because mongrel isn’t already running. I logged into your server and see mongrel instances running. Is it up and running now? |
|
|
Hi Robby, I got a little bit closer to success today! I found the .pid files in the “logs” folder. I have no idea what they were doing there. I killed the processes and restarted the deployment: It worked! I now have another problem, a “nice” application error when trying to access the website on www.bangkoknetworking.com. The production.log file complains about this: Errno::ENOENT (No such file or directory – /tmp/mysql.sock) I guess this is good news, as it is a mysql error. Doesnt it mean the server problem is now solved? :) Hmmm Any idea how to get this to work? Thanks again! Francois |
|
|
It appears that MySQL, by default, stores the mysql.sock file in You have two options, we can have MySQL start itself and set the mysql.sock file in I’m partial to modifying the database.yml file, which I just did for you. Can you email me your current deploy.rb file and I’ll take a quick look through it and see if I can modify any issues that I might find for you? :-) |