This document describes how to install ChiliProject via Apache + Passenger or FastCGI, connected to a Subversion code repository with a PostgreSQL backend. The ChiliProject installation will be visible in a sub-directory at http://host/chili. The installation would be slightly different for an ChiliProject sub-domain.
Ruby Dependencies
[ebuild N ] dev-ruby/bundler-1.0.18 USE="-test" RUBY_TARGETS="-ree18 ruby18" 169 kB [ebuild N ] dev-ruby/mocha-0.9.12 USE="-doc -test" RUBY_TARGETS="-jruby -ree18 ruby18" 66 kB [ebuild N ] dev-ruby/test-unit-2.1.2-r1
Then use bundle to bring the rest of the dependencies
bundle install --without=test sqlite mysql rmagick mysql2
Configure ChiliProject with the files ./config/configuration.yml and ./config/database.yml and session_store.rb
Migrate the datbase from Redmine (after confirming that the settings are the same)
RAILS_ENV=production bundle exec rake db:migrate
Via Passenger
First, unmask (/etc/portage/package.keywords
) the lastest version of Passenger (and dependencies), then install and configure.
=dev-ruby/daemon_controller-0.2.6 ~amd64 =www-apache/passenger-3.0.7 ~amd64
The packages in this example are specific versions, adjust as necessary for newer packages
~ # emerge -av www-apache/passenger [ebuild N ] dev-libs/libev-4.04 USE="-static-libs" 461 kB [ebuild N ~] dev-ruby/daemon_controller-0.2.6 USE="-test" RUBY_TARGETS="-ree18 ruby18" 22 kB [ebuild U ~] www-apache/passenger-3.0.7 [2.2.15] USE="-debug -doc -test%" RUBY_TARGETS="ruby18%*" 2,765 kB
Let that complete, then update /etc/conf.d/apache2
to have -D PASSENGER
, similar to the following example.
APACHE2_OPTS="-D SSL -D PHP5 -D PASSENGER"
Adjust the Apache configuration for Passenger in /etc/apache2/modules.d/30_mod_passenger.conf
as necessary (defaults may be OK).
Then configure your ChiliProject similar to this example which shows ChiliProject in a sub-directory.
<Location /chili> Options Indexes -ExecCGI FollowSymLinks MultiViews # AllowOverride None Order allow,deny Allow from all # mod_rails # PassengerUser ChiliProject RailsEnv live RailsBaseURI /chili # environment.rb # ChiliProject::Utils::relative_url_root = "/chili" </Location>
Configure ChiliProject
Change ownership of necessary directores
~ # cd /var/lib/ChiliProject ~ # chown -R apache:apache files public/public_assets/ tmp/ /var/log/ChiliProject
Create / Update Configuration, edit database.yml
, settings.yml
as necessary.
These files are located in /var/lib/ChiliProject/config, the names used represent an installed base, so multiple ChiliProjects can be served from the same code base.
~ # cat database.yml live: adapter: postgresql database: my_ChiliProject host: sql.domain.tld username: ChiliProject password: ChiliProject_pw encoding: utf8
And we need to update some configuration data for ChiliProject, use the additional_environment.rb file.
~ # cat additional_environment.rb config.action_controller.session = { :key => "_my_ChiliProject", :secret => "b8c98c891a2fcd9c268154f05b43c4" }
Use something like this command to generate a reasonable key.
~ # echo 'this is how I generate a key' | sha512sum |cut -b1-30 1eac0100cf4f009390fb3b683e8b8edd
Create the database
~ # psql CREATE ROLE ChiliProject LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity'; CREATE DATABASE my_ChiliProject WITH ENCODING='UTF8' OWNER=ChiliProject;
And add the schema and base-data
~ # cd /var/lib/ChiliProject RAILS_ENV=live rake db:migrate
When using FastCGI, we had to add this option to the end of environment.rb
, possibiliy because of the sub-directory installation method.
ChiliProject::Utils::relative_url_root = "/ChiliProject"
Create Database in Sqlite3
~ # cat database.yml production: adapter: sqlite3 dbfile: /opt/company/var/ChiliProject.sqlite3 ~ # rake db:migrate RAILS_ENV="live"
Create Database in PostgreSQL
~ # cat database.yml live: adapter: pgsql dbfile: ~ # rake db:migrate RAILS_ENV="live"
Watch Log Files
~ # tail -f /var/log/apache2/*log /var/log/ChiliProject/*log
Login as Admin
Login to the system using the default authentication of admin / admin. Update the password (in My Account) and then create the projects. Then go to the Administration section, load the default work flow and begin defining your environment.
Turn Down Logging Now
There is loads of logging in ChiliProject, turn this down to save disk I/O.
~ # cat additional_environment.rb # This can be used if you don't have logrotate (should!) # Logger.new(PATH,NUM_FILES_TO_ROTATE,FILE_SIZE) # config.logger = Logger.new(config.log_path, 2, 1000000) config.logger.level = Logger::INFO
Apache Proxy to Mongrel
Much the same as above install ChiliProject and configure it properly. Update the Apache configuration to proxy requests to Mongrel services, make sure that ports and hostnames match up. This one has two services, balanced.
Start the Mongrel Services
~ # ruby /usr/bin/mongrel_rails start \ -c /var/www/ChiliProject \ -a localhost -p 10600 -e production \ -d --user www-data --group www-data \ -P /var/run/mongrel/mongrel.10600.pid \ -l /var/log/mongrel.10600.log ~ # ruby /usr/bin/mongrel_rails start \ -c /var/www/ChiliProject \ -a localhost -p 10601 -e production \ -d --user www-data --group www-data \ -P /var/run/mongrel/mongrel.10601.pid \ -l /var/log/mongrel.10601.log
Now configure Apache to Proxy requests to these two Mongrel services
ProxyPass / balancer://ChiliProject_cluster/ ProxyPassReverse / balancer://ChiliProject_cluster/ <Proxy balancer://ChiliProject_cluster> BalancerMember http://localhost:10600 BalancerMember http://localhost:10601 </Proxy>