Sign inSign up

vicampo/consul-template

By vicampo

Updated over 5 years ago

Consul-Template

Image
0

7.7K

vicampo/consul-template repository overview

Vicampo Consul-Template with HAProxy

Consul Template is the server that listens for changes in the consul database. On every change it is able to react. Besides that Consul Template can act as a process manager and run programs e.g. haproxy.

This container runs a consul-template which connects to the local consul agent. It also starts a haproxy on and exposes that on port 80 of the docker host. Every service registered is written to haproxy configuration through consul-template if things in the registry change.

For the services to talk to each other they use the service registry router. That is a haproxy which is configured and able to find all instances of all services and loadbalances the requests to the service containers.

Haproxy is run by consul-template and constantly updated with changes in the registry. Every request that wants to talk to a service will do so by accessing haproxy first which then routes to an instance of the requested service.

To access a Service: http://DOCKER_HOST_IP/service-name

Usage, Deployment, Makefile

To build a new image use the

make build

command.

Configuration and Templates

Currently there are two configurations and templates. One for each service type. For each ECS Cluster a different configuration is used. This is unpleasant and should probably be fixed through proper use of the consul-template's templating features.

Usage

The Image starts the consul-template command. To run locally you have to provide volumes for /etc/haproxy and /var/run/haproxy for haproxy to work properly.

https://hub.docker.com/r/vicampo/consul/

docker build -t vicampo/consul-template-haproxy:0.3 .

docker push vicampo/consul-template-haproxy

Internals

Resources

Bitbucket: https://bitbucket.org/vicampo/consul-template-haproxy DockerHub: https://hub.docker.com/r/vicampo/consul-template-haproxy/

HAproxy Configuration

Changelog

0.4 Adjusted Health Ping

Altered the path of the health check in haproxy

0.3 Rearranged config

  • Updated Consul-Template Version to 0.18.1
  • Moved config out of CMD
  • Added configs for "apps" and "services" environment

0.2 Initial Release

Config Changes

0.1 Initial Release

Tag summary

Content type

Image

Digest

Size

7.9 MB

Last updated

over 5 years ago

docker pull vicampo/consul-template