Skip to content

Commit

Permalink
docker: Add load balancing with traefik
Browse files Browse the repository at this point in the history
  • Loading branch information
nkprince007 committed May 23, 2018
1 parent 280b07c commit 98780dd
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,51 @@
version: '3'

services:
traefik:
image: traefik
command: --api --docker --docker.exposedbydefault=false
ports:
- 80:80
- 8080:8080
volumes:
- /var/run/docker.sock:/var/run/docker.sock
consul:
# Consul will be used to manage service discovery
image: progrium/consul:latest
hostname: consul
command: -server -bootstrap -rejoin
ports:
- "8300:8300"
- "8400:8400"
- "8500:8500"
- "8600:53/udp"
- 8300:8300
- 8400:8400
- 8500:8500
- 8600:53/udp
rabbit:
# rabbitmq will be used as message broker to interact with other services
image: rabbitmq:management
hostname: rabbit
ports:
- "5672:5672"
- "15672:15672"
- 5672:5672
- 15672:15672
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=password
listen:
# listen is the actual listener service
command: /bin/sh -c "sleep 5; ./app;"
image: registry.gitlab.com/nkprince007/listen:latest
# build: .
ports:
- "8000:8000"
- 80
environment:
- MICRO_SERVER_ADDRESS=:80
- MICRO_REGISTRY=consul
- MICRO_REGISTRY_ADDRESS=consul
- MICRO_BROKER=rabbitmq
- MICRO_BROKER_ADDRESS=amqp://admin:password@rabbit:5672
links:
- consul
- rabbit
labels:
- "traefik.enable=true"
- "traefik.port=80"
- "traefik.backend=listen"
- "traefik.frontend.rule=Host:listen.traefik"

0 comments on commit 98780dd

Please sign in to comment.