Koozali.org formerly Contribs.org

Legacy Forums => General Discussion (Legacy) => Topic started by: plog99 on January 07, 2006, 03:31:16 PM

Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: plog99 on January 07, 2006, 03:31:16 PM
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.rpm
wget http://dev.centos.org/centos/4.2/testing/i386/RPMS/irb-1.8.3-2.c4.i386.rpm
wget http://dev.centos.org/centos/4.2/testing/i386/RPMS/ruby-1.8.3-2.c4.i386.rpm
wget http://dev.centos.org/centos/4.2/testing/i386/RPMS/ruby-devel-1.8.3-2.c4.i386.rpm
wget http://dev.centos.org/centos/4.2/testing/i386/RPMS/ruby-libs-1.8.3-2.c4.i386.rpm
rpm -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.gz
tar 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.gz
tar 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.tgz
tar -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
Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: kruhm on January 08, 2006, 02:20:15 PM
#this is great

#just a few minor corrections

#if it's a fresh sme v7 install, you'll need to get some prerequisites. do a:
yum install gcc
yum install httpd-devel

#also after you cd into the mod_fastcgi dir, you'll need to do more. maybe:
cp Makefile.AP2 Makefile
make top_dir=/usr/lib/httpd
make top_dir=/usr/lib/httpd install
/etc/rc.d/init.d/httpd restart

#You will probably have to set the following directive in your httpd.conf : FastCgiIpcDir /tmp/fastcgi
#custom-template is posted above

#i'm guessing "ror" is an indication of a virtualhost running on rubyonrails
#if so, you'll have to add a virutalhost via the DOMAINS panel and begin the name with ror
#for example rorRECIPES
#otherwise the custom httpd.conf won't work

#also, the custom httpd.conf should be copied from the regular template dir. Like this:
cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/20IbayContent /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/20IbayContent
#then replace
$OUT .= "    DocumentRoot         $basedir/html\n";
#with the code (already posted above)
    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";
}

thanks,
Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: kruhm on February 05, 2006, 06:37:50 AM
plog99 did you get any further on this?

I can create a controller but I can't access the app from a browser.

Also, should:
#cat /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHostsca/20IbayContent
be:
#cat /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/20IbayContent
?
Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: plog99 on February 05, 2006, 01:24:22 PM
Yes indeed, it's /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/20IbayContent

sorry

"I can't access the app from a browser" : have you any errors ? 404?
Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: kruhm on February 05, 2006, 06:41:52 PM
got it. thanks.
Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: gregswallow on February 05, 2006, 07:45:05 PM
There are some ruby rpms here:
http://www.swabe.org/files/redhat/SRPMS/
...including rubygems and mod_ruby instead of mod_fastcgi.  Not sure what the advantages of either one are, but it would be good to use rpms when it's possible in your howto.  Looks like they are built on FC4, so need to be rebuilt on SME/Centos4.  I can build rpms for you on the build server if you want - let me know.
Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: kruhm on February 07, 2006, 06:56:57 AM
using apache, I can get the "welcome aboard" page. but I can't get access to any controllers i've created.

i try to access with:
//<smeserver>/rubyonrails/pubic/recipe

my error log says:
File does not exist: /home/e-smith/files/ibays/rubyonrails/html/public/recipe

I get the controller when i start the WEBrick and access with:
//<smeserver>:3000/recipe

hmmm... too late for me. I'll try again tomorrow.
Title: Ruby on Rails
Post by: kingjm on May 24, 2006, 08:08:56 PM
I was wondering how everything is going with Ruby on Rails. I would like to use this application, unfortunately I don't understant a lot of the behind the scenes command lines.  I am willing to learn and help though.
Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: kruhm on May 29, 2006, 05:22:56 AM
I've scrapped the project for myself. I don't known ruby or have a background in ruby. I just don't see myself trying to learn something else new, I don't have that kind of time and concentration.

I decided that sticking with a PERL framework may work out better:
http://www.catalystframework.org/
Title: just deploy ror on my sme 7.0 server
Post by: cgetty on August 18, 2006, 07:39:19 AM
Hi

Been playing with ror on windows & PCLinux.  Everything working using WebBrick.

I’m running a SME Server 7.0. What do I need to just deploy ror apps on my server ?

Also if you have ror apps running on your SME server, drop me a link so I can see.

Thanks
Clark
Title: Re: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: msoulier on October 15, 2006, 02:57:14 PM
Quote from: "plog99"

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.rpm


Ruby 1.8.3 and Rails are known to have issues. Check www.rubyonrails.org. I was hoping to backport Ruby 1.8.5.

For deployment, I personally find using mongrel is far easier. Check for it at rubyforge. It installs as a gem, and it's simple to supervise.

Mike
Title: A little update of this small howto
Post by: plog99 on January 14, 2007, 11:06:02 PM
Hi all,

I just wanted to share some of my recent experience with ROR and SME.
I becomes easyer to get all the pieces with RPM's

You'll find at the end of this post the way I setup a SME to play with Ruby on Rails.
Notice that I completely drop FastCGI wich really,really,really sucks under heavy load.

I'm currently using Mongrel to serve Ror. Concerning this topic, I'm working on a RPM to add a panel in the SME manager to manage mongrel port
- http://www.voxteneo.com/images/1.jpg
- http://www.voxteneo.com/images/2.jpg

Concerning Mongrel, I still have to test mongrel_cluster with the method bellow (which is included in the RPM above) :
http://jul.is.a.n0life.org/blog/post/2006/10/04/Deploiement-de-ruby-on-rails-avec-apache-20-et-mongrel
 

Code: [Select]
mkdir /home/e-smith/files/ibays/Primary/files/rails
cd /home/e-smith/files/ibays/Primary/files/rails

wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-devel-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-docs-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-rdoc-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-mysql-2.7-8.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-irb-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-libs-1.8.5-1.el4.centos.i386.rpm

wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
rpm -Uvh *.rpm
tar -xzf rubygems-0.9.0.tgz

cd rubygems-0.9.0

ruby setup.rb

gem install capistrano --include-dependencies
gem install rails --include-dependencies
gem install mongrel --include-dependencies
gem install mongrel_cluster --include-dependencies


plog _/ at /_ voxteneo * com
Title: update
Post by: plog99 on January 14, 2007, 11:18:29 PM
btw.... You'll need "gcc" for mongrel
Title: mongrel rpm for SME
Post by: Jawor on January 30, 2007, 11:12:38 PM
Great news that you are working on mongrel rpm for sme. Is it ready ?
Maybe you have got beta to try out?
So far I'm using ruby on rails with lighttpd and scgi on SME to host AJAX apps that we are developing.

jarek.jaworski_at_vayana.com
Title: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: plog99 on February 01, 2007, 04:54:34 PM
I'm fighting to do a decent RPM :)
Title: mongrel rpm on sme
Post by: Jawor on April 15, 2007, 10:53:02 AM
Any news on mongrel with panel for sme? beta maybe?
Title: setup routes
Post by: kingjm on April 28, 2007, 11:14:06 PM
I want to learn ROR and have setup ror acording to the howto wiki for contribs.  I can access the "Welcome aboard" screen and have done setups one and two.

one: edit config/database.yml
two: Use script/generate

but three eludes me. I have to setup routes.

 What are the routes an where do they go?

I have put the stuff in /opt/ruby/work/demo
Title: Monrel rpm for sme
Post by: Jawor on June 20, 2007, 01:01:54 AM
Any news on mongrel rpm?
Title: Re: HowTo: Installing Ruby on Rails on SME7 Beta9
Post by: fixit on August 15, 2007, 04:54:29 PM
Metadot have recently introduced an CMS that i am interested in that is based on Ruby, at this point I have installed ruby and gems on sme 7.2, but have had not much luck in installing metadot, at this point i believe it needs to create a database and use rake to finish the installation and this is where my problem is, creating the database.

any information would be appreciated

http://download.metadot.com/v7/

username: metadotRails
password: tr4nzf0rm3rz

Thanks, Russell
Title: Re: Monrel rpm for sme
Post by: gregswallow on August 28, 2007, 07:35:17 PM
Any news on mongrel rpm?

This guy[1] seems to be the one maintaining the ruby rpms for Redhat - there is one for mongrel there too, but the extra ones you need like that should be rebuilt on EL4 with the updated ruby rpms from dev.centos.org installed. 

[1] - http://people.redhat.com/dlutter/yum/SRPMS/