I'm new to traefik, so here goes. Using treafik docker.
I have my own certificate and key (not wildward), The SSL is terminated by Traefik. Is it possible for the requests to FQDN/rocketchat and FDQN/Jitsi to be forwarded to their respective containers?
Thanks
Here below is my attempt, starting with app one.
> docker-compose.yml: below
version: '3'
services:
traefik:
# The latest official supported Traefik docker image
image: traefik:latest
ports:
# Exposes port 80 for incomming web requests
- "80:80"
- "443:443"
# The Web UI port http://0.0.0.0:8080 (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
# Copies the certificate locally for ease of backing up
- ~/github/certs:/ssl
# Mounts the Traefik static configuration inside the Traefik container
- ./traefik.yml:/etc/traefik/traefik.yml
- ./data/configurations:/dynamic_config
# logfile path
- ./logs/:/logs/
rocketchat:
image: rocketchat/rocket.chat:3.17.0
command: bash -c 'for i in seq 1 30
; do node main.js && s=$$? && break || s=$$?; echo "Tried $$i times. Waiting 5 secs..."; sleep 5; done; (exit $$s)'
restart: always
volumes:
- ./uploads:/app/uploads
environment:
- PORT=3000
- ROOT_URL=http://fedora.adal-vimba.ts.net
- VIRTUAL_HOSTs=fedora.adal-vimba.ts.net
- MONGO_URL=mongodb://mongo:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo:27017/local
- Accounts_UseDNSDomainCheck=false
depends_on:
- mongo
labels:
- "traefik.enable=true"
# Routers
- "traefik.http.routers.rocketchat.rule=Host(`fedora.adal-vimba.ts.net`) && PathPrefix(`/rocketchat`)"
- "traefik.http.routers.rocketchat.entrypoints=web"
- "traefik.http.routers.rocketchat.middlewares=test-redirectscheme"
- "traefik.http.routers.rocketchat-secure.rule=Host(`fedora.adal-vimba.ts.net`) && PathPrefix(`/rocketchat`)"
- "traefik.http.routers.rocketchat-secure.entrypoints=websecure"
# Services
- "traefik.http.services.rocket-secure.loadbalancer.server.port=3000"
# Define middleware for rocketchat-app
- "traefik.http.middlewares.rocket-strip-prefix.stripprefix.prefixes=/rocketchat"
# Apply path /rocketchat to middleware to router
- "traefik.http.routers.rocketchat-secure.middlewares=rocket-strip-prefix"
# Redirect Scheme HTTP -> HTTPS
- "traefik.http.middlewares.test-redirectscheme.redirectscheme.scheme=https"
- "traefik.http.middlewares.test-redirectscheme.redirectscheme.permanent=true"
mongo:
image: mongo:4.0
restart: always
volumes:
- ./data/db:/data/db
command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
mongo-init-replica:
image: mongo:4.0
command: 'bash -c "for i in seq 1 30
; do mongo mongo/rocketchat --eval "rs.initiate({ _id: ''rs0'', members: [ { _id: 0, host: ''localhost:27017'' } ]})" && s=$$? && break || s=$$?; echo "Tried $$i times. Waiting 5 secs..."; sleep 5; done; (exit $$s)"'
depends_on:
- mongo
traefik.ymlyml below
################################################################
# API and dashboard configuration
################################################################
api:
# Dashboard
dashboard: true
insecure: true
################################################################
# Docker configuration backend
################################################################
providers:
docker:
exposedByDefault: false
file:
directory: ./dynamic_config/
watch: true
################################################################
# Traefik Logging
################################################################
log:
level: INFO
################################################################
# Entrypoint
################################################################
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
http:
tls: {}
dynamic_config below:
# Dynamic configuration
# in configuration/certificates.yaml
tls:
certificates:
# first certificate
- certFile: /ssl/fedora.adal-vimba.ts.net.crt
keyFile: /ssl/fedora.adal-vimba.ts.net.key