Skip to content

Instantly share code, notes, and snippets.

@hranicka
Created November 28, 2019 12:29
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save hranicka/7fe4f0ba4064863aa0bcb27a488e530c to your computer and use it in GitHub Desktop.
Save hranicka/7fe4f0ba4064863aa0bcb27a488e530c to your computer and use it in GitHub Desktop.
Traefik & multiple docker-compose projects
version: '3'
services:
nginx:
labels:
- "traefik.enable=true"
- "traefik.http.routers.provys-transformer.rule=Host(`www.example.com`)"
- "traefik.http.routers.provys-transformer.tls=true"
networks:
- traefik
- default
fpm:
environment:
SSH_AUTH_SOCK: $SSH_AUTH_SOCK
volumes:
- $SSH_AUTH_SOCK:$SSH_AUTH_SOCK
- composer:/home/www-data/.composer
db:
volumes:
- db:/data/db
ports:
- 27017:27017
mq:
hostname: "mq"
volumes:
- mq:/var/lib/rabbitmq
ports:
- 5672:5672
- 15672:15672
volumes:
db:
composer:
mq:
networks:
traefik:
external:
name: traefik_proxy
version: '3'
services:
reverse-proxy:
# The official v2.0 Traefik docker image
image: traefik:v2.0
# Enables the web UI and tells Traefik to listen to docker
command: --api.insecure=true
ports:
# The HTTP port
- "80:80"
- "443:443"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
# Mount current directory including all configuration files, certificates, etc.
- ./:/etc/traefik
networks:
default:
external:
name: traefik_proxy
[api]
dashboard = true
insecure = true
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.websecure]
address = ":443"
[providers]
[providers.file]
filename = "/etc/traefik/dynamic_conf.toml"
watch = true
[providers.docker]
endpoint = "unix:///var/run/docker.sock"
defaultRule = "Host(`{{ normalize .Name }}.example.com`)"
exposedByDefault = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment