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

Shoaib Burq
1 min readJan 25, 2017

--

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
DO_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# 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

--

--