2012-09-05 31 views
0

我已成功安裝雜種,mongrel_service,贏得-32服務 和還成功地安裝在我的計算機上的服務,是 成功啓動。Mongrel_service和打捆

現在我遇到的主要問題是,我的應用程序使用的 寶石捆綁所以一般情況下mongrel_rails開始束EXEC開始。即使服務啓動,mongrels也不會啓動 ,因爲我無法啓動bundle exec

我的問題,我怎麼能在創建 windows服務的命令中包含bundle exec,以便它會啓動mongrels?

是否有其他方法,或許包括boot.rb中的bundle exec或preinitializer.rb以便它會自動加載?我正在使用導軌 2.3。

的雜種日誌低於

** 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 
+1

[使用Rails3和Ruby 1.9.2運行Mongrel時出現問題](http://stackoverflow.com/questions/4020309/problem-running-mongrel-with-rails3-and-ruby-1-9-2 ) –

回答

0

我已經找到了解決這一問題。根據路易斯拉瓦納的事實,mongrel_service已經死亡,現在是一個新產品service_wrapper,可以輕鬆地將各種員工安裝爲服務。請按照以下

  1. 下載service_wrapper過程從https://github.com/luislavena/service_wrapper/downloads
  2. 複製service_wrapper.exe從下載的服務封裝到一個目錄的bin文件夾說C:\ service_wrapper
  3. 通過打開任何文本編輯器,並輸入創建service_wrapper一個配置文件下面

;服務部分,這將是由service_wrapper閱讀的唯一部分

[服務]

;路徑到你的紅寶石可執行文件

可執行= C:\紅寶石\ BIN \紅寶石。EXE

;爲您紅寶石可執行文件的參數

參數= C:\紅寶石\ BIN \束EXEC mongrel_rails開始-p 3000 -e發展

;路徑您的應用程序目錄

目錄= C:\ MyApp的

;可選地指定一個日誌文件,其中可執行文件的STDOUT和STDERR將爲 ;被重定向。 ;請注意,完整路徑也是必需的。

日誌文件= C:\ service_wrapper \ service_wraper_log.log

  1. 保存有進一步擴展文本文件 「的.conf」「my_config.conf」到一個目錄例如c :\ service_wrapper

  2. 打開命令提示符並鍵入以下命令以創建Windows服務:

SC創建服務名binPath = 「C:\ service_wrapper \ service_wrapper.exe C:\ service_wrapper \ my_config.conf」 開始=自動

(注意後面的空格binPath =開始=

  1. 類型網絡啓動服務名啓動該服務

  2. 等待一段時間,大約30秒讓雜種開始,你可以在localhost:3000打開你的應用程序。

希望它可以幫助別人。