0

I have successfully installed mongrel, mongrel_service, win-32 service and have also successfully installed the service on my computer and is starting successfully.

The major problem am having now is that, my application uses a bundle of gems so under normal circumstances mongrel_rails start will start with bundle exec. even though the service starts, mongrels does not start because am unable it has to start with bundle exec.

my question, how can I include bundle exec in the command that creates the windows service so that it will start mongrels with bundle?

is there any other way, perhaps including bundle exec in boot.rb or preinitializer.rb so that it will loaded automatically? am using rails 2.3.

The mongrel log is below

** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with production environment...
c:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:31:in
`setup': You have already activated mongrel 1.2.0.pre2, but your Gemfile
requires mongrel 1.2.0.pre2. Using bundle exec may solve this.
(Gem::LoadError)
  from
c:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler/runtime.rb:17:in
`setup'
  from**strong text**
c:/Ruby/lib/ruby/gems/1.8/gems/bundler-1.0.22/lib/bundler.rb:110:in
`setup'
  from c:/xxxxx/xxxxxx/config/../config/preinitializer.rb:17
  from c:/xxxxx/xxxxx/config/boot.rb:26:in `load'
  from c:/xxxxx/xxxxx/config/boot.rb:26:in `preinitialize'
  from c:/xxxxx/xxxxx/config/boot.rb:8:in `boot!'
  from c:/xxxxx/xxxxx/config/boot.rb:120
  from c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from c:/xxxxx/xxxxx/config/environment.rb:5
  from c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/../lib/mongrel/rails.rb:147:in
`rails'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:116:in
`cloaker_'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/../lib/mongrel/configurator.rb:149:in
`call'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/../lib/mongrel/configurator.rb:149:in
`listener'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:102:in
`cloaker_'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/../lib/mongrel/configurator.rb:50:in
`call'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/../lib/mongrel/configurator.rb:50:in
`initialize'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:86:in
`new'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:86:in
`run'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/../lib/mongrel/command.rb:210:in
`run'
  from
c:/Ruby/lib/ruby/gems/1.8/gems/mongrel-1.2.0.pre2-x86-mingw32/bin/mongrel_rails:282
  from c:/Ruby/bin/mongrel_rails:19:in `load'
  from c:/Ruby/bin/mongrel_rails:19
Matzi
  • 13,770
  • 4
  • 33
  • 50
  • 1
    possible duplicate of [Problem running Mongrel with Rails3 and Ruby 1.9.2](http://stackoverflow.com/questions/4020309/problem-running-mongrel-with-rails3-and-ruby-1-9-2) – Taryn East Sep 06 '12 at 04:01

1 Answers1

0

I have found a solution to this problem. The fact according to Luis Lavana is that mongrel_service is dead and now is a new product service_wrapper which makes installing of various staff as a service easily. Follow the process below

  1. download service_wrapper from https://github.com/luislavena/service_wrapper/downloads
  2. Copy the service_wrapper.exe from the bin folder of the downloaded service wrapper into a directory say C:\service_wrapper.
  3. create a configuration file for service_wrapper by opening any text editor and entering the following

; Service section, it will be the only section read by service_wrapper

[service]

;path to your ruby executable file

executable = C:\Ruby\bin\ruby.exe

;arguments for your ruby executable

arguments = C:\Ruby\bin\bundle exec mongrel_rails start -p 3000 -e development

;path your app directory

directory = C:\myapp

; Optionally specify a logfile where both STDOUT and STDERR of executable will ; be redirected. ; Please note that full path is also required.

logfile = C:\service_wrapper\service_wraper_log.log

  1. Save the text file with the extention ".conf" say "my_config.conf" into a directory say c:\service_wrapper

  2. open command prompt and type the following command to create a windows service:

sc create servicename binPath= "c:\service_wrapper\service_wrapper.exe c:\service_wrapper\my_config.conf" start= auto

(note the space after binPath= and start=)

  1. type net start servicename to start the service

  2. wait for a while, about 30sec for mongrel to start and you can open your app at localhost:3000.

Hope it helps someone.