ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server?

Added by Dies Koper at 2012-01-24 03:06 am

Hi,

I'm trying to install ChiliProject (3.0.0beta2) with Postgres 9 on Windows 2003/2008.
The basic installation went fine. Much easier than Redmine, big relief, very grateful!

I'd like to make ChiliProject accessible from Apache web server on a url like http://my-ip:80/chiliproject, as I have other tools installed that way (/jenkins, etc.), and run it as a Windows Service.

I'm not a Rails developer but I understand I need a Ruby supporting web server to run ChiliProject and Apache configured to forward requests to it.
What is the recommended Ruby web server on Windows and how can I configure it to run this way, as a Windows Service (without having to compile C code or install all kinds of Windows service toolkit)?

This is what I tried and found:

1. Thin worked fine, but I couldn't find an easy way to register it as a Windows Service.
2. Passenger seems highly recommended but needs a C compile environment to run on Windows. I don't want to go down that path.
3. Unicorn - Unix only?
4. Webrick - not supposed to use for production?
5. Mongrel - issues, see below. Mongrel hasn't seen a release in 4 years. Has it been replaced by one of the above?

Mongrel issues:
When registering mongrel as a service without the --prefix option, as follows, and fronting it with Apache, when accessing http://localhost/chiliproject the page is missing its stylesheets.

mongrel_rails service::install -N mongrel_chiliproject_3000 -p 3000 -e production -D "Mongrel serving ChiliProject on 3000" -c C:\ChiliProject\chiliproject-3.0.0beta2
sc config mongrel_chiliproject_3000 start= auto
net start mongrel_chiliproject_3000

I can see the issue in the rendered HTML: the paths in the hrefs don't start with /chiliproject so Apache doesn't know these requests need to be forwarded to port 3000.

<link href="/stylesheets/reset.css?1326912726" media="all" rel="stylesheet" type="text/css" />

When I add '--prefix /chiliproject' to the service::install command, mongrel won't even serve anything on port 3000. No error messages in the log except for:

  • Starting Mongrel listening at 0.0.0.0:3000
  • Starting Rails with production environment...
  • Mounting Rails at /chiliproject...
    NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
    Gem.source_index called from C:/Ruby/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.

Redmine has a relative_url_root option to set the prefix instead.
Is that the recommended way for ChiliProject?
Or configure mod_html on Apache to rewrite the urls?

Thanks!
Dies


Replies (12)

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Felix Schäfer at 2012-01-24 12:43 pm

Dies Koper wrote:

1. Thin worked fine, but I couldn't find an easy way to register it as a Windows Service.
2. Passenger seems highly recommended but needs a C compile environment to run on Windows. I don't want to go down that path.

I didn't even know It worked under windows now…

3. Unicorn - Unix only?
4. Webrick - not supposed to use for production?

Indeed not suited for production, at least not more than 1-3 users…

5. Mongrel - issues, see below. Mongrel hasn't seen a release in 4 years. Has it been replaced by one of the above?

Not sure about that, I'm not that firm with serving ruby/rails on windows, sorry.

Mongrel issues:
When registering mongrel as a service without the --prefix option, as follows, and fronting it with Apache, when accessing http://localhost/chiliproject the page is missing its stylesheets.

mongrel_rails service::install -N mongrel_chiliproject_3000 -p 3000 -e production -D "Mongrel serving ChiliProject on 3000" -c C:ChiliProjectchiliproject-3.0.0beta2
sc config mongrel_chiliproject_3000 start= auto
net start mongrel_chiliproject_3000

I can see the issue in the rendered HTML: the paths in the hrefs don't start with /chiliproject so Apache doesn't know these requests need to be forwarded to port 3000.

<link href="/stylesheets/reset.css?1326912726" media="all" rel="stylesheet" type="text/css" />

When I add '--prefix /chiliproject' to the service::install command, mongrel won't even serve anything on port 3000. No error messages in the log except for:

  • Starting Mongrel listening at 0.0.0.0:3000
  • Starting Rails with production environment...
  • Mounting Rails at /chiliproject...
    NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
    Gem.source_index called from C:/Ruby/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.

With the --prefix /chiliproject the app will live under http://localhost:3000/chiliproject instead of http://localhost:3000/. IIRC you don't need that for a reverse proxy setup but need to make sure apache/your frontend sends the right http headers alongside the request.

Redmine has a relative_url_root option to set the prefix instead.
Is that the recommended way for ChiliProject?

That should work too, should we ever change it there'll be an upgrade path :-)

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Dies Koper at 2012-01-24 10:27 pm

Hi Felix,

Thank you for your reply.

What are the right http headers that Apache should send along with the request?
I'd be quite happy to have the ruby web server run on http://localhost:3000 instead of http://localhost:3000/chiliproject if I could somehow get ChiliProject to insert the "/chiliproject" in its href tags for Apache to understand where to send the requests.
I suppose it wouldn't be hard to have Apache inject an http header in the redirected requests to tell ChiliProject what path to insert.

Cheers,
Dies

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Dies Koper at 2012-01-27 04:47 am

I am one step closer:

Redmine has a relative_url_root option, called Redmine::Utils::relative_url_root or ActionController::Base.relative_url_root according to their wiki.
What worked for me with ChiliProject 3.0.0-beta2 was config.action_controller.relative_url_root (rails/rake version dependent).

  1. in config/additional_environment.rb
    config.action_controller.relative_url_root = '/chiliproject'

Then started Thin: thin -e production start (i.e. without --prefix option).
Now ChiliProject is accessible on http://localhost:3000/chiliproject, and through Apache on http://localhost/chiliproject

My Apache settings are:

<Location /chiliproject>
ProxyPass http://localhost:3000
ProxyPassReverse http://localhost:3000
ProxyPassReverseCookiePath / /chiliproject
</Location>

One issue though:
On the login page, after typing in the user and password and clicking on Login, I get the Apache welcome page on http://localhost.
Could it be that ChiliProject is not using relative_url_root when redirecting the page after login?
When I reopen http://localhost/chiliproject I am logged in and navigation to all other pages (I clicked all links I could fine) works fine. It seems to be just the redirect after login that's not working.

Here's the Thin log:

Processing WelcomeController#index (for 127.0.0.1 at 2012-01-27 12:31:00) [GET]
Parameters: {"action"=>"index", "controller"=>"welcome"}
Rendering template within layouts/base
Rendering welcome/index
Completed in 109ms (View: 47, DB: 16) | 200 OK [http://localhost/]
47, DB: 16) | 200 OK [http://localhost/]

Processing AccountController#login (for 127.0.0.1 at 2012-01-27 12:31:08) [POST]

Parameters: {"back_url"=>"http%3A%2F%2Flocalhost%2F", "action"=>"login", "auth
enticity_token"=>"x9I/afVpaMxZnIE9UPvCofj559Io4EJld2oSbOZWn50=", "username"=>"ad
min", "controller"=>"account", "password"=>"[FILTERED]", "login"=>"Login"}
Redirected to http://localhost/
Completed in 31ms (DB: 0) | 302 Found [http://localhost/login]

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Felix Schäfer at 2012-01-29 05:58 pm

Why not just have CP running on the subpath you want to have it on your main domain, i.e. something like:

ProxyPass http://localhost:3000/chili
ProxyPassReverse http://localhost:3000/chili

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Dies Koper at 2012-01-30 10:19 am

I wouldn't mind doing that if I could get that to work. What combination of settings would I need?

I tried:

1. Apache as you suggested, with matching relative_url_root: http://localhost/chiliproject returns login page properly, but shows Apache welcome page after login.

2. Apache as you suggested, without relative_url_root set: http://localhost/chiliproject returns CP login page without style sheets. HTML code includes:

<link href="/stylesheets/jstoolbar.css?1326912715" media="screen" rel="stylesheet" type="text/css" />
<link href="http://localhost/news.atom" rel="alternate" title="ChiliProject: Latest news" type="application/atom+xml" />

Such urls won't be forwarded correctly by Apache.

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Felix Schäfer at 2012-02-11 08:49 pm

I meant

ProxyPass http://localhost:3000/chiliproject
ProxyPassReverse http://localhost:3000/chiliproject

with the relative_url_root and/or prefix options set.

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Dies Koper at 2012-02-13 01:34 am

Thanks! It now works!

What I needed was all of the three below:
  1. ProxyPass & ProxyPassReverse settings as above;
  2. config.action_controller.relative_url_root setting in config/additional_environment.rb;
  3. --prefix option when starting Thin.

I have also been able to register and start Thin as a Windows Service (just stopping doesn't work).

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by scott b at 2012-04-17 09:20 pm

As a layman, how can I do this too?

I am not a programmer, but if the steps can be explained (to layman's level of understanding) then I want to follow and put CP on Apache 2.2. (Apache2.2 is already installed and working)

What are the steps, a,b,c...?

Right now CP is working on webrick.

(environment = Windows 7 Professional 64 bit, rubyinstaller-1.9.3-p125, MySQL 5.5.22, phpMyAdmin-3.5.0, php-5.3.5-Win32-VC6-x86 )

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Dies Koper at 2012-04-18 06:32 am

I was meaning to update the relevant installation wiki pages with my notes.
For the Apache part, on Windows, assuming you want to access CP under a sub-uri (i.e. http://ip/chili)

1. Install Thin:

gem install thin

2. Add the following line to <CP_install_dir>\config\additional_environment.rb:

config.action_controller.relative_url_root = '/chili'

3. Start Thin and test it by accessing http://localhost:3000/chili:

thin -e production -a 127.0.0.1 --prefix /chili start

4. Add to Apache's httpd.conf:

#forward all requests for http://ip/chili to the Thin instance on port 3000
# Thin started with --prefix /chili option

<IfModule !mod_proxy.c>
    LoadModule proxy_module lib/modules/mod_proxy.so
</IfModule>
<IfModule !mod_proxy_http.c>
    LoadModule proxy_http_module lib/modules/mod_proxy_http.so
</IfModule>

<Location /chili>
    ProxyPass http://localhost:3000/chili
    ProxyPassReverse http://localhost:3000/chili
</Location>

5. Restart Apache and test it by accessing http://localhost/chili

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by scott b at 2012-04-18 06:06 pm

Dies Koper,

Thank you for replying. It is generous of you to give help. THANK YOU!!!

After the first instruction it gives errors, you can see below near the start and the end of the following. Do you know how I can get past the error?

(environment: Microsoft Windows 7 Pro 64bit, MySQL 5.5.23, rubyinstaller-1.9.3-p125, chiliproject-3.1.0, ImageMagick-6.7.6-5-Q16-windows, phpMyAdmin-3.5.0, php-5.3.5-Win32-VC6-x86, Apache httpd-2.2.22-win32-x86-no_ssl.msi)

C:\Users\Scott>cd C:\webserver\chiliproject

C:\webserver\chiliproject>gem install thin
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
h2. ERROR: Error installing thin:
ERROR: Failed to build gem native extension.

'C:/webserver/Ruby193/bin/ruby.exe extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
checking for main() in -lssl... no
creating Makefile

make
generating rubyeventmachine-i386-mingw32.def
compiling binder.cpp
cc1plus.exe: warning: command line option "-Wdeclaration-after-statement" is val
id for C/ObjC but not for C++
cc1plus.exe: warning: command line option "-Wimplicit-function-declaration" is v
alid for C/ObjC but not for C++
In file included from project.h:137:0,
from binder.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
from binder.cpp:20:
em.h:91:47: warning: type qualifiers ignored on function return type
em.h:92:76: warning: type qualifiers ignored on function return type
em.h:93:56: warning: type qualifiers ignored on function return type
em.h:95:57: warning: type qualifiers ignored on function return type
em.h:96:60: warning: type qualifiers ignored on function return type
em.h:97:58: warning: type qualifiers ignored on function return type
em.h:98:55: warning: type qualifiers ignored on function return type
em.h:99:36: warning: type qualifiers ignored on function return type
em.h:101:47: warning: type qualifiers ignored on function return type
em.h:106:42: warning: type qualifiers ignored on function return type
em.h:123:45: warning: type qualifiers ignored on function return type
em.h:132:36: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
from binder.cpp:20:
eventmachine.h:45:61: warning: type qualifiers ignored on function return type
eventmachine.h:46:112: warning: type qualifiers ignored on function return type
eventmachine.h:47:69: warning: type qualifiers ignored on function return type
eventmachine.h:49:73: warning: type qualifiers ignored on function return type
eventmachine.h:62:75: warning: type qualifiers ignored on function return type
eventmachine.h:63:74: warning: type qualifiers ignored on function return type
eventmachine.h:64:77: warning: type qualifiers ignored on function return type
eventmachine.h:65:41: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
from binder.cpp:20:
eventmachine.h:99:60: warning: type qualifiers ignored on function return type
eventmachine.h:100:58: warning: type qualifiers ignored on function return type
eventmachine.h:102:60: warning: type qualifiers ignored on function return type
eventmachine.h:105:41: warning: type qualifiers ignored on function return type
compiling cmain.cpp
cc1plus.exe: warning: command line option "-Wdeclaration-after-statement" is val
id for C/ObjC but not for C++
cc1plus.exe: warning: command line option "-Wimplicit-function-declaration" is v
alid for C/ObjC but not for C++
In file included from project.h:137:0,
from cmain.cpp:20:
binder.h:35:34: warning: type qualifiers ignored on function return type
In file included from project.h:138:0,
from cmain.cpp:20:
em.h:91:47: warning: type qualifiers ignored on function return type
em.h:92:76: warning: type qualifiers ignored on function return type
em.h:93:56: warning: type qualifiers ignored on function return type
em.h:95:57: warning: type qualifiers ignored on function return type
em.h:96:60: warning: type qualifiers ignored on function return type
em.h:97:58: warning: type qualifiers ignored on function return type
em.h:98:55: warning: type qualifiers ignored on function return type
em.h:99:36: warning: type qualifiers ignored on function return type
em.h:101:47: warning: type qualifiers ignored on function return type
em.h:106:42: warning: type qualifiers ignored on function return type
em.h:123:45: warning: type qualifiers ignored on function return type
em.h:132:36: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
from cmain.cpp:20:
eventmachine.h:45:61: warning: type qualifiers ignored on function return type
eventmachine.h:46:112: warning: type qualifiers ignored on function return type
eventmachine.h:47:69: warning: type qualifiers ignored on function return type
eventmachine.h:49:73: warning: type qualifiers ignored on function return type
eventmachine.h:62:75: warning: type qualifiers ignored on function return type
eventmachine.h:63:74: warning: type qualifiers ignored on function return type
eventmachine.h:64:77: warning: type qualifiers ignored on function return type
eventmachine.h:65:41: warning: type qualifiers ignored on function return type
In file included from project.h:145:0,
from cmain.cpp:20:
eventmachine.h:99:60: warning: type qualifiers ignored on function return type
eventmachine.h:100:58: warning: type qualifiers ignored on function return type
eventmachine.h:102:60: warning: type qualifiers ignored on function return type
eventmachine.h:105:41: warning: type qualifiers ignored on function return type
cmain.cpp:98:71: warning: type qualifiers ignored on function return type
cmain.cpp:109:122: warning: type qualifiers ignored on function return type
cmain.cpp:119:79: warning: type qualifiers ignored on function return type
cmain.cpp:129:83: warning: type qualifiers ignored on function return type
cmain.cpp:260:85: warning: type qualifiers ignored on function return type
cmain.cpp:270:84: warning: type qualifiers ignored on function return type
cmain.cpp:280:88: warning: type qualifiers ignored on function return type
cmain.cpp:290:51: warning: type qualifiers ignored on function return type
cmain.cpp:300:70: warning: type qualifiers ignored on function return type
cmain.cpp:320:55: warning: type qualifiers ignored on function return type
cmain.cpp:546:70: warning: type qualifiers ignored on function return type
cmain.cpp:669:68: warning: type qualifiers ignored on function return type
cmain.cpp: In function 'int evma_send_file_data_to_connection(long unsigned int,
const char*)':

cmain.cpp:752:6: error: cannot convert 'stat' to '_stati64*' for argument '2' to 'int _fstati64(int, _stati64*)'
make: ** [cmain.o] Error 1

Gem files will remain installed in C:/webserver/Ruby193/lib/ruby/gems/1.9.1/gems
/eventmachine-0.12.10 for inspection.
Results logged to C:/webserver/Ruby193/lib/ruby/gems/1.9.1/gems/eventmachine-0.1
2.10/ext/gem_make.out

C:\webserver\chiliproject>

RE: recommendation for ruby server to run chiliproject on when running on Windows, and fronted by Apache web server? - Added by Dies Koper at 2012-04-19 12:18 am

You're welcome. It's thanks to the generosity of others that I could install it myself!

Apologies for missing a crucial step. Before installing the thin gem, after installing Ruby:

0. Install Ruby DevKit (see Development Kit on http://rubyinstaller.org/downloads) into e.g. C:\Ruby\DevKit and run:

cd C:\Ruby\DevKit
ruby dk.rb init
ruby dk.rb install

(1-12/12)