docker-service-discovery-with-etcd icon indicating copy to clipboard operation
docker-service-discovery-with-etcd copied to clipboard

Service Discovery With Docker and Etcd

This repo is a proof of concept to test out service discovery with Docker and Etcd. The setup for the test, is

  • Provide access to a Java app running in a Docker container with a fixed name/port
  • This Java app makes a call to another Java app via an address that it discovers
  • The second Java app connects to and uses an instance of Memcached

See also, this same test with Docker links

ps. this test also implements load balancing between the Java services

pss. this test makes use of two additional components. They are both published to Docker Index, but are also shared on github:

  • etcdbridge a python service to monitor the health of my docker containers and publish their addresses to etcd.
  • etcdedge a python service to sync etcd configuration to redis for hipache to use in routing "edge" traffic

Build & Run

add the following to your host file (/etc/hosts)

127.0.0.1 client.local

build the project

./gradlew shadow

build the container image

sudo docker build -t="benschw/service-discovery-etcd-example" .

Deploy the test environment

sudo ./run.sh

Beat up the environment (and watch the list of random numbers grow with each request)

curl http://client.local/demo

Bitdeli Badge