Well, I thought I would install ruby on rails, and run it as a user under apache’s mod_fcgi. This is entirely possible: the user account can run any code, and installing an entire library of ruby scripts should be straightforward, with write access to the user’s home directory. For good measure, the collected wisdom of the Internet says it can be done. And I have root. Cool.
The first obstacle was rewriting the fcgi wrapper so that it will launch ruby scripts with appropriate limits so that they will not kill other processes in the shared environment. That went well – three lines of new code in the existing wrapper. It is a wonderful piece of work. We will run ruby on rails. Life will be sweet. Customers will be happy.
Then I downloaded a rails-based CMS from radiantcms.org, extracted it, installed ruby for CentOS, and fired it up. Surprise! It didn’t work. I found the public/dispatch.fcgi program, and ran it. It complained about missing include files. Aargh. Time to read the instructions. Oh look, the installation instructions say to compile the config/database.yml file with “rake db” or whatever.. That’s pretty horrid, since rake was not in the CentOS ruby package. Where to get it?
Oh well, the current version of rails demands ruby 1.9.2, and not 1.8.7 as shipped with CentOS, so it looks like I’ll either have to trust some flaky package from some helpful person out there, or compile it from source. It looks like this particular project will require a script when I need it on another machine. Not to worry, I thought, we’ll cross that bridge when we come back to it, and I downloaded the current version of ruby, and compiled it from source. That should sort out all the troubles. Hey, look there, I got rake.
So I raked according to the instructions. No joy. So I installed the gem version of rails, or radiant and a few version-specific dependencies. Suddenly I’m running as root, since gem does not understand the concept of installing code for a user.
gem install mysql
gem install rails
gem install i18n
gem install rails
gem install i18n -v 0.4.1
gem install -y rails
gem install RedCloth
gem install fcgi
gem install radiant
And after all this I got this:
bash-3.2$ ./dispatch.fcgi
Could not load extension from file: archive_extension.
#
Could not load extension from file: smarty_pants_filter_extension.
#
:29:in `require': no such file to load -- fcgi (MissingSourceFile)
Oh dear. How about I just install the fcgi gem?
# gem install fcgi
Building native extensions. This could take a while...
ERROR: Error installing fcgi:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for fcgiapp.h... no
checking for fastcgi/fcgiapp.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-fcgi-dir
--without-fcgi-dir
--with-fcgi-include
--without-fcgi-include=${fcgi-dir}/include
--with-fcgi-lib
--without-fcgi-lib=${fcgi-dir}/lib
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/ext/fcgi/gem_make.out
Huh? Now, everyone with the most basic knowledge of rails or radiant or ruby knows exactly how to fix this. However, I will never acquire this basic knowledge, as I have no more patience with this series of continual roadblocks. After a few hours of trying, I’m sick of it. It is a horrible system.
My feeling about ruby on rails:
- It is immature. Mature technology just works. It does not just work.
- It will never come near to replacing the horrible monstrosity that is php – not in this form.
- You absolutely require root access to be able to get it going, and therefore to maintain it as well. This means it is not suitable for a shared platform.
This is calculated to attract angry attention from those that love and/or wrote ruby on rails (or maybe read a glowing HOWTO about it). They will say things like I did not pay for it, they will point out how thankless and ungrateful I am for their hard work. They will say “if you want help, you should have a better attitude.” They might even notice that I am stupid. They might be right, but I should mention that it was not entirely my idea to install their junk.
So what now? If anyone asks, we (the folks I work for) do support Ruby on Rails. We will provide you with a dedicated server and you can install it there. Hang, if you ask nicely, we might even install it for you. You can manage your own private dependency hell on your own private server, and not break anyone else’s dependency hell.