School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,431 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,504 people online right now. Registration is fast and FREE... Join Now!




Setting Up Ruby On Rails on Fedora 7

 

Setting Up Ruby On Rails on Fedora 7, Ruby + Rails + Apache + Mongrel Cluster

Nova Dragoon

21 Jul, 2007 - 08:39 PM
Post #1

The Innocent Shall Suffer, Big Time
Group Icon

Joined: 16 Aug, 2001
Posts: 6,169



Thanked: 29 times
Dream Kudos: 515
Expert In: Python, Linux

My Contributions
At the end of this tutorial you will have a full scale ruby-on-rails production environment running clustered through the mongrel ruby application platform, load balanced by reversed proxied by Apache.


Start with an install of Fedora 7 onto your machine.

Installing Fedora Packages
As root
CODE

yum install httpd mysql-server mysql
yum install install ruby ruby-devel ruby-irb ruby-libs ruby-rdoc ruby-ri rubygems


Installing Ruby Packages
If any of the installs say they cant find the package, try again.

Also as root
CODE

#install rails
gem install rails --include-dependencies
#installing mongrel
gem install gem_plugin daemons capistrano --include-dependencies
gem install mongrel mongrel_cluster railsmachine --include-dependencies

For the last install, it may ask which version you want, choose the latest ruby versions.

Configuring Mongrel
Also as root
* Creating a mongrel user to run mongrel as: /usr/sbin/adduser -r mongrel
* Create mongrel conf directory: mkdir /etc/mongrel_cluster
* Symlink mongrel initscript
ln -s /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_cluster /etc/init.d/mongrel_cluster
* Make it executable chmod 755 /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_cluster
* Add it to chkconfig chkconfig --add mongrel_cluster
* Enable it in chkconfig chkconfig mongrel_cluster on

Setup Mongrel on Your Rails App
This is using a production environment for rails.
I'm assuming you've setup your application in /var/www/ProjectName
As root:
CODE

cd /var/www/ProjectName
mongrel_rails cluster::configure -e production  -p 8000 -N 3 -c /var/www/ProjectName/ -a 127.0.0.1  --user mongrel --group mongrel  -c /var/www/ProjectName/
ln -s /var/www/ProjectName/config/mongrel_cluster.yml /etc/mongrel_cluster/ProjectName.yml
chown -R mongrel:mongrel /var/www/ProjectName/tmp/



Test Mongrel
Start Mongrel with service mongrel_cluster start
Browse to http://127.0.0.1:8000 http://127.0.0.1:8001 and http://127.0.0.1:8002 and check mongrel is running your rails app on each of those ports.

Setup Apache

Selinux is grumpy about the proxy setup, so go write rules for it or disable selinux on your system.

Add this to a new configuration file /etc/httpd/conf.d/rails_cluster.conf
CODE

<Proxy balancer://mongrel_cluster>
  BalancerMember http://127.0.0.1:8000
  BalancerMember http://127.0.0.1:8001
  BalancerMember http://127.0.0.1:8002
</Proxy>
<VirtualHost *:80>
    ProxyPass / balancer://mongrel_cluster/
    ProxyPassReverse / balancer://mongrel_cluster/
</VirtualHost>

Save and restart httpd, then browse to http://127.0.0.1/
and you should see your app.

Congratulations, you have setup a full scale rails production environment.

User is offlineProfile CardPM
+Quote Post


skyhawk133

RE: Setting Up Ruby On Rails On Fedora 7

21 Jul, 2007 - 09:04 PM
Post #2

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 16,844



Thanked: 152 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
Great tutorial. Vote for it on DZone: http://www.dzone.com/links/how_to_ruby_on_...n_fedora_7.html
User is offlineProfile CardPM
+Quote Post

Nova Dragoon

RE: Setting Up Ruby On Rails On Fedora 7

23 Jul, 2007 - 12:45 PM
Post #3

The Innocent Shall Suffer, Big Time
Group Icon

Joined: 16 Aug, 2001
Posts: 6,169



Thanked: 29 times
Dream Kudos: 515
Expert In: Python, Linux

My Contributions
I've tested this setup mostly through on Fedora Core 6 as well, and it seems to work with no adjustments.
User is offlineProfile CardPM
+Quote Post

ngukho

RE: Setting Up Ruby On Rails On Fedora 7

2 Aug, 2007 - 07:54 PM
Post #4

New D.I.C Head
*

Joined: 2 Aug, 2007
Posts: 1


My Contributions
Sorry ! I'll to do like this but i have an error when i run it at final step .

503 Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

help me ! Please .
User is offlineProfile CardPM
+Quote Post

khave

RE: Setting Up Ruby On Rails On Fedora 7

15 Oct, 2007 - 11:08 AM
Post #5

New D.I.C Head
*

Joined: 15 Oct, 2007
Posts: 1


My Contributions
Hi,
I have successfully followed the excellent guide and made it work with my small web-page.
However, when I add the date picker plugin dhtml-calendar things stops to work. Simply mongrel won't boot up.
This is the log from mongrel when starting:
CODE

bash-3.2$ ruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
Exiting
/usr/lib/ruby/1.8/fileutils.rb:1262:in `initialize': Permission denied - script/../config/../public/stylesheets/dhtml_calendar/calendar-tas.css (Errno::EACCES)
        from /usr/lib/ruby/1.8/fileutils.rb:1262:in `open'
        from /usr/lib/ruby/1.8/fileutils.rb:1262:in `copy_file'
        from /usr/lib/ruby/1.8/fileutils.rb:1261:in `open'
        from /usr/lib/ruby/1.8/fileutils.rb:1261:in `copy_file'
        from /usr/lib/ruby/1.8/fileutils.rb:1231:in `copy'
        from /usr/lib/ruby/1.8/fileutils.rb:451:in `copy_entry'
        from /usr/lib/ruby/1.8/fileutils.rb:1324:in `traverse'
        from /usr/lib/ruby/1.8/fileutils.rb:448:in `copy_entry'
         ... 55 levels...
        from /usr/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:39
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        from script/server:3
bash-3.2$

where I run the ruby script/server command as the mongrel user. The break happens before I even start accessing the page with my browser so it is during mongrel startup it happens.
I have made sure that the file public/stylesheets/dhtml_calendar/calendar-tas.css is accessible for the mongrel user and at least I can cat it.
All help is appreciated as I'm a bit lost why mongrel suddenly stops to work when apparently loading a css file.
Thanks in advance,
Kim.
User is offlineProfile CardPM
+Quote Post

ismail115

RE: Setting Up Ruby On Rails On Fedora 7

9 Aug, 2009 - 09:29 AM
Post #6

New D.I.C Head
*

Joined: 9 Aug, 2009
Posts: 1

follow this link to solve your problem


http://fedoraphprails.blogspot.com/2009/08...or-ruby-on.html

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:42AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month