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

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.

Related

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

deploy rails choices

After I finished reading Agile Web Development with Rails, I Have developed my own website.
Now I am trying to deploy my project on linux system I rent, but I know nothing about how to deploy rails.Which server should I user? How to connect to mysql database?
As a java developer, I know I can use tomcat as my server which can convert http request to my own object and use jdbc to connect to my mysql database.
Now I want to know what is the main stream environment rails deployed?
I have heard of Lighttpd and FCGI. Can I use them in the product environment?
thanks
Is your linux system a full VPS (you have complete control?) If not, check your hosting company to see what options are available to you. If so, check to see if they have guides for setting up Rails. A lot (Slicehost, Linode, etc.) do.
Failing that... I would recommend either Apache (or Nginx) with Passenger.
https://www.phusionpassenger.com/
It's pretty straight forward.
As for actually deploying, look into Capistrano (or Vlad). These are a little bit more complicated, but they make life so much easier in the long run.

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.

How to deploy Rails app (like redmine) on load-balanced PHP server?

I'm new to Ruby and Rails, but my team is interested in using Redmine for project management. So my question is as follows: How does one deploy Redmine to a load-balanced server (so really two servers) that doesn't currently run and Ruby/rails apps? Would it be necessary to install ruby/rubygems/etc on both servers and proceed with the installation from there? Thx.
If you are going to deploy any rails app, you'll need to have ruby, rubygems, and probably phusion passenger or some other app server (thin, etc.), on both servers.
For redmine, you should consult the install docs:
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
And the howto guides for install:
http://www.redmine.org/projects/redmine/wiki/HowTos
In general, when load balancing, the trick is the db, and you can use a number of tricks to replicate and load balance the db, as with any other rails app.
There seems to be one guide for that in the wiki, that leads to these (not terribly helpful) comments:
http://www.redmine.org/boards/1/topics/24727?r=24739#message-24739
http://www.redmine.org/boards/1/topics/16687
My own advice would be to set-up both servers as serving up the rails app, but have one be the active master db, and the other the passive slave, then set-up monitoring on the master and if it goes down, promote the slave to master. How to do this is a longer answer, and much code has been written in this direction. Look-up DRBD and Heartbeat for how to do this on linux for mysql.

What to do after Rails deployment?

I am am a newbie in Ruby on Rails development and I am learning this fantastic framework fast and easy. The only problem (which is a big one) is how to deploy.
I have tried a Linode StackScript which installs Ruby, Rails, Passenger and Nginx and I have made a "cap deploy" and all files was sent to the server but how on earth do I get this public. When I visit my website (IP) it seems to be down or not responding. Is there anything I need to do after deployment to make my app available to the web?
Thankful for all help, I really want to slay the deployment beast!
For ease of deployment, and scalability, have you looked at Heroku instead of hosting your own server?
That would make the process of deploying as simple as git push heroku

Resources