Question

Deploy Dockerised Rails app

Posted July 22, 2021 143 views
Ruby on RailsDockerDeployment

Hi,

I’ve been looking into Docker recently, mainly for wanting to try it for development. I’m still working on getting my app working in Docker in dev, but as an extra thought, I wondered about whether I could use this same configuration to deploy my app to a production server.

I came across the following video, where the developer creates a droplet on Digital Ocean and gets the app running from his image.

https://www.youtube.com/watch?v=it1AJA7y9GE

He does this by having two docker-compose.yml files which makes sense, one for each location and the production one changes the RAILS_ENV var as expected.

At the end of the video he states that, it’s not the most ideal way to deploy a Rails app as there is a lot of other things that need to be done. Eg, Nginx, Logging and from my own thoughts, linking a domain and also adding an SSL cert.

Are there any guides or videos out there that can explain these extra parts and can explain how Docker can be used fully and properly in production with all these extra parts?

Currently, my app is not running in a Dockerised environment and I use Capistrano to deploy, it works I guess but I feel like deploying my app from a local dev docker to a production docker may be a nicer setup.

I’d love to find a workflow to easily and repeatably deploy my dockerised app from development to my DO droplet in Production mode but I can;t find anything to help or show/guide me how to achieve this.

Any ideas?

Thanks,
Neil

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

I believe that the most straightforward approach to deeply your Dockerized application to a production-ready environment, would be to use the DigitalOcean App platform:

https://docs.digitalocean.com/products/app-platform/

You can deeply directly from Docker Hub or you could provide your Dockerfile and have your app built and deployed at the same time.

Alternatively, you could use Kubernetes for your container orchestration. Here is a good tutorial on how to do that with Rails and Kubernetes:

https://www.digitalocean.com/community/tutorials/how-to-migrate-a-docker-compose-workflow-for-rails-development-to-kubernetes

Hope that this helps!
Regards,
Bobby

by Kathleen Juell
by Jamon Camisso
When building modern, stateless applications, containerizing your application’s components is the first step in deploying and scaling on…