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.
Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service
Added by Dies Koper at 2012-02-14 01:17 am
I was contacted offline for help with installing CP on Windows 2008 as a Windows Service.
I'll post my reply here to share:
I do have two unresolved issues:¶
- When I tried installing Magick I got some errors when running bundle install. I can’t remember what, but I decided to exclude it for now (not even sure I need it anyway).
- I can’t stop Thin as a Windows service.
Here are my notes (steps based on this page):¶
- Install Ruby (I downloaded rubyinstaller-1.8.7-p352.exe) in C:\Ruby\Ruby187, tick Add Ruby executable to your PATH
- Install Ruby DevKit (I downloaded DevKit-tdm-32-4.5.2-20111229-1559-sfx) in C:\Ruby\DevKit, run:
ruby dk.rb init ruby dk.rb install gem update --system gem install bundler set PATH=%PATH%;c:\Ruby\DevKit\bin
- Unzip ChiliProject archive to C:\ChiliProject (C:\ChiliProject\chiliproject-3.0.0) and cd to it. The following is for postgres, so will be different for mysql is that’s what you use.
bundle install --without=test sqlite mysql2 mysql openid rmagick
- Disable mysql and enable postgres entry for production in config/database.yml (copied and edited from database.yml.example):
production: adapter: postgresql database: chiliproject host: localhost port: 5432 username: chiliproject password: my_password encoding: utf8
- Create database for CP
psql -U postgres -h localhost -p 5432 CREATE ROLE chiliproject LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity'; CREATE DATABASE chiliproject WITH ENCODING='UTF8' OWNER=chiliproject;
- Populate database
set RAILS_ENV=production bundle exec rake generate_session_store bundle exec rake db:migrate bundle exec rake redmine:load_default_data
- Now test with (to make sure all steps so far worked – access on http://localhost:3000 ):
bundle exec ruby script/server -e production
- Production (using Thin):
I needed it accessible under http://localhost/chili using Apache and had to configure CP and Thin to work under http://localhost:3000/chili. If you don’t have this requirement, don’t perform these two steps.
On CP’s side, I created a additional_environment.rb file in CP’s config directory with the following line:
config.action_controller.relative_url_root = '/chili'
On Thin’s side, I set the --prefix option (see below).
gem install thin
- To test if Thin is working – access on http://localhost:3000/chili :
thin -e production -a 127.0.0.1 --prefix /chili start
- To register as Windows service, I downloaded winsw-1.9-bin.exe from http://kenai.com/projects/winsw.
- Extracted and renamed executable to C:\ChiliProject\ChiliProject-Thin-wrapper.exe.
- Created ChiliProject-Thin-wrapper.xml in C:\ChiliProject with the following content:
<service> <id>ChiliProjectOnThin</id> <name>ChiliProjectOnThin</name> <description>ChiliProject on Thin web server</description> <executable>c:\Ruby\ruby187\bin\rubyw.exe</executable> <logpath>C:\ChiliProject</logpath> <logmode>roll</logmode> <startargument>C:/Ruby/Ruby187/bin/thin -c C:\ChiliProject\chiliproject-3.0.0 -e production --prefix /chili -a 127.0.0.1 start</startargument> <stopargument>C:/Ruby/Ruby187/bin/thin -c C:\ChiliProject\chiliproject-3.0.0 stop</stopargument> </service>
- Register and start the Windows service:
cd C:\ChiliProject ChiliProject-Thin-wrapper.exe install ChiliProject-Thin-wrapper.exe start
- To test again if Thin is working – access on http://localhost:3000/chili, reboot the OS and it should be accessible again.
Replies (10)
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Felix Schäfer at 2012-02-15 01:11 pm
Looks nice, I haven't read either through, but any chance you could merge this into Installation on Windows or at least write it down in a wiki page a link it accordingly? Thanks!
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Kirpal Sukumar at 2012-06-28 08:47 pm
Good afternoon,
After running ChiliProject for several months, I've run across an issue with mongrel that is going to require me to move to different application server - and my research is telling me that thin may be the best option.
I've run into a problem with the above directions - it works fine up until I try to execute thin for the first time, when I get the following:
> D:\chiliproject\chiliproject-3.1.0>thin -e production -p 3001 start > >> Using rails adapter > C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/r > untime.rb:31:in `block in setup': You have already activated rack 1.4.1, but you > r Gemfile requires rack 1.1.3. Using bundle exec may solve this. (Gem::LoadError > ) > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/ > lib/bundler/runtime.rb:17:in `setup' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/ > lib/bundler.rb:107:in `setup' > from D:/chiliproject/chiliproject-3.1.0/config/preinitializer.rb:30:in ` > <top (required)>' > from D:/chiliproject/chiliproject-3.1.0/config/boot.rb:42:in `load' > from D:/chiliproject/chiliproject-3.1.0/config/boot.rb:42:in `preinitial > ize' > from D:/chiliproject/chiliproject-3.1.0/config/boot.rb:24:in `boot!' > from D:/chiliproject/chiliproject-3.1.0/config/boot.rb:137:in `<top (req > uired)>' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/custo > m_require.rb:55:in `require' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/custo > m_require.rb:55:in `require' > from D:/chiliproject/chiliproject-3.1.0/config/environment.rb:33:in `<to > p (required)>' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/custo > m_require.rb:55:in `require' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/custo > m_require.rb:55:in `require' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib > /rack/adapter/rails.rb:37:in `load_application' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib > /rack/adapter/rails.rb:23:in `initialize' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib > /rack/adapter/loader.rb:48:in `new' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib > /rack/adapter/loader.rb:48:in `for' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib > /thin/controllers/controller.rb:169:in `load_adapter' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib > /thin/controllers/controller.rb:73:in `start' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib > /thin/runner.rb:185:in `run_command' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/lib > /thin/runner.rb:151:in `run!' > from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.3.1/bin > /thin:6:in `<top (required)>' > from C:/RailsInstaller/Ruby1.9.2/bin/thin:19:in `load' > from C:/RailsInstaller/Ruby1.9.2/bin/thin:19:in `<main>'
Some more research tells me that this error is related to some of the bundled gems not being available outside of the bundle - but as I am not very experienced with RoR, I'm at a loss as to how to continue.
Any help would be much appreciated.
Kirpal
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Felix Schäfer at 2012-06-28 08:54 pm
The fix suggested in the error message is probably the right one. Try running thin with: bundle exec thin -e production -p 3001 start
.
Quick explanation: when you run a command without bundle exec, all gems are available to thin and it will try to load the newest installed, this can conflict with the application though if the application specifically requires older versions of gems than the newest installed (the older gems are available too, but can't be loaded because the newest is already there). The Gemfile holds a list of gems and versions the application needs and are known to be working. When run with bundle exec
, the environment thin runs in only has those gems described in the Gemfile, thus avoiding version conflicts.
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Kirpal Sukumar at 2012-06-28 09:02 pm
Thanks for the quick response, Felix.
My only issue with using bundler is that I have not (at least in the past 5 days of searching) come up with a way to create a windows service using it. I was able to get mongrel working by including the mongrel_service gem within the bundle, and then creating the service using "bundle exec ...", but since the bundle gem doesn't seem to have any functionality for specifying where to start it, I've run up against a dead end here.
I would stick with mongrel, but there are a couple of issues with it that are forcing me to move.
Thanks
Kirpal
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Felix Schäfer at 2012-06-28 09:06 pm
Kirpal Sukumar wrote:
My only issue with using bundler is that I have not (at least in the past 5 days of searching) come up with a way to create a windows service using it. I was able to get mongrel working by including the mongrel_service gem within the bundle, and then creating the service using "bundle exec ...", but since the bundle gem doesn't seem to have any functionality for specifying where to start it, I've run up against a dead end here.
If I understand correctly you can't start a windows service in a specific directory? You can tell bundler which Gemfile to use by setting the BUNDLE_GEMFILE
environment variable to the path of the Gemfile.
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Kirpal Sukumar at 2012-06-28 09:41 pm
There are ways to start a windows service in a specific directory (the way that Dies did it with winsw above, as well as a few other options), but what I'm having trouble with is getting the bundle to execute properly when called from outside the native directory.
Just as a test, I tried the following:
set BUNDLE_GEMFILE="D:\chiliproject\chiliproject-thin\"
X:\>"C:\RailsInstaller\Ruby1.9.2\bin\ruby.exe" "C:\RailsInstaller\Ruby1.9.2\bin\bundle" exec thin start -e production -p 3002
Which only produces the following error:
X:/"D:/chiliproject/chiliproject-thin/" not found
Thanks,
Kirpal
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Felix Schäfer at 2012-06-28 09:47 pm
I think it takes the path to the file, not to the directory, i.e. BUNDLE_GEMFILE="D:\chiliproject\chiliproject-thin\Gemfile"
.
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Kirpal Sukumar at 2012-06-29 12:09 am
Felix,
I feel like we're getting closer - after I experimented a little bit, I found that bundler doesn't like quotation marks in its BUNDLE_GEMFILE path. So after changing my environment setting to:
set BUNDLE_GEMFILE=D:\chiliproject\chiliproject-thin\Gemfile
I was able to start thin using full paths...but only when I'm actually executing it from inside the ChiliProject directory
So while this works perfectly:
D:\chiliproject\chiliproject-thin>"C:\RailsInstaller\Ruby1.9.2\bin\ruby.exe" "C:\RailsInstaller\Ruby1.9.2\bin\bundle" exec thin -e production -p 3002 start
Using rails adapter
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on >or after 2011-11-01.
Gem.source_index called from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
Thin web server (v1.3.1 codename Triple Espresso)
Maximum connections set to 1024
Listening on 0.0.0.0:3002, CTRL+C to stop
This fails:
D:\>"C:\RailsInstaller\Ruby1.9.2\bin\ruby.exe" "C:\RailsInstaller\Ruby1.9.2\bin\bundle" exec thin -e production -p 3002 start
No adapter found for D:/
BUT!
I also remembered that thin needs a config directory... and modified my command as follows:
D:\>"C:\RailsInstaller\Ruby1.9.2\bin\ruby.exe" "C:\RailsInstaller\Ruby1.9.2\bin\bundle" exec thin -e production -p 3002 -c D:\chiliproject\chiliproject-thin start
Using rails adapter
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
Thin web server (v1.3.1 codename Triple Espresso)
Maximum connections set to 1024
Listening on 0.0.0.0:3002, CTRL+C to stop
And have it working from any directory.
Now to figure out how to translate this into a working service, and I'll be all set.
Kirpal
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Chili Fan at 2012-07-05 11:54 pm
Hello Kipral
I am still on the same road as you are, try to achieve setup "application server" run CP as a windows service, i only achieved to run WEBRick as a windows service for CP explained here http://www.chiliproject.org/boards/1/topics/1420?r=1763#message-1763
Still wondering if it is possible to get run on Tomcat window service, and use of War file to auto deploy CP would be great at Tomcat
but manual deploy will do
(a nice challenge i still strugle) to get it running like mongrel, tomcat, thin, or nginx
i will follow this topic and see if i can help,
RE: Installation notes for ChiliProject 3.0.0 with PostgreSQL on Windows 2008 as Windows Service - Added by Chili Fan at 2012-07-05 11:55 pm
figure out how i can delete this double posted reply (otherwise i will re use this reply space), sorry
(1-10/10)