Help : How to deploy ruby on rails code in production environment?

Please explain how many way we can deploy ruby on rails application in production and what is the best way ?

Easiest way:

  1. Have your code on Github.
  2. Signup for Heroku and create an “app” there.
  3. On the app dashboard, go to “Deploy” and set it to auto deploy your github project.
  4. On the app dashboard, go to “Resources” and add Heroku PostgreSQL and Heroku Redis addons
  5. Go back to “Deploy” and hit the button to deploy the app. Wait until it is done
  6. Go back to “Resources” and add “Web” and “Worker” dynos.
  7. Click “Open app”
  8. Done
2 Likes

Hi, you can also use Dokku or Digital Ocean APPS (new feature in BETA), Hatchbox.io , cloud66 also almost all shared webhostings with plesk control panel supports rails.

Also on youtube you can find many videos how to deploy a ubuntu or ebian server yourself for example suando capsitrano dokker.

Deploy Ruby on Rails To Production in 2019: Deploy Ruby on Rails To Production in 2019 - YouTube

Hope you don’t have a problem with it. Let me know if you need help with something.

2 Likes

I’m a big fan of Hatchbox.io I have written about it here

I use it in a bunch of production servers. It has been great.

The choice of the Ruby on Rails application deployment method can be divided into two categories - your own server managed by you (e.g. hosted on Digital Ocean or AWS EC2) and code upload tool (e.g. Capistrano or similar) or a more automated cloud solution, like Heroku or AWS Elastic Beanstalk. I highly recommend the latter 2, because it saves an incredible amount of time, and they are not expensive at the beginning. Both Heroku and Elastic Beanstalk (EB) are based on Git. Deployment is as simple as git push [heroku] [master] or eb deploy. EB will use the git archive method and upload the archive to the servers instead of the push command while Heroku relies on your project’s repository clone.

PS. hatchbox, cloud66, dokku and digitalocean apps (nanobox) look like good alternatives to the solutions described above, but I haven’t tested them yet. They fall into category of fully automated solutions similar to AWS EB and Heroku.

2 Likes

As my analysis, i would like to know that, is nginx with passanger or nginx with puma also a way to deploy ruby on rails app on production?

Thanks

All of those are combinations of a reverse proxy (the Web server that interacts with the end-user’s browser) and an application server (the code that interacts with Rack to host your Rails application). They have nothing to do with deploy per se, and everything to do with the actual hosting of the application, as in its interaction with clients.

Walter

Coming back to this, I’ve open sourced the Ansible project that we use to handle our devops and deployment. It also includes various guides explaining the architecture, the workflow, etc.

If you need something simple to get started, then go for Heroku.

If you have a large application that may have significant infrastructure costs, then I recommend using Kubernetes, because Heroku is really expensive at scale (we use DigitalOcean):

https://kubernetes-rails.com

Also note that if you have DevOp knowledge also Capistrano on simple DigitalOcean droplets is a good and reliable solution (quite simple to setup, harder to scale if you need to change the infrastructure often).

1 Like

if that can help, I deploy my rails app on AWS Elastic Beanstalk.

I prebuild my docker images, so they are fast to deploy and ready on autoscaling. I came up with a little script that makes it easy.

hopefully this helps