Skip to content

Instantly share code, notes, and snippets.

@TomKeur
Last active June 9, 2023 09:14
Show Gist options
  • Save TomKeur/262e50509c6ee197d55f993af0e00d52 to your computer and use it in GitHub Desktop.
Save TomKeur/262e50509c6ee197d55f993af0e00d52 to your computer and use it in GitHub Desktop.
Traefik setup
# Author: Tom Keur <tom@qlico.io>
# Service1 docker-compose.yaml
nginx:
image: nginx:alpine
container_name: service1_nginx
volumes:
- ./services/nginx/nginx.conf:/etc/nginx/nginx.conf
- ../:/var/www/html:cached
labels:
- "traefik.http.routers.service1_nginx.rule=Host(`service1.test`)"
networks:
- qlico_gateway
networks:
qlico_gateway:
external:
name: qlico_gateway
# Author: Tom Keur <tom@qlico.io>
# Service2 docker-compose.yaml
nginx:
image: nginx:alpine
container_name: service2_nginx
volumes:
- ./services/nginx/nginx.conf:/etc/nginx/nginx.conf
- ../:/var/www/html:cached
labels:
- "traefik.http.routers.service1_nginx.rule=Host(`service2.test`)"
networks:
- qlico_gateway
networks:
qlico_gateway:
external:
name: qlico_gateway
# Author: Tom Keur <tom@qlico.io>
# Gateway docker-compose.yaml
version: "3.5"
services:
traefik:
image: traefik:v2.2.1
container_name: qlico_traefik
command: ['--providers.docker', '--api.insecure']
networks:
- qlico_gateway
ports:
- 80:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- "traefik.http.routers.traefik.rule=Host(`traefik.qlico`)"
- "traefik.http.services.traefik.loadbalancer.server.port=8080"
restart: always
networks:
qlico_gateway:
driver: bridge
name: qlico_gateway
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment