Server setup option for rails with different ruby and rails versions - ruby-on-rails

I'm in the process of setting up my VPS (linode) to host a few rails websites. What are some good options for setting up one server that will be hosting rails websites that are on different versions of rails and ruby. For example
foo.com - ruby 1.9.2, rails 3.0
bar.com - ruby 1.9.3, rails 3.2.3
I've seen only one blog post (using passenger) regarding a setup like this but I'm interested in finding out what some other solutions look like. Or if this is a BAD idea and I should be using different VPS's for each I'd like to know othat too.

You can use for example standalone Passenger or Unicorn instances per application, and reversproxy them via Apache or Nginx so it will respond on default port 80

Related

Multiple Rubies under apache in production server

I want to run multiple rubies on our production server. We have some ruby 1.9.3 rails 3.2 sites going live as well as keep older 1.8 sites. I understand that Passenger 3.2 will be able to do this natively but isn't live yet.
So for now, is this the best way to do this?
http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/
The apache passenger module can't do this. You could however run passenger standalone for each app (with a different ruby version) and then proxy from apache to passenger standalone.
You could of course also proxy to unicorn, thin etc.
What about using multiple VMs/Slices for your different versions of ruby and rails, that way you have more control of your enviroment and don't have to worry about your different rubies/rails causing headaches with each other.
EDIT
Another solution that I have heard of but haven't tried is setting multiple users and running each version of ruby/rails per a different user

Setting up Ruby on rails web application on Linode

I am an absolute newbie to web development and ruby on rails. I am planing to deploy a ror application on the Linode 512 plan. My website would be basically a forum that allows users to upload photos using Ruby 1.9.3 and Rails 3.2.
Which OS should I use? What are their difference? (Ubuntu / Debian / CentOS / Fedora)
Should I use Apache or Nginx? What are their difference?
Should I use PostgreSQL, MySQL, MongoDB or any other kinds of DB provided on Linode? What are their difference?
My target audience would come from China which means I can't use Amazon S3. Should I let the users upload the photos to the Linode server?
Is there any step-by-step beginner‘s guide for this issue?
Thx
First of all, I think you are worrying too much. If you are a newbie, just follow the popular choice for a start, then change, modify, scale as you go. As your skills mature, you will know what best suites you.
Below are some choices that will be easier for you:
Which OS should I use? What are their difference? Ubuntu
Should I use Apache or Nginx? What are their difference? Apache. If it is a small website, it doesn't matter for now.
Should I use PostgreSQL, MySQL, MongoDB or any other kinds of DB provided on Linode? What are their difference? MySQL. MongoDB is a NoSQL database, may not be for you for the moment.
My target audience would come from China which means I can't use Amazon S3. Should I let the users upload the photos to the Linode server? Upload to Linode for now. Don't scale it prematurely.
Is there any step-by-step beginner‘s guide for this issue? Ryan's RailsCasts: http://railscasts.com/episodes/373-zero-downtime-deployment and http://railscasts.com/episodes/335-deploying-to-a-vps, they are must-watch, but not free.
For all these setup, Linode's tutorial is good for a start. You should look at #Stefan answer too.
You should also try to deploy to Heroku just to get a feel of it. Rails Tutorial is good for you to learn up from development to deployment.
There are several dedicated Rails setup guides on Linode:
Apache and Passenger:
Ruby on Rails with Apache on Debian 6 (Squeeze)
Ruby on Rails with Apache on Ubuntu 10.04 (Lucid)
Ruby on Rails with Apache on Ubuntu 10.10 (Maverick)
nginx and Passenger:
Ruby on Rails with Nginx on Ubuntu 10.04 (Lucid)
Ruby on Rails with Nginx on Ubuntu 10.10 (Maverick)
Ruby on Rails with Nginx on Debian 5 (Lenny)
Ruby on Rails with Nginx on CentOS 5
As we have many linode deployment for rails apps my recommendation would be:
ubuntu/centos + mysql/postgres + nginx + passenger
If your application is going to have huge fb inout operations then you can mongodb as choice

Can I deploy a Rails App directly onto my companies website?

I have originally been hosting my apps on Heroku, however this is not an acceptable deployment method in my current environment. We have personal information in our applications that deploying to Heroku and setting up DNS forwarding is not acceptable. Regardless of how 'secure' or 'reliable' anyone may think it is, it is just not acceptable in my case.
Our host is siteturn.com, integrated with Plesk 10.4.4. If I SSH onto our websites server as admin and type
ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux].
rails -v
Rails 2.3.5
It appears Ruby and Rails are already installed (Older versions than I require, as I need ruby 1.9.3 and Rails 3.2) If I'm not mistaken it seems like my host 'supports' rails (why else would it already have it installed :P).
How should I go about deploying my application directly onto my companies website?
Heroku is an awesome service but the ease of deploying to Heroku has given you a skewed view of what is involved in hosting your own rails website. Heroku has shielded you from a lot of the hard parts.
For example, just because ruby and rails is installed does not necessarily mean you can host a production rails website. You'll need a rails specific web server (for example nginx and passenger, unicorn, etc). You also need a database (MySQL or Postgres) assuming your web app uses one. Also, as you said you need to upgrade the versions of ruby and rails.
That's just to get the server setup. After that you can get to the deployment part. Capistrano seems to be the most popular choice right now.
Take a look at this railscast episode on deploying to a virtual private server for a very good overview of what is involved. It also briefly goes into Capistrano as well. It's not a free episode but I feel it's definitly worth the money.
Pick up a copy of Agile Web Development with Rails, Third Edition and read what it says about deployment. That should get you started. There's more info required than can be put in a SO answer.

How to deploy Rails project in Nginx server using passenger?

In my local, I am using werbrick application server for my localhost.
I have Ruby version 1.9.2 .and Rails version 3.1.
How to deploy On live,with Rails Project On Nginx Server?
And What will be the application server (like passenger module with apache) can be used with Nginx server for Rails 3.1 application?
This blog post should give you a good starting point. This one here goes a little deeper in detail. Note: I used these to get nginx running on my local development machine (OSX 10.7) and to host different rails apps locally without using Webrick. Probably there is more to take care of on a live / production system.

with RVM, can multiple rails sites using different rvm's with nginx and passenger?

with RVM, can multiple rails sites using different rvm's with nginx and passenger?
Passenger 3 has support for this. You need to set up reverse proxying, pick which will be your default ruby, and use Passenger Standalone on a different port for each non-default version of ruby you want to use.
Have a read of this article on the Phusion blog - it explains it better than me.
See Installing RVM System Wide and Deployment Best Practices.

Resources