Deploying several Rails apps on a mixed (with PHP and other Ruby apps) environment
I have a Linode (Ubuntu 9.10, but upgrading not a problem) where I run a few PHP applications and had a Sinatra and Rails 2 app running. I tried to deploy some new Rails (3) apps but in doing so, broke nearly everything :).
My requirements are simple:
- The PHP applications kind-of make "LAMP" a requirement, even if that runs on a different port then :80, behind some proxy is fine.
- I want to run several Rails3 and Rails2 apps.
I need to use different versions of gems in these apps.
Additional services such as SOLR, MongoDB, MySQL and Resque are installed and running, so currently not a problem, but a requirement nonetheless.
Before, I had just one Rails app and a simple Sinatra app behind Phusion Passenger, the gems where installed globally. When introducing a Rails 3 app, gem-version-conflicts would arise, so I have installed RVM, but that breaks the existing app severely.
An example of the problems I run across: The existing app, is Tracks, which has all its gems packaged in vendor/gems, some of which are not available on rubygems.org. I could not make RVM recognise these gems. I keep running from one problem (RVM not recognising vendor/gems, rake gems:install not installing, conflicts between Rails and rubygems versions etc.) into others. I am not seeking solutions for each and every issue in this question.
The new Rails 3 apps prefer Ruby 1.9, yet Passenger is installed against ruby 1.8.7. I have managed to downgrade these Rails3 apps, so they work on 1.8.7, but a solution that allows me to use whatever ruby-version is best fit for the app would be preferrable for me.
How would you set up a server like this? 开发者_运维百科Would you set up such a server in the first place? Are there affordable commercial solutions for this? Or should I seek solutions such as a VM for each app? About the load and usage: this is mostly for personal and demonstration use: so each app has to serve max 800 pageviews/day: very, very low usage (The actual deployemnt for heavy-used apps and client projects is done on dedicated servers).
For Rails 2/3: Not an easy task but can be done: http://jeremy.wordpress.com/2010/08/19/ruby-rvm-passenger-rails-bundler-in-development/ Just make sure you are using latest rvm, passenger.
For PHP and Rails, I'm using nginx with passenger and it works fine. I have a default nginx php config and default passenger added settings for Rails.
精彩评论