Deploying nginx + Rails5/Puma + PostGIS to DigitalOcean via docker-compose v2.x

If you are starting from scratch the last two articles about this setup should be checked out here and here. There I explain how to setup a development and production docker-compose configuration. Assuming that’s done, we can now deploy the application to DigitalOcean.

# get your API token from digitalocean dashboard
# create a docker-machine using the digitalocean driver
docker-machine create --driver digitalocean --digitalocean-access-token=$DO_TOKEN --digitalocean-size=1gb digitalocean
# make the machine active
docker-machine env digitalocean
eval $(docker-machine env digitalocean)
# deploy the services
docker-compose up -d
# make changes to rails code... redeploy by running
# --no-deps makes sure we don't restart any dependent services
# --build will rebuild the specified service i.e the rails app
docker-compose up -d --no-deps --build app
# and we are live!
open http://`docker-machine ip`
# shut stuff down
docker-compose down
docker-machine stop digitalocean
docker-machine rm digitalocean
video! :D
Like what you read? Give Shoaib Burq a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.