Hi all,
I installed Ruby on Rails on a SME7 Beta9.
So far, I can create a rails app with a simple controller.
Obviously, this still need to be tested a lot more (connect to a Mysql DB for ex.
This is how I did th all thing. ' Hope it will help someone...
Having Ruby on Rails enabled ibays could be a killing app for SME, don't you think ?
Installing Ruby
===============
The standard Yum version seemed too old, I took those on the "testing" repos of CentOS
wget
http://dev.centos.org/centos/4.2/testing/i386/RPMS/rdoc-1.8.3-2.c4.i386.rpmwget
http://dev.centos.org/centos/4.2/testing/i386/RPMS/irb-1.8.3-2.c4.i386.rpmwget
http://dev.centos.org/centos/4.2/testing/i386/RPMS/ruby-1.8.3-2.c4.i386.rpmwget
http://dev.centos.org/centos/4.2/testing/i386/RPMS/ruby-devel-1.8.3-2.c4.i386.rpmwget
http://dev.centos.org/centos/4.2/testing/i386/RPMS/ruby-libs-1.8.3-2.c4.i386.rpmrpm -Uvh *.rpm
Install the FastCGI Devel kit
=============================
==>>> See
http://wiki.rubyonrails.com/rails/pages/RailsOnFedora for more info
wget
http://fastcgi.com/dist/fcgi-2.4.0.tar.gz tar zxvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make
make install
Install mod_fastcgi:
====================
==>>> See
http://wiki.rubyonrails.com/rails/pages/RailsOnFedora for more info
wget
http://fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gztar zxvf mod_fastcgi-2.4.2.tar.gz
cd mod_fastcgi-2.4.2
Notice:
- create "/tmp/fcgi_ipc/" (according to the FastCgiIpcDir directive below) and chmod it to 777 or FastCGI will crash
Installing Ruby FastCGI Bindings
================================
wget
http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gztar zxvf ruby-fcgi-0.8.6.tar.gz
cd ruby-fcgi-0.8.6
ruby install.rb config
ruby install.rb setup
ruby install.rb install
Installing Rubygems
===================
wget
http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgztar -zxvf rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby setup.rb
gem install rails
Installing Rail
===================
gem install rails
gem install fcgi
I'm looking for a way to modify the server manager in order to allow the automatic creation of a "rails enable" ibay
What I did so far is just playing a bit with templates-custom this way
=============================================
#cat /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/20LoadModuleFASTCGI
LoadModule fastcgi_module modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
FastCgiConfig -singleThreshold 100 -killInterval 30 -autoUpdate -idle-timeout 20 -pass-header HTTP_AUTHORIZATION -initial-env RAILS_ENV=development
</IfModule>
===================================
#cat /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHostsca/20IbayContent
{
use esmith::AccountsDB;
my $accounts = esmith::AccountsDB->open_ro;
use esmith::DomainsDB;
my $domains = esmith::DomainsDB->open_ro;
$OUT = "";
my $ibay = $virtualHostContent;
my $basedir = "/home/e-smith/files/ibays/$ibay";
my $cgiBin = $accounts->get_prop($ibay, "CgiBin") || "";
if ($basedir =~ m/ror_/){
$OUT .= " DocumentRoot $basedir/html/public/\n";
$OUT .= " <Directory $basedir/html/public/>\n";
$OUT .= " Options ExecCGI +FollowSymLinks\n";
$OUT .= " AllowOverride All\n";
$OUT .= " order allow,deny\n";
$OUT .= " allow from all\n";
$OUT .= " </Directory>\n";
}else{
$OUT .= " DocumentRoot $basedir/html\n";
}
[...]
Troubleshooting
===============
- I create rail apps in the "html" dir of my ibays with "rail html"
to get this :
[root@smeserver html]# ls
app components config db doc lib log public Rakefile README script test vendor
- check http error log with : tail -f /var/log/httpd/error_log
- check your html/log/fastcgi.crash.log files
- run "ldd /usr/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/fcgi.so" to see if fcgi finds every libs it needs.
Stay tuned...
Patrick Logé
http://www.voxteneo.com