Arrumaco
2011-Jul-30 00:30 UTC
Setting rails 3 with WEBrick Server as a Service in a WinSrv 2003
Looking for a solution to set my new app (a clone from spree) as a service to demo purpouses, in our WebServer I''ve found several options to setup the service and configure the Win registry with options that didn''t work because the parameters to rails 3 are different that those in rails 2. What I''d found: Download and install the Windows NT Resource Kit from http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en Create the service running: path\INSTSRV.EXE your_service_name path\SRVANY.EXE in my case path is: "C:\Program Files\Windows NT Resource Kit\INSTSRV.EXE" redmine_webrick "C:\Program Files\Windows NT Resource Kit\SRVANY.EXE" could be also C:\Program Files\Windows Resource Kits\Tools\. Run regedit (Start -> Run -> regedit) Add the following registry key if it''s not already there: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services \your_service_name Right click on this registry key and select New -> Key. Name it Parameters. Add two values to the Parameters key. Right click on the parameters key, New -> String Value. Name it Application. Now create another one named AppParameters. Give them the following values: Application: PathToRuby.exe, eg. C:\ruby\bin\Ruby.exe AppParameters: C:\RUBYAPP\script\server -e production, where RUBYAPP is the directory that contains the redmine website. Example: C:\redmine\script\server -p 2000 -e production (-p indicates the port webrick will be listening to, and -e the environment used) Now you can go to Administrative Tools -> Services. There you can start your service (the one with name your_service_name) and test whether or not it is working properly. It should be noted that the service will be marked as started prior to WEBrick finishing its boot procedure. You should give it 1min or so before trying to hit the service to verify that it is working correctly. from: http://stackoverflow.com/questions/877943/how-to-configure-a-rails-app-redmine-to-run-as-a-service-on-windows It failed to start the service and show the page in my localhost browser, the solution was: set 3 parameters instead of 2 as was suggested in the original article Application=c:\ruby192\bin\ruby2.exe (in my case - the location of ruby exec) AppDirectory = d:\apps\spree_demo (in my case, the location of the rails app) AppParameters = c:\ruby192\bin\rails s -p 3000 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.