Is there any advantage to using WEBrick in development mode for Rails? - ruby-on-rails

I develop on a Mac, and I'm pretty comfortable setting up an Ubuntu VM with Apache installed, so "you don't need to install Apache" is not really a reason. I run Ruby from the VM anyway, so there doesn't seem to be much difference in system resources needed.
In my head, the advantage of using Apache is that it's going to perform more consistently with my production server.
So what reasons are there to use WEBrick? Does it make development easier somehow?

No there are no advantages. The only "advantage" is that it is the pre-bundled webserver so you at least "have something"
I'm sure most experienced Ruby devs use something else like thin, mongrel, unicorn, pow, passenger, etc...

I'd go for phusion passenger + passsenger pref pane: http://www.fngtps.com/2008/06/putting-the-pane-back-into-deployment
Awesomeness. This way I can act more like the production server and take it easy when adding new projects etc.

I've been using Rails for a school project, and I find the colorized logs helpful when I'm trying to figure out what the server is doing. Sure you could tail -f the apache logs, but color is nice IMO.

Related

Chef cookbooks to set up a Rails production server (CentOS)

So, I got tired of seting up production servers for my Rails apps all the time and decided to learn to use a tool that can simplify that process for me. I choose Chef-solo.
I've read the documentation and watched some tutorials, but I'm not realy sure I understend the process well, so I decided to go right to practice and learn on the way.
Now the real question: can someone provide me with a set of correctly working cookbooks to set up the server so I wouldn't need to reinvent the wheel myself?
OS - CentOS v.6.0-6.3
Software:
Development Tools (groupinstall)
git
Node.js
ImageMagick
Nginx and Unicorn
MySQL and PosgreSQL
Mail Server POP/SMTP/IMAP
RVM + ruby
MemCache
Think that's it.
Ofcource I need not only to install the packages, but also to configure them properly.
Any suggestions or additional info needed?
You can try looking at my repo at https://github.com/dmytro/chef-solo
I am using it to bootstrap Rails environments for myself.
Additionally it can be combined with Capistrano deployment. I use this in my capistrano recipes https://github.com/dmytro/capistrano-recipes
I've put blog post on these. Please lake a look too: http://dmytro.github.io/2013/05/21/easy_spawn_new_hosts_with_capistrano.html

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.

Ruby on rails with unicorn

What is the best deployment environment for a RoR app? Someone has suggested Unicorn but am not sure. Any suggestions?
Update:
well, i have a small app with just 3-4 pages and will be accessed by not more than 25-50 concurrent users. "best" here means, ease of deployment of the app and ease of maintenance of the environment itself. Obviously stability of the solution matters as well
You should try passenger standalone, it uses nginx under the hoods and is lightning fast with little configuration. Especially when you use many apps on one server, with different gemsets and ruby versions.
Even using nginx under the hoods, you can still choose apache or nginx to maintain your webservers domains using sockets.
read this article:
http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/
In terms of ease of deployment and maintenance.
Then its hard to beat Phusion Passenger.
It appears as an apache or nginx mod.
I always go for the apache mod
as I prefer to have apache installed from apt,
and I find it easier to do version upgrade.
It can be installed as simply as;
gem install passenger
passenger-install-apache2-module
And from then on the install process will tell you exactly what to do.

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

How to use a VM to create a Rails staging environment

My app is in development and I do all my testing using WEBrick (I like the terminal output).
On the production server it will run on Phusion Passenger.
I'm running Snow Leopard and wish to test the app in an environment similar to the production environment.
Can I use Parallels to run a Debian install with Apache and Passenger and configure Capistrano to deploy to that?
Thanks!
I have been using VMware for that sort of thing. Its really easy to deal with network wise. I have recently switched to Virtualbox which is much nicer to actually work in (at least for me), does the same things, and is free. Download the Debian iso and create a new VM that uses it as its CDrom. Thats about all you need to do. Good luck.
This may not be the answer you're looking for but I've found it very straightforward to just run passenger locally for development. You can always tail the development.log, it's really just as easy as watching the terminal output from webrick.
Dev setup is made all the easier with the drag and drop ease of the phusion passenger pref pane.
http://www.fngtps.com/passenger-preference-pane
Seems like it would be easier than setting up the VM and all. Though yes, there could still be differences if your not hosting on OS X server I suppose.

Resources