Running multiple Phusion passenger instances for one rails application - ruby-on-rails

is it possible (or a good idea) to run multiple Phusion passenger instances on 1 server (same rails app on many instances).
I wanna use Nginx as Frontend webserver (loadbalancer).
Any best practice?
Thanks

Yes it is possible and quite easy. Just you need to run it on different port.
You can refer this link.
In this, they have ran same application on multiple ruby version.

Yes it is possible and works fine. Just make sure they're assigned on different ports.

Related

Config rails server on vps hosting

I must configure my RoR vps hosting for my rails app, but on my localmachine i simple use webrick...
Are any ways to do this on server, so that it will be faster, and also, if it reboot's or memory down, or something that call's shutdown of server, then it automatically starts?
Also how about rails enterprise?
Now i have clean ubuntu server, and rvm on it
Follow this tutorial, it's great for beginner and will answer all your questions: http://coding.smashingmagazine.com/2011/06/28/setup-a-ubuntu-vps-for-hosting-ruby-on-rails-applications-2/
Which webserver to use depends on many things. Among others, there's Thin, Unicorn, Rainbows, Puma, and counting.
I suggest you look on google (or even here, I'm pretty this was answered before) for comparisons between ruby webservers, so that you can know what situation each of them are adapted to, and which one will fit your needs best.
For production deployment you need to install nginx or apache,
nginx is lightweight ,consider installing nginx,
Now there are various ways simple and easy to install is passenger with nginx
Or simply you can use nginx+unicorn or nginx+thin you can find various article just google it.

Running Thin Faye instance separate from nginx+Passenger

I have several Rails apps running by Passenger+nginx 1.2.
I need to add some Comet features to one of them, but i don't want to add any tcp_module and rebuild nginx, i just need separate Faye+Thin instance running on subdomain of my app http://faye.myapp.com:9292 (on the same Ubuntu machine) and listening clients directly.
Is there elegant solution of that problem?

Are there any easy-to-configure webserver with ruby for Windows?

Are there any easy-to-configure webserver with ruby for Windows ?
I am hoping to find a webserver that can easily be configured to work with Ruby on Rails or Sinatra.
Anyone know of any ?
I use Sinatra+Thin on Windows, sometimes behind either Apache or Nginx as a reverse proxy (to speed up serving static files and to create a pool of 2-4 server instances). The speed is not as good as it is on Ubuntu with similar (or lesser) hardware, but at work I have to use certain servers allocated to me.
To use Thin with Sinatra, simply install Thin, and Sinatra will use it. If you need further help configuring Apache or Nginx, post more questions (after searching the web, of course).
If you want easy, stay with WEBrick.
If you want a production server, go with Apache + Passenger. But that won't be as simple as just using WEBrick.
Probably it is not answer you want but: http://rubyinstaller.org/. Installation is easy - follow instructions to install rails.
Second step is enable/configure port/application in firewall. Because ruby server works on port 3000 but http is common on port 80.
BUT this RoR environment is for development, so don't expect high performance.

Webbrick/Mongrel vs Passenger + Nginx for development?

Here is my case:
For production I use Heroku.
The question is what should i use for development:
My alternatives are:
Built in Webbrick (or Mongrel)
Passenger with Nginx
The question Im asking myself is:
Why would I use the second alternative when I will upload my application to Heroku anyway. Isnt it better to just use Webbrick/Mongrel instead then for development?
Thanks
I deploy to Heroku a lot and use either Webrick or Thin. No real point in setting up a more complex environment.
The most common use case for Nginx or Apache in development, is when the project makes use of specific features in either server. Since you're deploying on Heroku, there is as far as I know no way of configuring the server setup.
So I can't think of a reason why you should use Nginx while developing.

Running multiple web frameworks on one machine?

I want to start experimenting with all these different web frameworks that are available. I was wondering if they could all run in one machine at the same time?
I know that all my database services can all run at the same time, along with the Javascript frameworks, but what about something like Rails and Java applications? Can those play along with each other? Will Apache handle all of this for me?
Yes, since almost any language framework runs as normal code for the language, simply providing structure for applications you write, they can coexist well with other frameworks for the same or other languages. You can certainly run Rails and a Java framework on the same machine - you could even run Rails on JRuby and a Java application server
It sounds like you're just getting started programming. I would recommend learning some of the basics first. For instance, if you want to learn Ruby, try the Pickaxe book, write some simple scripts, then move on to a ruby web framework like Sinatra or Rails. You'll have a better understanding of the difference between a language and framework, how each is installed and run on your machine, etc.
The easiest way to begin experimenting is to use the development server that is included with the various frameworks and run the server on a different port (not 80). For Rails, this is done via:
ruby script\server
which will start a server on port 3000.
Other frameworks use other approaches. Most tutorials for Ruby and Python frameworks (with which I am most familiar) will include instructions on how to start a development server like this.
I don't see why not. It really depends on how the frameworks are deployed and in what containers. If they use separate containers (e.g. tomcat vs apache) you'll need to make sure that the containers are configured to use different ports since many web containers use 80 or 8080.
If you plan on running them all in the same container (e.g. Apache) then I would think they'd be fine, since each one can be treated as a separate web application and deployed to a different location in your document root.
For the most part, it'll probably be trial and error. I don't know much about how Rails interacts with Java, but I've run Grails and Java applications together easily myself with few problems.
I run Rails, PHP, and Java with one Apache server. Except for what felt like a ton of apache config munging when I set it all up, it's been fine. I'm not much of a sysadmin, so it took me a few days to get everything running right.
PHP, Java and Rails all have environments that let you run independent servers and save complex configuration.
Java you can use Tomcat or Jetty.
Rails comes with Webrick, which is fine for development.
PHP has XAMPP (or MAMP if your on the Mac) gives you a complete stack.
I run Rails and ASP.NET MVC on the same Machine and I just set my local servers to run on different ports. But usually the default setup (e.g. Rails on port 3000) will not conflictwith each other, plus each framework usually has its own way to run (LAMP, Webrick, Montgrel...) so you should be fine.

Resources