Project

General

Profile

Redmine on Apache on Gentoo

Added by Thom Brown over 14 years ago

Hi all,

I've tried installing Redmine on Gentoo running under Apache, but have failed miserably.

I installed the following:

www-apache/mod_fcgid
www-apache/mod_ruby
www-apache/passenger
www-apps/redmine

I configured /etc/conf.d/apache so that contains APACHE2_OPTS contains "-D RUBY -D PASSENGER -D FCGID"

Did "cp dispatch.fcgi.example dispatch.fcgi" under /var/lib/redmine/public/
Then "chmod ug+x dispatch.fcgi"
Did "chown -R apache:apache /var/lib/redmine/public"
Then:
RAILS_ENV=production rake config/initializers/session_store.rb
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

Then created /etc/apache2/vhosts.d/02_redmine.conf which contained:

<VirtualHost *:80>
        ServerName redmine
       <Directory /var/lib/redmine/public>
               Options Indexes +ExecCGI FollowSymLinks
                Order allow,deny
                Allow from all
                AllowOverride all
       </Directory>
        RailsEnv production

        RewriteRule ^(.*)$ /dispatch.fcgi [QSA,L]

        DocumentRoot /var/lib/redmine/public
</VirtualHost>

Edited /etc/apache2/modules.d/20_mod_fcgid.conf so that it contained "AddHandler fcgid-script .fcgi" in the IfDefine FCGID block.

Restarted apache, but nothing :( I get a connection refused message. There are no related error messages in /var/log/apache2/error_log

What haven't I done?


Replies (8)

RE: Redmine on Apache on Gentoo - Added by Felix Schäfer over 14 years ago

Are you trying to use fcgi, passenger or mod_ruby?

RE: Redmine on Apache on Gentoo - Added by Thom Brown over 14 years ago

Good question... I have no idea. I think I want to use passenger, but I can only find various incomplete examples which seem to use combinations of all 3, but I gather from your question that it's a choice between any one of them.

RE: Redmine on Apache on Gentoo - Added by Felix Schäfer over 14 years ago

Thom Brown wrote:

incomplete examples which seem to use combinations of all 3

I can see why they are incomplete if they try to use all 3 Oo

Ok, so lose the mod_ruby and mod_fcgid, passenger is imho the best/easiest solution for apache. Then I'd recommend you deinstall passenger and redmine including the config files if you haven't done anything with them, take a deep breath, and reinstall redmine with the passenger USE-flag. I just had a quick look at the ebuild for redmine, and I'd say it pretty much covers what you need, i.e. the docs attached should be enough.

Other question: can you access the apache on another application already, or does it need to be configured too?

RE: Redmine on Apache on Gentoo - Added by Thom Brown over 14 years ago

Ah yes, I hadn't put "www-apps/redmine passenger" into /etc/portage/package.use. I've done that now, and I'll give it a try when I get home where I can test it properly.

Thanks for the clarification and your help. I'll let you know how I get on.

RE: Redmine on Apache on Gentoo - Added by Thom Brown over 14 years ago

Thanks for the advise Felix. It works! I've created my own notes, but if anyone else finds it useful, here's what I did (yes, I have PostgreSQL installed already):

Installing Redmine on Gentoo

If on x86 platform, edit /etc/portage/package.keywords and add "www-apps/redmine ~x86" 
  and "dev-ruby/ruby-net-ldap ~x86" and "www-apache/passenger ~x86" 
Edit /etc/portage/package.use and add "www-apps/redmine passenger subversion imagemagick -mysql" 

emerge redmine

Edit /etc/apache2/modules.d/apache and add "-D PASSENGER" to APACHE2_OPTS

Edit /var/lib/redmine/config/environment.rb and add: config.gem "postgres" 
cd /var/lib/redmine
cp config/database.yml.example config/database.yml
chown -R apache:apache /var/lib/redmine/public /var/lib/redmine/log

Edit config/database.yml so the production entry is as follows:

production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: "redminepassword" (replace this with a totally random md5 or whirlpool hash and in the create role DDL command below)

su postgres
psql

CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redminepassword' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;

Run: rake gems:install
Run: emerge --config =www-apps/redmine-0.9.3

Create a virtualhost with the following in:
<VirtualHost *:80>

ServerName redmine.site
        DocumentRoot /var/lib/redmine/public

        <Directory /var/lib/redmine/public>
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

Note that the document root mustn't have a trailing slash

Run:
apache2ctl configtest
apache2ctl restart

Can someone confirm why I had to add config.gem "postgres" to the environment.rb file? The "emerge --config =www-apps/redmine-0.9.3" fails otherwise.

RE: Redmine on Apache on Gentoo - Added by Felix Schäfer over 14 years ago

It should work without the explicit call to the postgres gem. Care to share the error portage throws?

RE: Redmine on Apache on Gentoo - Added by Thom Brown over 14 years ago

Yes, it is as follows:

# emerge --config =www-apps/redmine-0.9.3

Configuring pkg...

 * 
 * Upgrade database.
 * 
 * Migrate database.
(in /var/lib/redmine)
rake aborted!
Object is not missing constant Project!

(See full trace by running task with --trace)
 * ERROR: www-apps/redmine-0.9.3 failed:
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  54:  Called pkg_config
 *   environment, line 2562:  Called die
 * The specific snippet of code:
 *           RAILS_ENV="${RAILS_ENV}" rake db:migrate || die;
 * 
 * If you need support, post the output of 'emerge --info =www-apps/redmine-0.9.3',
 * the complete build log and the output of 'emerge -pqv =www-apps/redmine-0.9.3'.
 * This ebuild is from an overlay named 'gentoo': '//var/db/pkg/'
 * The complete build log is located at '/var/tmp/portage/www-apps/redmine-0.9.3/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/www-apps/redmine-0.9.3/temp/environment'.
 * S: '/var/tmp/portage/www-apps/redmine-0.9.3/work/redmine-0.9.3'

If I run the db migrate command, I get the following debug output:

# RAILS_ENV=production rake db:migrate --trace
(in /var/lib/redmine)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Object is not missing constant Project!
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:417:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:98:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:98:in `const_missing'
/var/lib/redmine/app/models/attachment.rb:36
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load_without_engine_additions'
/var/lib/redmine/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb:132:in `require_or_load'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:437:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:437:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:437:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:437:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/var/lib/redmine/vendor/plugins/acts_as_attachable/lib/acts_as_attachable.rb:33:in `acts_as_attachable'
/var/lib/redmine/app/models/message.rb:22
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:265:in `require_or_load_without_engine_additions'
/var/lib/redmine/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb:132:in `require_or_load'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:425:in `load_missing_constant'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in `constantize'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:157:in `observed_class'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:183:in `observed_classes'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:166:in `initialize'
/usr/lib/ruby/1.8/singleton.rb:94:in `new'
/usr/lib/ruby/1.8/singleton.rb:94:in `instance'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:38:in `instantiate_observers'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:36:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/observer.rb:36:in `instantiate_observers'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:15
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:182:in `evaluate_method'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:166:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:90:in `run'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:276:in `run_callbacks'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:51:in `send'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:51:in `run_prepare_callbacks'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:631:in `prepare_dispatcher'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:185:in `process'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
/var/lib/redmine/config/environment.rb:20
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/misc.rake:4
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:8:in `load'
/usr/bin/rake:8

Adding that config.gem "postgres" back in to environment.rb, this error disappears.

RE: Redmine on Apache on Gentoo - Added by Felix Schäfer over 14 years ago

Mmh, I have tried to spare some time to see if the gentoo ebuild did some funky stuff that would explain the error, but I haven't gotten to it and it seems everything is working well for you, so I'll consider this resolved. You might want to inform the maintainer of the gentoo ebuild that it seems this line is needed when using postgres though, so that he can integrate it in the ebuild.

    (1-8/8)