Ruby on Rails on Linux hosting - ruby-on-rails

I am about learning to program with Ruby on Rails but I'd like to know if web applications built on ROR can be hosted on the regular Linux servers.

Absolutely. One of the great reference books on Rails, "Agile Web Development with Rails" (written by the guys that created Rails), takes you through a whole demo app that includes server setup, configuration, deployements, everything. They deploy on Linux.
I also ran a site for over a year that was a Rails app, on Linux, and it totally rocked.
I think you'll also find that the broader Rails community prefers Linux. That means when you need help with something, you're much more likely to find someone else who has had your specific problem and is able to help you fix it.
You may also find this question helpful in choosing - how to select a Rails host (if you don't host it yourself).

Yes they can be and its advised to use Linux Hosting. I hardly if anybody uses windows hosting for Ruby on Rails. As for servers, You can use
A server called Mongrel ( in a cluster ) Behind Apache or Nginx.
Unicorn
Apache with Mod_Rails ( Phusion Passenger )

Related

Setting up Ruby on Rails for web development

I was considering installing, setting up and using Ruby on Rails for web development. Where should I start and how does Ruby on Rails work with a local server? Any OS where Ruby on Rails is optimal or any general advice I should know?
Any OS where Ruby on Rails is optimal or any general advice I should know
Linux and Mac OS are by far the most popular dev OS's for Rails - you can install dependencies much easier.
Windows can be a real pain with Rails at first. Not rails, but its dependencies. These are called Gems and work like plugins.
Certain gems require external binaries / C headers for them to run. Two of the most notorious are the MYSQL2 and RMagick (ImageMagick) gems.
--
I don't know the core problems (it's something to do with MINGW32 / Win32 environment), but Windows often has a difficult time with certain gems.
Not that it's stopped us - we have a series of Windows machines devs use to create truly incredible RoR apps (very difficult to get them all running smoothly).
DB
You don't get a DB with your Rails install - you need to have that running separately.
If you don't want to install a local MYSQL server (which can be a pain), I'd recommend getting some cheap shared hosting (with unlimited MYSQL db's). This will allow you to hook up your app to a third party DB host, negating any data integrity issues if your dev machine has problems.
Make sure you have PHPMYAdmin too - it's a life saver :)
Although Rails with many different SQL variants, MYSQL is the most popular. Heroku has made PGSQl quite popular within the Rails community, although I'm not up to speed on the major differences.
how does Ruby on Rails work with a local server
Rails comes with its own web server for development, called WEBrick.
Honestly, WEBrick is a pile of shit but it works.
You just need to load up the cmd, type rails s and it will fire it up. If you get some more experience, you can use the likes of puma or thin as dev servers (they are much faster and better mimic the production environment)
In production, you'll be best using one of the commercial-grade servers like Apache or NGinX, good tutorial here.
Getting Started
There are a ton of tutorials to get started with Rails.
Some of the best resources are:
RailsCasts (stopped mid 2013)
GoRails (still active)
Michael Hartl Rails Tutorial
Finally, enjoy yourself. I remember the Tumblr guy saying that he got such initial traction for Tumblr through the Rails community (he said they're the most committed bunch ever). He was right, the Rails community is a big family who all love code.
Download Rails from http://railsinstaller.org
go through online tutorials and start working
it a beautiful language to work with

Deploying rails app basics

I've been self teaching myself ruby and rails for the past year and finally have an app ready that I want to deploy out to the world. While I can relatively easily deploy to Heroku, I would rather learn how to configure things myself but I have very little understanding of web servers and what all is needed to deploy things. I've done a lot of research and it seems like most rails apps are deployed with some combination of unicorn/puma with nginx and Capistrano. I was hoping someone had resources or could explain the bare-bones basics of these tools.
I am mostly confused about unicorn/puma vs nginx. They all seem like web-servers, but clearly nginx is different from unicorn. I have no idea how they interact with each other in order to serve web applications.
I know Capistrano is used to deploy code, but I have no idea what that actually means.
Lastly, how do these tool interact with hosts such as AWS or digital ocean.
Any help or resources that can get me started would be appreciated.
This is the best overview that helped me understand the different options that are available: Ruby on Rails Server options. It covers most app servers and how they compare practically, and it covers Capistrano at the end.
Personally, I use AWS OpsWorks for my production environment (they have a Free Tier available for a year) which has a default Rails on Nginx or Apache app server layer: http://docs.aws.amazon.com/opsworks/latest/userguide/workinglayers-rails.html.
I found the Deploying Rails book to be a comprehensive resource for all things related to rails deployment. Unfortunately it is out of print. I doubt if it is too outdated even if it was written for rails 3.
There are quite a few good blogposts; one I found very helpful was http://robmclarty.com/blog/how-to-deploy-a-rails-4-app-with-git-and-capistrano
Note: The above blogpost uses capistrano version 2.14.2.
I would advice following the same steps to understand capistrano, and then use http://capistranorb.com/documentation/upgrading/ for upgrading to capistrano version 3.x
This guide is pretty helpful and succinct
Using Capistrano 3, RVM & Puma
https://coderwall.com/p/ttrhow/deploying-rails-app-using-nginx-puma-and-capistrano-3

Rails Production Web Server on windows

I'm almost finished with the development of my first ruby on rails app. I am using windows for development. Now i want to deploy my app (most likely on iPage web hosting). the procedure described in Agile Web dev... appear to only work on MAC OS X (with passenger, etc) and didn't have much luck googling.
My questions are:
1- Is there a good and easy to follow tutorial/book/etc on how to set up local production server on windows (e.g. using apache and mysql (Possibly WAMP)) and porting it to a remote host?
2- can the book "Deploying Rails Applications: A Step-by-Step Guide" help me?
3- Would it worth the effort that i install VMware,Ubunto (or another Unix/Linux based OS) and do the production there?
Thank you!
I ran into a similar situation where we had to decide on Rails app deployment to a Windows server rather than to a Linux one. I did some research but never tried out anything since fortunately we decided to stick with a Linux server. I was not particularly happy with what I found but here it is in case it helps:
Deployment to Windows using Capistrano based gem
Articles on other deployment options to Windows

How to configure and deploy Ruby on Rails Application on server using apache, heroku or Phusion Passenger dont know about such terms

I am new to Ruby on Rails. I have been working as junior developer and most of time working on localhost so don't know how to launch Ruby on rails application, How to Configure Ruby on rails application and how to deploy it.
often I came accross following terms but don't know It's meaning and how to use them and where to use them.
Apache
Phusion Passenger
Heroku
nginx
Please Help me and also looking forward to any good tutorial to learn all that terms.
Thanks.
I think there is quite a lot of resources on the web for this, but :
Heroku is a platform as a service. Basically, you push your rails app to a git remote, and that's it, deployed. You can manage addons, workers, and processes from CLI, and scale up/down if you need. Probably the most painless way to start with.
Apache & nginx are two werbservers, I'd say they are the most common in the rails world. Nginx is the latest of the two and it seems to be better for most of the tasks, but if you want to know which to choose, there is several posts on the internet for that too.
Phusion passenger is the bridge (or one of the available bridges) between your rails app and your webserver. If you've done php before, think of it as mod_php.
Since this is all new to you I'd advise that you start with hosting on Heroku. You can do a lot with the free version and it's arguably the easiest way to get started with hosting your rails website. Check out the getting started guide from Heroku. There's also another beginners guide here.
Once you feel comfortable with Heroku your next step could be looking into hosting on your own virtual private server (VPS). The setup is much more manual but things that would cost extra money on Heroku are now free if you set it up yourself on your VPS. Here is a great article on VPS hosting.
For reference, I was hosting websites on Heroku for about a year before I started looking into hosting on my own VPS. Now what I do is start by hosting my projects on Heroku since it's the fastest way to get up and running. Then if the website is successful I transition to a VPS.

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