I’m having trouble installing Redmine. It seems to run just fine under webrick like this:
redmine@machine:~$ /usr/bin/ruby1.8 script/rails server webrick -e production
Note that this is when I’m logged in as user ‘redmine’.
I installed Passenger (v3.0.17) against my existing Apache2 installation and use a /etc/apache2/mods-enabled/passenger.conf like this:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17/ext/apache2/mod_passenger.so
PassengerDefaultUser www-data
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.17
PassengerRuby /usr/bin/ruby1.8
My virtual host conf is very simple too:
<VirtualHost *:80>
ServerAdmin webmaster@machine.com
ServerName redmine.machine.com
RailsEnv production
DocumentRoot /home/redmine/redmine-2.1/public
<Directory /home/redmine/redmine-2.1/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog /var/log/apache2/redmine.error.log
CustomLog /var/log/apache2/redmine.access.log combined
</VirtualHost>
When I run this, I get an error “no such file to load — bundler”. However, notice:
redmine@machine:~$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activerecord-mysql2-adapter (0.0.3)
activeresource (3.2.8)
activesupport (3.2.8)
arel (3.0.2)
builder (3.0.0)
bundler (1.2.1)
coderay (1.0.8)
daemon_controller (1.0.0)
erubis (2.7.0)
fastercsv (1.5.5)
fastthread (1.0.7)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.0.3)
json (1.7.5)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.6)
mysql (2.8.1)
mysql2 (0.3.11)
net-ldap (0.3.1)
passenger (3.0.17)
pg (0.14.1)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.8)
railties (3.2.8)
rake (0.9.2.2)
rdoc (3.12)
rmagick (2.13.1)
ruby-openid (2.1.8)
rvm (1.11.3.5)
sprockets (2.1.3)
sqlite3 (1.3.6)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.11)
tzinfo (0.3.33)
All files in /home/redmine/redmine-2.1 are owned by redmine:redmine. All directories are 0755 and all files are 0644.
Now, the interesting thing I have noticed when I show processes:
redmine@machine:~$ ps -ef | grep "Passenger"
root 21764 21759 0 10:49 ? 00:00:00 PassengerWatchdog
root 21773 21764 0 10:49 ? 00:00:00 PassengerHelperAgent
root 21775 21773 0 10:49 ? 00:00:00 Passenger spawn server
nobody 21778 21764 0 10:49 ? 00:00:00 PassengerLoggingAgent
I’m certainly no expert in Ruby/Rails/Passenger/Redmine, but I suspect that the fact that Passenger is running as nobody instead of redmine may be the problem. According to the docs here: http://www.modrails.com/documentation/Users%20guide%20Apache.html#user_switching, Passenger is supposed to switch users to the user who owns /config/environment.ru, so long as that user can read/write logs and is not root, correct? As you can see from the above, that file (the whole app, in fact) is owned by redmine, including the logs which are rwx for the owner and redmine ≠ root so, I believe that I’ve passed the requirements for Passenger to switch to run as redmine.
Three direct questions:
- Is this the cause of my inability to run Redmine under Passenger? and**
- Why is Passenger still running as
nobody?** -
In my attempt to fix this, I tried adding the line:
PassengerDefaultUser www-data
into my /etc/apache2/mods-enabled/passenger.conf (as shown above), but it appears to not take affect. The results of everything is identical with and without that line. I wouldn’t have expected it to fix the problem, but I did expect it to show up as the user that Passenger runs as when I list processes. It did not.
Other possibly relevant info:
redmine@machine:~$ uname -a
Linux machine.****.com 2.6.18-028stab092.1 #1 SMP Wed Jul 20 19:47:12 MSD 2011 x86_64 GNU/Linux
Ubuntu 10.04.4 LTS
redmine@machine:~$ /usr/bin/ruby1.8 --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
bundler is the problem. Do you have any particular reason to use Ruby 1.8.x? I strongly recommend you to upgrade to Ruby 1.9.x, preferably 1.9.3. Otherwise, you may want to try a more ancient bundler version like 0.9.x. In addition you should downgrade your Rubygems to 1.3.7 or something similar.
In theory Rubygems can be downgraded as follows:
To install an old bundler version:
On several occasions I had to deal with outdated Ruby software, and the best thing to do is to not install the system Ruby, but to compile it yourself from sources. (Not so difficult after all, Ruby is well-packaged.) And then install the appropriate Rubygems version from sources. Or look at RVM, although this can be painful at the beginning.
BTW: I also recommend to use nginx instead of Apache. The installation is not as well-documented but therefore the configuration files are much simpler.