Setting Up Ruby On Rails on Fedora 7

Ruby + Rails + Apache + Mongrel Cluster

Page 1 of 1

5 Replies - 27691 Views - Last Post: 09 August 2009 - 10:29 AM

#1 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Setting Up Ruby On Rails on Fedora 7

Post icon  Posted 21 July 2007 - 09:39 PM

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
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
#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:
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
<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.

Is This A Good Question/Topic? 0
  • +

Replies To: Setting Up Ruby On Rails on Fedora 7

#2 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1875
  • View blog
  • Posts: 20,282
  • Joined: 17-March 01

Re: Setting Up Ruby On Rails on Fedora 7

Posted 21 July 2007 - 10:04 PM

Great tutorial. Vote for it on DZone: http://www.dzone.com...n_fedora_7.html
Was This Post Helpful? 0
  • +
  • -

#3 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Re: Setting Up Ruby On Rails on Fedora 7

Posted 23 July 2007 - 01:45 PM

I've tested this setup mostly through on Fedora Core 6 as well, and it seems to work with no adjustments.
Was This Post Helpful? 0
  • +
  • -

#4 ngukho  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-August 07

Re: Setting Up Ruby On Rails on Fedora 7

Posted 02 August 2007 - 08:54 PM

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 .
Was This Post Helpful? 0
  • +
  • -

#5 khave  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 15-October 07

Re: Setting Up Ruby On Rails on Fedora 7

Posted 15 October 2007 - 12:08 PM

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:
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.
Was This Post Helpful? 0
  • +
  • -

#6 ismail115  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-August 09

Re: Setting Up Ruby On Rails on Fedora 7

Posted 09 August 2009 - 10:29 AM

follow this link to solve your problem


http://fedoraphprail...or-ruby-on.html
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1