Redmineをサービスから起動する

メモ:  Category:windows

Windows環境でRedmineをサービスで起動するよう設定します。

サービスで実行するために必要なもの

  • Mongrel
  • win32-service (>=0.5.2.<0.6.0)
  • mongrel_service(0.3.4)

インストール

Webrickの代わりとなるMongrelを使用するとWindowsのサービスに登録して起動できるということなのでMongrelをインストールします。

C:\>gem install mongrel

Successfully installed gem_plugin-0.2.3
Successfully installed cgi_multipart_eof_fix-2.5.0
Successfully installed mongrel-1.1.5-x86-mswin32-60
3 gems installed
Installing ri documentation for gem_plugin-0.2.3...
Installing ri documentation for cgi_multipart_eof_fix-2.5.0...
Installing ri documentation for mongrel-1.1.5-x86-mswin32-60...
Installing RDoc documentation for gem_plugin-0.2.3...
Installing RDoc documentation for cgi_multipart_eof_fix-2.5.0...
Installing RDoc documentation for mongrel-1.1.5-x86-mswin32-60...

次にmongrel_serviceが最新(2008/12/15現在)のwin32-service(0.6.1)では動作しないため、win32-serviceの0.5.2をインストールします。

C:\>gem install win32-service -v 0.5.2

Successfully installed win32-service-0.5.2-x86-mswin32
1 gem installed
Installing ri documentation for win32-service-0.5.2-x86-mswin32...
Installing RDoc documentation for win32-service-0.5.2-x86-mswin32...

mongrel_serviceをインストールします。

C:\>gem install mongrel_service -r

Successfully installed mongrel_service-0.3.4-x86-mswin32
1 gem installed
Installing ri documentation for mongrel_service-0.3.4-x86-mswin32...
Installing RDoc documentation for mongrel_service-0.3.4-x86-mswin32...

必要なパッケージのインストールが完了したら、Redmineをサービスへ登録します。

C:\>mongrel_rails service::install -N "Redmine"
    -c c:\htdocs\redmine -p 3000 -e production

** Copying native mongrel_service executable...
Mongrel service 'Redmine' installed as 'Redmine'.

引数の-Nはサービス名、-cはRailsのアプリケーションの場所(ここでは、Redmineのインストール先)、-pはポート番号、-eはモードになります。

詳しくは、Win32 - Mongrel -Trac参照

自動起動の設定とMySQLとの依存関係を設定します。

c:\> sc config Redmine start= auto depend= MySql

以上の設定でRedmineがサービスから起動するようになります。

bluenote by BBB