Gabriel Falkenberg
2006-May-10 08:30 UTC
[Mongrel] Problems starting mongrel running a rails app as a service
Hi there I have a rails app that I want to run on a Win 2k server running Mongrel. I''ve downloaded the latest version and the win32-service gem and can run it with the mongrel_rails start -d command When I try to start the same app installed as a service I get the following error: "There was a problem starting the service: The service did not respond to the start or control request in a timely fashion." The debug.log isn''t even created. These are the commands I have issued: $ mongrel_rails_service install -n intrarails -d "New intranet" -r c:\rails\intra -e production -p 3000 $ mongrel_rails_service start -n intrarails When I go into the Services-application I can see that the service is trying to start the app with this command: "c:/ruby/bin/ruby.exe" "c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4-mswin32/bin/mongrel_rails_s vc" service -r "c:/rails/intra" -e production -p 3000 I''ve checked the paths and they are all correct. Does anyone have any idea of what''s wrong? Is there a verbose mode I can activate to get more debug output? Gabriel Falkenberg
Luis Lavena
2006-May-10 13:51 UTC
[Mongrel] Problems starting mongrel running a rails app as a service
Hello Gabriel, have you tried first running plain mongrel_rails without the -d option? That will lock your console to the output generate by the running rails, but is very useful for debug purposes. Try that and if it works, something is wrong in the service stuff. Currently the -d (daemonize) is not available on win32. Later, Luis On 5/10/06, Gabriel Falkenberg <gabriel.falkenberg at fek.uu.se> wrote:> Hi there > > I have a rails app that I want to run on a Win 2k server running Mongrel. > I''ve downloaded the latest version and the win32-service gem and can run it > with the mongrel_rails start -d command > > When I try to start the same app installed as a service I get the following > error: > > "There was a problem starting the service: > The service did not respond to the start or control request in a timely > fashion." > > The debug.log isn''t even created. These are the commands I have issued: > > $ mongrel_rails_service install -n intrarails -d "New intranet" -r > c:\rails\intra -e production -p 3000 > $ mongrel_rails_service start -n intrarails > > When I go into the Services-application I can see that the service is trying > to start the app with this command: > > "c:/ruby/bin/ruby.exe" > "c:/ruby/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4-mswin32/bin/mongrel_rails_s > vc" service -r "c:/rails/intra" -e production -p 3000 > > I''ve checked the paths and they are all correct. > > Does anyone have any idea of what''s wrong? Is there a verbose mode I can > activate to get more debug output? > > Gabriel Falkenberg > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
Gabriel Falkenberg
2006-May-10 15:02 UTC
[Mongrel] Problems starting mongrel running a rails app as aservice
> Hello Gabriel, > > have you tried first running plain mongrel_rails without the -d option?Yes, they both work with the difference that with -d it prints a message stating that -d isn''t supported on Windows which I guess the service-stuff is supposed to make up for. I''m gonna try to make a minimal daemon that I can install as a service on my client-machine to see if I can also get it to work on the server. If I can make that work then maybe I can make mongrel work on the server too. /Gabriel Falkenberg
Luis Lavena
2006-May-10 15:58 UTC
[Mongrel] Problems starting mongrel running a rails app as aservice
Gabriel, If the service timeout during startup is because your application needs more time to initialize, something that found quite common with rails. To pinpoint if the problem is related to mongrel services or rails, please: Create a emtpy rails application. start mongrel for it, and check the webpage (the rails properties one). Then install the service and run it. If everything start and run ok, thre is something during the load of the controllers and models that hang or halt and raises that error. Thank you and regards, Luis On 5/10/06, Gabriel Falkenberg <gabriel.falkenberg at fek.uu.se> wrote:> > Hello Gabriel, > > > > have you tried first running plain mongrel_rails without the -d option? > > Yes, they both work with the difference that with -d it prints a message > stating that -d isn''t supported on Windows which I guess the service-stuff > is supposed to make up for. > > I''m gonna try to make a minimal daemon that I can install as a service on my > client-machine to see if I can also get it to work on the server. If I can > make that work then maybe I can make mongrel work on the server too. > > /Gabriel Falkenberg > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
Gabriel Falkenberg
2006-May-11 07:34 UTC
[Mongrel] Problems starting mongrel running a rails app as a service (win 2k)
> To pinpoint if the problem is related to mongrel services or rails, > please: > > Create a emtpy rails application. > start mongrel for it, and check the webpage (the rails properties one). > Then install the service and run it. > If everything start and run ok, thre is something during the load of > the controllers and models that hang or halt and raises that error.Nice suggestion Luis, I hadn''t thought about that. It seems like there is something wrong with the services part cause even a fresh rails app which runs perfectly using just "mongrel_rails start" fails to start as a service with the same error message: There was a problem starting the service: The service did not respond to the start or control request in a timely fashion. I guess my question is, has anyone succeeded in running mongrel as a service (or any service using win32/service) using windows 2000? Thanks, Gabriel Falkenberg
Gabriel Falkenberg
2006-May-11 12:38 UTC
[Mongrel] Problems starting mongrel running a rails app as aservice (solved!)
Ok, I have solved the problem... That the log-files weren''t even created should have made me realize that the problem had to do with file-access permissions. When I started the app as a service it got other privileges than when I started it at the prompt and that was why the app didn''t start, because it couldn''t create the log files... Maybe a troubleshooting section should be added to the Win32 Howto describing this problem? Something like: Troubleshooting When running Mongrel as a service you have to think about what permissions the service is going to get. If the service doesn''t have write-access to the log-files in the gem''s bin-directory (something like: C:\ruby\lib\ruby\gems\1.8\gems\mongrel-0.3.12.4-mswin32\bin) it won''t be able to start and you won''t get any log files that tells you why. If this is the case, trying to start the service will give you the following error message:> There was a problem starting the service: > The service did not respond to the start or control request in a timely > fashion.Also remember that rails needs to be able to write to certain directories like the log-directory (railsapp/log) and the directories beneath railsapp/tmp/ What do you think? /Gabriel Falkenberg> -----Ursprungligt meddelande----- > Fr?n: mongrel-users-bounces at rubyforge.org [mailto:mongrel-users- > bounces at rubyforge.org] F?r Gabriel Falkenberg > Skickat: den 11 maj 2006 09:35 > Till: mongrel-users at rubyforge.org > ?mne: Re: [Mongrel] Problems starting mongrel running a rails app as > aservice (win 2k) > > > To pinpoint if the problem is related to mongrel services or rails, > > please: > > > > Create a emtpy rails application. > > start mongrel for it, and check the webpage (the rails properties one). > > Then install the service and run it. > > If everything start and run ok, thre is something during the load of > > the controllers and models that hang or halt and raises that error. > > Nice suggestion Luis, I hadn''t thought about that. It seems like there is > something wrong with the services part cause even a fresh rails app which > runs perfectly using just "mongrel_rails start" fails to start as a > service > with the same error message: > > There was a problem starting the service: > The service did not respond to the start or control request in a timely > fashion. > > I guess my question is, has anyone succeeded in running mongrel as a > service > (or any service using win32/service) using windows 2000? > > Thanks, > Gabriel Falkenberg > > > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users
Luis Lavena
2006-May-11 13:02 UTC
[Mongrel] Problems starting mongrel running a rails app as a service (win 2k)
On 5/11/06, Gabriel Falkenberg <gabriel.falkenberg at fek.uu.se> wrote: [snip]> Nice suggestion Luis, I hadn''t thought about that. It seems like there is > something wrong with the services part cause even a fresh rails app which > runs perfectly using just "mongrel_rails start" fails to start as a service > with the same error message: > > There was a problem starting the service: > The service did not respond to the start or control request in a timely > fashion. > > I guess my question is, has anyone succeeded in running mongrel as a service > (or any service using win32/service) using windows 2000? >Excelent question Gabriel!, we just need to figure this out ;-) win2k you''re talking about, is Pro or Server? Also, inside the win32-service gem (C:\Ruby\lib\ruby\gems\1.8\gems\win32-service-0.5.0-mswin32) there is a file called daemon_test.rb in examples folder. We will use that to trace the root of the problem: In a console, chdir to that folder and do:>ruby daemon_test.rb installThat is supposed to install a AbbaSvc test service (later you could remove it). Now, try starting it using the ruby command (ruby daemon_test.rb start) and also "net start abbasvc" If it fails, something is wrong (or different) in how services work under win2k. If not fails, that means something is wrong with my brain and need to fix it ;-) In that case, I''ll doing a rewrite of the win32 service stuff for mongrel to solve other issues too, targeting 0.4 release (as Zed annouced this monday). I''ll like have you as test user if you could/want so we also could mark win2k as compatible/tested platform. Later,
Luis Lavena
2006-May-11 13:22 UTC
[Mongrel] Problems starting mongrel running a rails app as aservice (solved!)
Oh, on personal ramblings: I hate the way gmail sort my inbox! See my comments below. On 5/11/06, Gabriel Falkenberg <gabriel.falkenberg at fek.uu.se> wrote:> Ok, I have solved the problem... That the log-files weren''t even created > should have made me realize that the problem had to do with file-access > permissions. When I started the app as a service it got other privileges > than when I started it at the prompt and that was why the app didn''t start, > because it couldn''t create the log files... >I guess I will need to check for win2k, but for XP the context where each service gets created and runs under SYSTEM account, which often have wide privileges around files. You could change that behavior from the Services applet in administrative tools.> > When running Mongrel as a service you have to think about what permissions > the service is going to get. If the service doesn''t have write-access to the > log-files in the gem''s bin-directory (something like: > C:\ruby\lib\ruby\gems\1.8\gems\mongrel-0.3.12.4-mswin32\bin) it won''t be > able to start and you won''t get any log files that tells you why. >[snip]> Also remember that rails needs to be able to write to certain directories > like the log-directory (railsapp/log) and the directories beneath > railsapp/tmp/ >The logs file aren''t created inside the gem, instead they will get created in the log folder of the rails application. Please check the permissions of these folders too.> > What do you think? >As my previous email, I''ll suggest test the daemon_test.rb shiped with win32-service. That writes information to c:\test.log, which require privileges. Please check that and let me know on which account the service start (you could check with task manager). Anyway, glad to hear that it worked ;-) Later, Luis Lavena