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

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.

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.

Rails in production -- CentOS, Apache, MySQL

I'm a newly converted LAMP stack developer and wondering how to deploy a rails version of our large scale app.
Our servers currently have:
CentOS
Apache 2.x
MySQL
I've read about products that aid in setting up with this stack (Passenger, etc) but I'm concerned with speed and server load (as our app is already a high trafficked one).
How are people deploying rails applications for production use on a similar setup?
How could I setup rails to use this existing stack without adding anything else (or only adding production scale components to it)? -- Sort of a LAMR of sorts (Linux Apache MySQL Rails)
NOTE: The setup will still serve existing projects that are built with PHP -- so the setup can't really break any existing stack functionality
Passenger is a good option and is already used by lots of high-traffic sites in production.
ad. 1. As you already said, Passenger + REE is popular choice.
ad. 2. You could try to run it with lightweight app server like thin or unicorn. http://articles.slicehost.com/2009/4/17/centos-apache-rails-and-thin
Is it possible to not use Passenger and deploy with just Apache and MySQL?
I don't believe you can run rails with only apache and mysql in such a way. Much like the way mod_php takes care of processing the PHP for Apache, a module like passenger (www.modrails.com) takes care of processing the Rails application for you.
You can use the PassengerEnabled off (more info) setting in the vhost to disable passenger for the PHP apps. (although your php app will work fine as long as it is not placed in your rails app without this setting.)
About production scale settings. I believe that Twitter used to use apache as a load balancer to a number of mongrel http-servers. (see this article for some extra information). As you can see, caching (e.g. memcached) can provide a huge boost to your app if implemented well.

Deploy Rails app to EC2

My setup: Rails 2.3.10, Ruby 1.8.7 on Windows
The last time I deployed a Rails app from Windows to Linux on Slicehost, I used Capistrano, Nginx, Mongrel, and SVN. That was 3 years ago, fast forward to now, I'm still on Windows for development and is now looking to deploy to EC2. A quick search turns up tools like Rubber and Chef which aren't easy to grasp with a quick read. It seems like Rubber and Chef are designed for multi-EC2 instances deployment which will be useful when I need to scale.
I'm also new to Passenger but it seems to be the default way to deploy Rails app nowadays, one thing that isn't so clear to me is whether Passenger is a replacement for Mongrel? In my old setup, I configured Nginx to forward the Rails requests to a cluster of Mongrel processes but I don't see anything like that for Passenger.
Any insights are much appreciated.
We use something like what you're describing for our production server: EC2 + Apache + Passenger. We haven't had any need to use the fancy deployment tools you describe - plain old Capistrano (plus capistrano-ext so we can use it for multiple environments) does the job just fine. I've looked at Rubber (not Chef), but deemed it needlessly automagical and too poorly documented, and I'm really not sure what it offers that can't be done just as well with roles in Capistrano.
Passenger has been great. It's an "overseer" that manages a collection of Mongrel-like workers (I had thought that the workers were Mongrels, but upon further reading, I don't think they are. The Passenger comparisons page even compares its RPS to a Mongrel cluster, so...), starting them up as needed, culling them under low loads, restarting them if they crash, etc. It's actually very similar to the Server + Mongrel Cluster you described, but probably a bit better, as Passenger has an understanding of the underlying workers that Nginx / Apache don't. And you'll have to make a few minor tweaks to get Capistrano playing nicely with Passenger.
And if possible, pair Passenger with Ruby Enterprise Edition (from the same guys who made Passenger). It's a much faster version of Ruby, mostly due to a rewritten, configurable garbage collector. You'll have to tune your GC settings to get the most out of it.
Hope this helps!
Both might help:
http://ginzametrics.com/deploy-rails-app-to-ec2-with-rubber.html
Hosting rails on ec2
Rubystack allows you to have the same Rails environment for development on Windows and for deployment on Linux. We also have EC2 images (scroll to the bottom) and it is completely free, so you may want to give it a try.
Also, this may not work for you, but depending on your requirements, you may want to go for a PaaS solution like Heroku

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.

When to use Mongrel as web server for Rails application?

When I started my first bigger Rails application, I chose to use Apache (with Passenger), because I already had some experience with it with PHP, but I don't have any deep knowledge of deploying Rails applications.
How would one choose web server for a Rails app?
Are there any main differences between Apache and Mongrel?
Or is it just a matter of taste?
As you know, two popular setups are:
Apache + passenger
Apache + mongrel (Apache sending requests to your mongrel cluster)
Yes, It is a matter of taste.
You made the good choice with Passenger for your first app as it is far easier to setup.
It is the #1 recommended option on ROR official Website.
Performance is also very good.
Using mongrel is still a good option but it is harder to setup and administrate.
You will need to make sure you are running your rails app against a cluster of mongrel and not only one mongrel instance (for performance/concurrent request reason). Meaning adminstration of your apache + administration of your mongrels.
There is no reason to use mongrel.
The reason you see lots of sites/tutorials using mongrel is.. it was a good choice before Passenger.
Passenger is better on the performance side, dead easy to install and no (for the 90% cases) managing is required.
You can also do Nginx + Mongrel cluster. (I don't recommend it though.) Go with Phusion Passenger. It's pretty easy to setup and it's fast. No reason not to use it.
I use Passenger with Nginx. Besides just the web server, also look into using Ruby Enterprise Edition. It's going to save you a good amount of memory. ~30%. Ruby Enterprise Edition.

Resources