Deploying a Ruby On Rails application - ruby-on-rails

Once I've finished my Ruby On Rails app, I want to deploy it on a server.
What steps should I do?
Should I generate a file as for example a .war in Java?
Thanks a lot

Capistrano is the most popular way to deploy Ruby On Rails. Enjoy this screencast.

If you're deploying to regular server (non cloud) you can use the capistrano gem here's a good screencast on how to. If you want a cloud based service you can't beat Heroku.

You can follow this link.You will get a clear idea about Ruby On Rails app deploy
http://rubyonrails.org/deploy

Ideal and Easy way - you need to you best practices like
Version control with Git
Heroku Setup (which is free) (You can think for engine yard)
Here is the few links
Version control with Git
Deploying with Heroku
Link from Heroku
Please let me know if you need more information on this.

Related

Easiest way to deploy a Rails app (windows)

I have a rails app that needs to be put online (anywhere) - I am using a windows machine, I tried to deploy it using Heroku but that was a huge pain. The app only needs to go online so I can show it to someone - It only needs to be up about a week, so setting up a Virtual Linux system on my windows laptop is not a preference for me.
It sounds like you need to follow a specific procedure to get Gemfile.lock to work for Heroku. This answer has some basic instructions: https://stackoverflow.com/a/21488679/693349
However, you'd probably do better to read the full Heroku docs about "Deploying a Ruby Project Generated on Windows": https://devcenter.heroku.com/articles/bundler-windows-gemfile.
Have you tried Digital Ocean?
https://www.digitalocean.com/features/one-click-apps/ruby-on-rails/
Normally deployment at heroku works like charm, what was the problem?
Try Capistrano gem. Is an especific gem to deploy Ruby on Rails projects and it works perfect!
You have a good tutorial here to configure Capistrano.

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

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

Chef and application deploy

How is it possible to keep my rails application up to date using chef?
While reading documentation I understood how to set up servers from scratch using knife bootstrap. But is it possible to run another tasks after this?
Earlier I have used capistrano but now we have two staging and ten production servers which needs to be up to date when new version of the application is released.
The best thing to do is to look at the built in Deploy resource
You might also want to look at the Application cookbook. This is a bit harder to grok, but it lets you deploy an application driven off a databag.
I found new gem on this topic:
https://github.com/iain/roundsman - it's capistrano + chef-solo integrated

Rails application on shared hosting?

Is there a way that I can deploy my locally made rails app on a shared host that has Ruby installed?
Capistrano to deploy and (Mongrel or Passenger... preferably the latter... or if you HAVE to, FastCGI although FastCGI is pretty slow with Rails) to serve.
If you have a shared host you'll have to vendor your Rails version and all your gems, as you probably won't have access to install gems. Even if you did, you won't want Rails picking old versions of things.
Personally, I would use Capistrano. There are plenty of books and tutorials around that will tell you how to use it to deploy Rails applications. It is very easy to configure.
Dreamhost supports Rails, many others probably do also.
As for installation of your app: it depends a bit on what's already available on your shared host, and what you're allow to do / install / configure there. For Dreamhost, here's their documentation. Other shared hosting solutions may or may not be similar depending on their policy.
The best way I've found is to install the passenger gem. Once you've uploaded your app to your account all you need to do is add a few lines to your .htaccess file and you should be off.
Definitely capistrano + git (git, if you have SSH access, like f.e. in HostingRails shared host), nothing can be easier.
Neat Capistrano guide: http://www.linuxjournal.com/article/10100
How to config Capistrano + git: http://github.com/guides/deploying-with-capistrano
Some nice Capistrano recipes: http://github.com/josh/slicehost
Assuming your http server is nginx or apache, install Phusion Passenger
On the Passenger site, there are very good docs for configuring Apache/nginx with Rails
As a first step, just copy your Rails app somewhere to the host and get Passenger working
Once you have that working, you will need a better way to deploy/update the app; as others have suggested, Capistrano is a popular way to do it and you should have no problem finding some tutorials online to help you do it
I have done steps 1-3 and it is incredibly easy and works perfectly fine (I was just too lazy to do step 4).
Found a good reference : REFERENCE LINK this will help to deploy ROR App on a shared host.

Resources