GEM_PATH

Added by Matthew Connerton over 11 years ago

I am trying to install a fresh checkout of trunk on my shared server online.

Here are a few quick version numbers:
ruby: 1.8.7
rails: 2.3.2
gems: 1.3.2

Now since it is a shared server, my gems are stored in "/home/divweb/ruby/gems"

That is where the mysql gem is installed and I can see its installed from cPanel, however when I try and run:
rake db:migrate RAILS_ENV="production"

It tells me:

@(in /home/divweb/etc/rails_apps/redmine)
  • Invoke db:migrate (first_time)
  • Invoke environment (first_time)
  • Execute environment
    !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
    rake aborted!
    no such file to load -- mysql
    /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'
    ...
    ...
    ...
    ...
    @

How/where do I set the gem path so redmine sees that mysql gem?

Replies (5)

RE: GEM_PATH - Added by Adam Romer over 11 years ago

I'm really not familiar with RoR at all. But I can definitely sympathize with you trying to get this running on shared hosting. (I'm using Site5). What I actually did was rather then checking out over subversion I downloaded a full package from http://rubyforge.org/frs/?group_id=1850&release_id=33043. This includes all the appropriate gems in the "vendor" folder. If you were to get your include path to work the next thing you'll run into is that it will be looking for Rails 2.1.2 which is older then you're server version. Any configuration you would need to do would most likely be done in your config/enviornment.rb file in the redmine directory.

I know there are other ways to get this to work, and there are a lot of people here that will be able to tell you how to do them much better then I can. But that method worked for me. I have redmine fully operational and running on my shared server, so I know I did something right.

You could also try adding the following to config/enviornment.rb
ENV['GEM_PATH'] = '<path to your ruby gems>'
ENV['PATH'] = "<path to your /bin/ directory if you have any locally compiled versions of software you need>"

If anyone notices that I stated anything incorrectly, please feel free to correct me.

I hope that helps.

RE: GEM_PATH - Added by Matthew Connerton over 11 years ago

Well, I am a setup closer!

I took your suggestion and downloaded 0.8.0-RC1

Then after setting up the database.yml and adding ENV['GEM_PATH'] = '/home/divweb/ruby/gems' to my environment.rb, everything raked/migrated perfect.

Now, when I start redmine in cPanel, it says its running on port 12002 however when I go to http://www.example.com:12002/, it just times out.

RE: GEM_PATH - Added by Adam Romer over 11 years ago

Good, we're making progress.

I wouldn't have thought to use 0.8.0-RC1, the official 0.8 release is available too which I would imagine would be somewhat more stable then the Release Candidate. I'm using 0.8.3 and I haven't had any issues yet. You should be able to get them all from that same link.

As fas as actually getting it running. I couldn't get it to work with cpanel either. First off, you don't have it in public_html right? If you do that someone will be able to navigate to your database.yml file and see your database username and password in plain text. If it's out of public_html, make a symlink or a subdomain to connect to it.

For example:
ln -s ~/redmine/public/ ~/public_html/redmine/

If you run that command it will let you access the public folder of redmine in your root directory by going to http://www.&lt;yoursite&gt;.com/redmine/ You can change either path accordingly.

At that point, in order to get it running, navigate to the public folder. Copy dispatch.fcgi.example to a new file without .example at the end. Then run the following commands from redmine/public/ to copy it, set permissions, and start it:

cp dispatch.fcgi.example dispatch.fcgi
chmod 755 dispatch.fcgi
./dispatch.fcgi

After that you should be good to go.

RE: GEM_PATH - Added by Matthew Connerton over 11 years ago

Indeed we are making progress.

I created a sub domain pointing to redmine/public
I had already copied the dispatch.fcgi and chmodded it.

I had not run ./dispatch.fcgi

When I did I got this:

[~/etc/rails_apps/redmine/public]# ./dispatch.fcgi
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- fcgi (MissingSourceFile)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home/divweb/etc/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
        from /home/divweb/etc/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
        from /home/divweb/etc/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
        from /home/divweb/etc/rails_apps/redmine/vendor/rails/railties/lib/fcgi_handler.rb:1
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home/divweb/etc/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
        from /home/divweb/etc/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
        from /home/divweb/etc/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
        from ./dispatch.fcgi:22

RE: GEM_PATH - Added by Matthew Connerton over 11 years ago

I tried gem install fcgi but that got angry at me.

I've sent a support ticket into my host seeing if mod_fcgi or mod_fastcgi is enabled or not which I figure it the problem.

I comment out everything the fcgi handlers in my .htaccess files to force it to use the cgi, which is a little slow right now, but at least it works :-P

I guess all I need to do is
1) Get the lastest release
2) Get my host to enabled fastcgi
3) Blog on how to troubleshoot a shared host environment using cPanel ;-)

Thanks for all the help guys!

(1-5/5)