I use Redmine on Mongrel as a project manager, and I use a batch file (start-redmine.bat) to run redmine in mongrel. There are two problems with my setup: 1. I have IIS running on a server that occupies the HTTP port (80) 2. The start-redmine.bat parameter should be checked periodically to make sure it was stopped after a reboot caused by the Windows Update service.
for the first problem, I have no choice but to run mongrel on a port, such as 3000, and for the second problem I need to create a Windows service that automatically starts in the background when windows start; and here is the problem!
There are at least 3 ways to start redmine as a service that I know of; none of them can satisfy the idea of ββperformance on this issue. can you read about them on how to configure the rails (redmine) application to run as a service on Windows?
I tried them all. The easiest way to configure such a service is to use the mongrel_service approach; in 3 lines you are done. but performance is much lower than running this batch file ...
Now I want to show you my approach:
First, suppose we installed ruby ββin c: \ ruby, and we issued the gem install mongrel command to get the mongrell gem installed in c: \ ruby ββ\ bin Also, suppose we installed Redmine into a folder like c: \ redmine ; and we have a ruby ββpath (i.e. c: \ ruby ββ\ bin) in our PATH environment variable.
Now download and install the Windows NT Resource Kit tools from the Microsoft website. Open the command line tool that comes with the resource kit (from the Start menu). Use instsrv to install the fake Redmine service with the following command:
"[path-to-instsrv.exe] \ instsrv" Redmine "[path-to-srvany.exe] \ srvany.exe"
in my case (this is the default case), it was something like this:
"C: \ Program Files \ Windows Resource Kits \ Tools \ instsrv" Redmine "C: \ Program Files \ Windows Resource Kits \ Tools \ srvany.exe"
Now create a batch file. Open the notebook and paste these instructions into it, and then save it as " c: \ redmine \ start-redmine.bat "
@echo off
cd c: \ redmine \
mongrel_rails start -a 0.0.0.0 -p 3000 -e production
Now we need to configure this fictitious service that we created earlier. SEE WHAT YOU DO HERE OR YOU CAN CORRUPT YOUR WINDOWS . To configure this service, open the Windows registry editor (Start β Run β regedit) and go to this node:
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Redmine
Right-click on the "Redmine" node and using the context menu, create a new key named Parameters (New β Key) Right-click on "Parameters" and create a String Value property called Application . Do it again and create another string value called AppParameters . Now double-click "Application" and place cmd.exe in the "Data Values" section. Then double-click "AppParameters" and put / C "C: \ redmine \ start-redmine.bat" in the data section of the data.
We are done! issue this command to start redmine on mongrel as a service:
net start redmine
Edit: If you intend to use Redmine email services and you have an antivirus such as McAfee, make sure you tell the antivirus to allow rubies to send emails or you will not receive the email service.