What's Docker easiest way to deploy Rails on production? - ruby-on-rails

I'm interested in Docker as it creates a neat way of setting up an application environment.
EDIT : I'm on Digital Ocean Droplet created with their Docker 1 click Application.
Apparently there isn't a proper way to deploy a Rails application to production, or at least I haven't found it. The setup seems much more complicated then setting up the server from scratch and using Capistrano. I tried using Heroku but it doesn't entirely support Docker.
Is there any good guideline on how to setup Docker to deploy a simple Rails application on a production server?
I read/watched already this references:
The Quickstart: Docker Compose and Rails is ok for development, but then Using Compose in production is too rough and superficial.
The Docker for DevOps course: From development to pro
way too complex, but is the only that at the end tells you how to deploy Rails on Digital Ocean. Anyway there must be an easier way.
Deploying Your Docker Rails App
is just for Heroku.
Getting to know Centurion
does anyone use Centurion to deploy?
Docker + Capistrano = Warp Speed
a bit buggy and outdated.
Running multiple web applications on a Docker host with Apache
the right approach, shame is not for Rails..

Related

Dokku error /var/lib/dokku/plugins/available/pg-plugin/plugin.toml: no such file or directory

So here what I did and the following output:
root#ubuntu-512mb-sfo1-01:/var/lib/dokku/plugins# dokku postgres:link DATABASE ubuntu-512mb-sfo1-01
2016/02/18 05:24:38 open /var/lib/dokku/plugins/available/pg-plugin/plugin.toml: no such file or directory
2016/02/18 05:24:38 open /var/lib/dokku/plugins/available/pg-plugin/plugin.toml: no such file or directory
no config vars for ubuntu-512mb-sfo1-01
Can someone help me? I try to deploy rails to digital ocean.
I use http://blog.flatironschool.com/using-digital-ocean-and-dokku-for-easier-rails-app-deploys/ - this tutorial but it seems to be horribly outdated. I ran into so many errors so I am thinking of giving this up and staying with heroku hosting.
It means that you don't have a Postgres docker container active. Take a look at the dokku-pg-pluging to know how to configure and instantiate a postgres docker container.
By the way, since your objective is to change from Heroku to DigitalOcean, and you're having trouble using dokku, may I suggest you using deploy bot instead? I did managed to successfully deploy an rails 4 app to DigitalOcean using deploy bot. Follow this tutorial. And you can easily follow this guide with deploy bot, adapting the unicorn and nginx stop/start services with the hooks that deploy bot provides.
Edit:
Since you wanted a more specific answer for the deploy bot solution, here goes my approach (this was +/- 3/4 months ago):
Create the droplet and follow the guide to create a droplet, install ruby, rails, unicorn and nginx and the script to control unicorn (it's in the tutorial).
Configure the deploy bot and make sure you run bundle install and another rails' specific commands (changing environments and so on) after the upload (this is a predefined hook).
The last command should be service nginx restart to restart the server (using the script from step 1).
Profit!

Ruby on Rails application deployment on local computer with postgresql

I am new to Ruby on Rails. We have developed an small application with Postgresql. Now we have to deploy it. But when i searched over internet i found lot of suggestion is to deploy them on Heroku or some premium servers. where we are not in a position now to deploy it on cloud.
How can i deploy the application on local computer? Is this similar to setting up a development environment?
Any link or lead will be much appreciated!
I hope you have your application already running on your development environment.
Create another database in your postgres, to use it for production in local system. And make necessary changes in database.yml
I feel passenger is the easiest way to deploy application, you can follow the steps in this link https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04 to deploy your app.
Heroku also have free deployment for few application. You can use heroku.
There are some more option like AWS, Digital Ocean. AWS is also free for one year.
Yes setting up a development environment is like set up your environment. But best practice is use a deployment automation like capistrano.
You can run it in a production environment and make it public. I had written a blog post regarding this.
Please check here
ps - Make sure your system is up for public access and i am hoping that this is for test purpose only and to show it to your clients.
Yes, it would be fairly similar to setting up your development environment.
In addition to setting up Passenger as described in the Digital Ocean post from Rajuk's answer, I use Capistrano for deployment to my Ubuntu servers. You can set up the Capistrano deployment configuration to deploy to any machine.
The possible configuration variables are too numerous to address here without further details about your specific situation.
Check out Railscast #335 Deploying to a VPS where Ryan talks about deploying to a Linux machine (a cloud VPS in this case) with Capistrano.

How to create a VM that mirrors the RoR production version

I am working on an open source project and there is an issue where an upload error only seems to occur on the production side that is running apache and unicorn.
Due to privacy issues and risks, I am unable to mess around in the actual production side (such as creating a temp id for myself with various privileges.
Is there anyway that I can quickly create a VM with such setup in my own computer that would mirror the live site?
The site is running in RoR 4, latest unicorn, and latest stable version of apache.
There are a couple of ways you can be able to accomplish this. You can use vagrant and also with the rising popularity of Docker containers, you can easily model production environment on your computer. Since you indicated a faster way to get the VM up and running, I would recommend using railsbox.io. Its amazing and it saves you a lot of time. According to their webiste -
Fast and easy Ruby on Rails virtual machines. Streamline your
development workflow in no time by creating production-like virtual
machine with your development environment. Try this extremely simple
to use VM configuration tool to create new Ruby on Rails server using
vagrant and ansible.
The app helps you setup a VM with ease.

Running RoR in isolation on Ubuntu VPS

Apologies for these stupid questions (please explain why if you're going to downvote).
I have a site running on a LAMP stack on a Linode Ubuntu VPS and want to learn rails on the remote server without causing disruption to the site currently at mydomain.com.
1) Can I install rails the normal way (as I would on my own PC), and have it not effect the site that is currently up?
2) If a generate an app skeleton after installation, after starting the rails server, how can I navigate the default view?
1) Your test Rails app and the production PHP app can co-exist (hopefully you know your way around Linux) on the same server without interfering with each other. However, I would not recommend this. Bad idea to be trying experimental stuff on production VMs/VPSs. You are better off spooling a test VPS for Rails or better still use VirtualBox VMs on your local machine.
2) Rails apps start on port 3000 by default. So on the VPS, you can reach the Rails app root at http://xxx.xxx.xxx.xxx:3000 (replace the x's with your VPS's IP addr.)

Deploying Rails github with a SharedServer

I am trying to deploy a Rails application online. My host right now is dream host. Although i am not to sure how to deploy my apps. At the moment i am on a shared server, but i am considering upgrading to a VPS, but the questions remains! Do i need Git hub or not. If i need to have git hub to make it private do i have to pay or an alternative exist.
What I meant by not to sure on how to deploy rails is that I have a localhost provided with webrick and with database.yml settup otherwise everything else is dark for me.
You can use capistrano to deploy you application to shared host or VPS via SSH.
https://help.github.com/articles/deploying-with-capistrano.

Resources