A stack used to automatically register Docker container hosting webapps as services in Consul, distribute them using HAProxy and monitor it with Prometheus.
Documentation is now available at readthedocs, for more details about this project go to http://skynet.readthedocs.org/en/latest
Powered by the following tools:
- Docker: a portable, lightweight runtime and packaging tool.
- Docker-compose: a tool used to manage an application in distributed containers.
- HAProxy: a TCP/HTTP load balancer.
- Consul: a tool for discovering and configuring services in your infrastructure.
- Consul-template: a daemon used to populate values from Consul on your filesystem.
- Registrator: a tool that automatically register/deregister Docker containers into Consul.
- Prometheus: An open-source service monitoring system and time series database.
Ensure you have Docker and Docker Compose installed:
- Docker installation: http://docs.docker.com/installation/
- Docker Compose installation: https://docs.docker.com/compose/#installation-and-set-up
Then, update the docker-compose.yml file and replace ROUTABLE_IP with a routable IP address (use your main interface IP address).
Start the stack:
$ docker-compose pull & docker-compose build
$ docker-compose up -d
You'll need to have a containerized webapp available.
A backend webapp is shipped with the stack, you'll need to build it first:
$ docker build -t skynet-backend backend/
Then run it:
$ docker run -d -P \
-e "SERVICE_NAME=skynet_backend" \
-e "SERVICE_8081_IGNORE=1" \
-e "SERVICE_8080_CHECK_CMD=/tmp/health-check.sh" \
-e "SERVICE_8080_CHECK_INTERVAL=15s" \
skynet-backend \
java -jar /tmp/backend.jar
Point your browser at http://localhost to see the result.
You can place different configuration files in consul/config, they will be loaded by Consul.
You can place your watch handlers inside consul/handlers, it will be mapped on the container in /handlers.
You can access the Consul UI via http://localhost:8500
Access the Prometheus UI via http://localhost:9090