Skip to content

Traefik: Modern HTTP reverse proxy and load balancing that makes deploying microservices easy

Notifications You must be signed in to change notification settings

samarpanda/traefik-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traefik demo

Modern HTTP Reverse proxy and load balacning that makes deploying microservices easy.

Features

  1. Traefik used as reverse proxy
  2. Configure microservices with automatic service discovery
  3. Automatic loadbalancing of each service with multiple containers

Prerequisites

Docker & GIT needs to be configured

Quick commands

  1. docker-compose up -d - Will start all application together
  2. docker-compose up -d --build - Rebuild if you have file changes
  3. docker-compose up -d proxy
  4. docker-compose up -d pino
  5. docker-compose up -d mino
  6. docker-compose up -d whoami
  7. docker-compose up -d --scale whoami=2 - Automatic load-balancing by traefik for two containers for the same service.

Testing Service

  1. Pino service - curl -H Host:pino.docker.localhost http://127.0.0.1:3000
  2. Mino service - curl -H Host:mino.docker.localhost http://127.0.0.1:3000
  3. Inter service communication - curl -H Host:pino.docker.localhost http://127.0.0.1:3000/mino

Request to different services

  1. Req to pino serice - curl -H Host:pino.docker.localhost http://127.0.0.1:3000
  2. Req to whoami service - curl -H Host:whoami.docker.localhost http://127.0.0.1:3000

Internal communication within services

  1. Use service name and internal port.

Traefik internal data links

  1. Service discovery on traefik routes & services - JSON data link
  2. Traefik dashboard
  3. Load balancing and reverse proxy with traefik

References

  1. Traefik & containers
  2. Awesome Traefik

Communication between microservices

  1. stackoverflow

  2. Containous builds a service mesh on its traefik proxy

  3. Simpler service mesh

Docker compose docs

  1. docker-compose 3

  2. devhints docker-compose cheatsheet

Docker

  1. docker-cheat-sheet

  2. docker network prune - This will remove all networks not used by at least one container.

Others

  1. traefik digitalocean setup

  2. Consul & traefik catalogue example

  3. Using LXD and Ansible to simulate infrastructure