Question

How can I deploy/automate deploy my (hello-world rails app created by docker compose on my Macbook) to my Digital ocean droplet?

There is no error to post… I’ve implemented the Hello-world app via docker-compose on my laptop (Macbook pro). I want to follow a simple good approach to deploy it to Digital ocean and to automate this deployment (heroku-like).

Thanks in advance!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I got one idea on my mind how you can do it. Heroku is based on GitHub, you connect desired repo to it and you use however you want.

So we can do something like this. Idea is to look repo where you store code for changes, once you change something, pull it on the server. Here comes Git Hooks. It has many features, but one of useful could be execute script on push. In script, instruct server to fetch changes. How To Use Git Hooks To Automate Development and Deployment Tasks will help you understand how it works and how to make it. This tutorial should work for any Git based solution (e.g. GitHub, GitLab).

Beside Git Hooks, GitHub offers you Webhooks. Webhook will send HTTP POST request to your server once you do something in repo. You select which action you want to watch. This will require to set up app on server that will parse HTTP POST request. App can be in any language that can parse HTTP requests (e.g. Ruby (example on GitHub site is written in Ruby/Sinatra), JS/Node, Go…).

GitLab also has Webhooks which is handy if your prefer it over GitHub.

DigitalOcean doesn’t have Webhooks tutorial, but there is chance it appears. :)

You can combine this with Docker/Docker Compose if you want. This is not a needed step, above will work flawless without Docker, but if you want better management, go on Docker can be very helpful. I’ll leave you few DO resources that can help you get started: How To Install and Use Docker on Ubuntu 16.04. How To Install Docker Compose on Ubuntu 16.04. Next one is excellent article, maybe it’ll give you some more ideas: How To Configure a Continuous Integration Testing Environment with Docker and Docker Compose on Ubuntu 16.04.