Digital Ocean docker clustering demo with terraform
Shell JavaScript Java HCL HTML CSS Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
backend
cassandra-petset
frontend
haproxy
presentation
terraform
.gitignore
README.md

README.md

Digital Ocean docker cluster demo

The aim of this project is to supply some example configurations on how to set up a complete HA cluster of a simple three-tiered application on Digital Ocean.

Digital Ocean was chosen because it is a quite bare-metal approach, and lacks a lot of functionality of bigger cloud providers, like AWS, GCE or Azure. Most of the steps described here can however be used on other providers, but note that some functionality, like virtual networking or load balancing have a much better support on them, and you might opt to use them, instead of the bare-metal approach. However sometimes it is good to know how things interact with each other to get a better sense of what's happening in the background. Also knowing how to solve the shortcomings of a bare-metal approach can help you in not getting vendor locked in with a specific provider.

The demo application is a slightly modified version of Todo Backend, with support for Cassandra as a database layer. You can find these modifications inside the various directories:

  • frontend: This is Todo Backend's frontend, modified so it is served from a docker container, and you can set the API url from an environmental variable during boot
  • backend: This contains the Dropwizard backend, slightly modified to use Cassandra as the database layer instead of an in memory store
  • api: This contains HAProxy with an rsyslog changes that will make sure the output is logged to stdout, for better docker logging compatibility
  • cassandra-petset: A cassandra container modified to be usable with Kubernetes' PetSet functionality. Code is from k8s for greeks rebuilt, so it can be stored in docker hub, instead of gcr.io

Prerequisities

The steps to deploy the cluster are done in stages, you can find them inside the terraform directory.

To run them you'll need the following:

  • Register to Digital Ocean. You can use this referral link to get $10 free credit once you sign up. Finishing the demos should not cost you more than $2 (unless you want to keep the services running and don't shut them down). You will need to add either a credit/debit card or a PayPal account before you have access of creating new droplets.

  • Install terraform. You can either download the binary, or you can use the following package managers:

    • homebrew on Mac OS X: brew install terraform
    • chocolatey on Windows: choco install terraform
  • Install git if you don't have it, then clone this repository to your local machine:

    • git clone https://github.com/sztupy/doclusterdemo.git
  • Make sure you have ssh and scp working. On Windows you can use git's bash prompt. Also make sure you have an SSH public key, and it is accessible at ~/.ssh/id_rsa.pub

  • Generate a new access token on Digital Ocean, and write the code down.

Once you have them up and running, continue with the first step