
RedmineをこれまでRubyに付属しているWEBrickを使って運用していたのだが、サーバーを再起動するたびにいちいちログインしてWEBrickを起動させなくてはならないのがイヤになった。
なんでもMongrelというWebサーバーを利用すればWindowsのサービスとして動かすことができるらしい。
早速チャレンジ。
1. まずは、Mongrelのインストール。
gemで一発。
D:\tmp>gem install mongrel
Bulk updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (i386-mswin32)
1. mongrel 1.1.1 (ruby)
2. mongrel 1.1.1 (jruby)
3. mongrel 1.1.1 (mswin32)
4. mongrel 1.1 (mswin32)
5. mongrel 1.1 (ruby)
6. mongrel 1.1 (jruby)
7. Skip this gem
8. Cancel installation
> 3
Install required dependency gem_plugin? [Yn]
Install required dependency cgi_multipart_eof_fix? [Yn]
Successfully installed mongrel-1.1.1-mswin32
Successfully installed gem_plugin-0.2.3
Successfully installed cgi_multipart_eof_fix-2.5.0
Installing ri documentation for mongrel-1.1.1-mswin32...
Installing ri documentation for gem_plugin-0.2.3...
Installing ri documentation for cgi_multipart_eof_fix-2.5.0...
Installing RDoc documentation for mongrel-1.1.1-mswin32...
Installing RDoc documentation for gem_plugin-0.2.3...
Installing RDoc documentation for cgi_multipart_eof_fix-2.5.0...
2. いつもどおりredmineを起動してみると、サーバーがMongrelに変わっている。
とりあえず成功らしい。レスポンスも心持ち速くなった感じ。
D:\redmine>ruby script/server -e production
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with production environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. INT => stop (no restart).
** Mongrel 1.1.1 available at 0.0.0.0:3000
** Use CTRL-C to stop.
3. 続いてWindowsのサービスとして動かすためにmongrel_serviceをインストールする。
これまたgemで一発。のはずがなぜかエラー・・・
D:\tmp>gem install mongrel_service
Select which gem to install for your platform (i386-mswin32)
1. mongrel_service 0.3.3 (mswin32)
2. mongrel_service 0.3.2 (mswin32)
3. mongrel_service 0.3.1 (mswin32)
4. mongrel_service 0.1 (ruby)
5. Skip this gem
6. Cancel installation
> 1
Install required dependency win32-service? [Yn]
Select which gem to install for your platform (i386-mswin32)
1. win32-service 0.6.0 (ruby)
2. win32-service 0.5.2 (ruby)
3. win32-service 0.5.2 (mswin32)
4. Skip this gem
5. Cancel installation
> 3
ERROR: While executing gem ... (NoMethodError)
undefined method `+' for nil:NilClass
原因を探ること小一時間、どうやらPROXYを設定しているとダメらしい・・・