Running Mongrel for Rails with Apache
-
24-06-2021 - |
Question
I'm trying to get my small rails application deployed. My VPS is running Apache 2.2 and I wish to direct requests through to a mongrel cluster to handle my new rails application.
Ruby version 1.9.3 Rails version 3.2.7 Mongrel version 1.2.0 (gem install mongrel --pre)
What I've done
I've started 3 mongrel daemons for ports 3001 through 3003 with the following:
mongrel_rails start -e production -p 3001 -d -P log/mongrel1.pid
respectively.
Something to note after running each start command; I get the following notices:
NOTE: Gem::SourceIndex.from_installed_gems is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem::SourceIndex.from_installed_gems called from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:109. NOTE: from_installed_gems(arg) is deprecated. From /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb:63:in `block (2 levels) in deprecate' NOTE: Gem::SourceIndex.from_gems_in is deprecated with no replacement. It will be removed on or after 2011-10-01. Gem::SourceIndex.from_gems_in called from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb:50. NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. Gem::SourceIndex#each called from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112.
My understanding tells me this shouldn't be a problem, but when I run:
ps aux | grep mongrel
I get:
someotheruser 17186 0.0 0.1 101064 1336 pts/0 S 12:56 0:00 su mongrel
mongrel 17187 0.1 0.3 67260 2872 pts/0 S 12:56 0:00 bash
mongrel 17284 0.0 0.1 65600 980 pts/0 R+ 12:56 0:00 ps aux
mongrel 17285 0.0 0.0 61176 728 pts/0 R+ 12:56 0:00 grep mongrel
I.e, I can't find the server process.
I've updated my vhosts to look like:
<proxy balancer://mongrelcluster>
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
BalancerMember http://127.0.0.1:3003
</proxy>
<VirtualHost *:80>
ServerName subdomain.mydomain.co.uk
ServerAlias subdomain.mydomain.co.uk
ProxyPass / balancer://mongrelcluster/
ProxyPassReverse / balancer://mongrelcluster/
ProxyPreserveHost on
</VirtualHost>
When I direct my browser to subdomain.mydomain.co.uk I'm greeted with an Apache 403 error, but I can't tell where the error lies. It's likely that mongrel just isn't running as it should, but perhaps I've set my vhosts incorrectly.
Any help and/ or guidance appreciated, thanks!
Solution
Checked the Mongrel log files and it appears that the issue was that my database.yml file was specifying the adapter as sqlite3 when it should have been mysql2. I didn't have sqlite3 installed and so Mongrel wouldn't start.
OTHER TIPS
I think perhaps you are missing a DocumentRoot specification inside your VirtualHost tag.