Hey guys, I just wanted some help (if possible) or any directions on what I may be doing wrong. I'm testing Traefik as a reverse proxy with Docker. So far, I haven't had any trouble with any container that I want to expose to x.mydomain.com. However, for some reason, with a specific container (Bytebase), I can't seem to get it to be exposed. I've thought that it may have something to do with the tcp6 port that's exposed inside the container or maybe the way that Bytebase creates the webserver that Traefik may not be picking up. I have checked the docs on Traefik, Docker, and Bytebase and can't seem to find any solution or explanation for why this could be happening.
So, in short, I'd like (if possible) for you to check the configs and logs that I'm getting so far. Maybe I'm not seeing something that is clear to other people. Thanks in advance, and sorry for the bother.
My traefik docker-compose.yml:
version: "3"
networks:
default:
name: production
external: true
services:
traefik:
image: "traefik"
container_name: "traefik"
security_opt:
- no-new-privileges:true
ports:
- "80:80"
- "443:443"
environment:
- CF_API_EMAIL=${CF_API_EMAIL}
- CF_API_KEY=${CF_API_EMAIL}
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik-data/traefik.yml:/traefik.yml:ro
- ./traefik-data/acme.json:/acme.json
- ./traefik-data/config.yml:/config.yml:ro
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
- "traefik.http.routers.traefik.entrypoints=http"
- "traefik.http.routers.traefik.rule=Host(`traefik-dashboard.mydomain.com`)"
- "traefik.http.middlewares.traefik-auth.basicauth.users=user:password"
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
- "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
- "traefik.http.routers.traefik-secure.entrypoints=https"
- "traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.mydomain.com`)"
- "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
- "traefik.http.routers.traefik-secure.tls=true"
- "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"
- "traefik.http.routers.traefik-secure.tls.domains[0].main=mydomain.com"
- "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.mydomain.com"
- "traefik.http.routers.traefik-secure.service=api@internal"
- "traefik.http.routers.traefik-secure.middlewares=authelia@docker"
restart: unless-stopped
My traefik.yml:
api:
dashboard: true
debug: true
entryPoints:
http:
address: ":80"
http:
redirections:
entryPoint:
to: https
scheme: https
https:
address: ":443"
serversTransport:
insecureSkipVerify: true
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
useBindPortIP: true
file:
filename: /config.yml
certificatesResolvers:
cloudflare:
acme:
email: user@domaincom
storage: acme.json
dnsChallenge:
provider: cloudflare
resolvers:
- "1.1.1.1:53"
- "1.0.0.1:53"
My bytebase docker-compose.yml:
version: '3'
networks:
default:
name: production
external: true
services:
bytebase:
container_name: bytebase
image: bytebase/bytebase:2.7.0
restart: unless-stopped
volumes:
- ./bytebase-data:/var/opt/bytebase
command: --data /var/opt/bytebase --pg ${BB_PG} --external-url ${BB_EXTERNAL_URL} --port 8087 --disable-sample --disable-metric --debug
labels:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
- "traefik.http.routers.bytebase.entrypoints=http"
- "traefik.http.routers.bytebase.rule=Host(`bytebase.mydomain.com`)"
- "traefik.http.middlewares.bytebase-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.bytebase.middlewares=bytebase-https-redirect"
- "traefik.http.routers.bytebase-secure.entrypoints=https"
- "traefik.http.routers.bytebase-secure.rule=Host(`bytebase.mydomain.com`)"
- "traefik.http.routers.bytebase-secure.tls=true"
- "traefik.http.routers.bytebase-secure.service=bytebase"
- "traefik.http.services.bytebase.loadbalancer.server.port=8087"
- "traefik.docker.network=production@docker"
- "traefik.http.routers.bytebase-secure.middlewares=authelia@docker"
In traefik logs, all seems to be fine:
time="2023-09-05T17:15:49+02:00" level=info msg="Configuration loaded from file: /traefik.yml"
Also, in bytebase logs, there's nothing failing:
___________________________________________________________________________________________
βββββββ βββ βββββββββββββββββββββββββββ ββββββ ββββββββββββββββ
ββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββ βββββββ βββ ββββββ ββββββββββββββββββββββββββββββ
ββββββββ βββββ βββ ββββββ ββββββββββββββββββββββββββββββ
ββββββββ βββ βββ βββββββββββββββββββ βββββββββββββββββββ
βββββββ βββ βββ βββββββββββββββ βββ βββββββββββββββββββ
Version 2.7.0 (schema version 2.7.8) has started on port 8087 π
___________________________________________________________________________________________
2023-09-05T15:20:25.222Z DEBUG backuprun/runner.go:63 Auto backup runner started {"interval": "10m0s"}
2023-09-05T15:20:25.222Z DEBUG taskrun/schedulerv2.go:60 Task scheduler V2 started and will run every 1s
2023-09-05T15:20:25.222Z INFO taskrun/schedulerv2.go:507 TaskSkippedOrDoneListener started
2023-09-05T15:20:25.222Z DEBUG anomaly/scanner.go:50 Anomaly scanner started and will run every 10m0s
2023-09-05T15:20:25.222Z DEBUG taskcheck/scheduler.go:49 Task check scheduler started and will run every 1s
2023-09-05T15:20:25.222Z DEBUG apprun/runner.go:56 Application runner started and will run every 30s
2023-09-05T15:20:25.222Z DEBUG schemasync/syncer.go:55 Schema syncer started and will run every 30m0s
2023-09-05T15:20:25.222Z DEBUG slowquerysync/syncer.go:55 Slow query syncer started and will run every 12h0m0s
2023-09-05T15:20:25.222Z DEBUG mail/slow_query_weekly_mail.go:66 Slow query weekly mail sender started
2023-09-05T15:20:25.222Z DEBUG relay/runner.go:69 Relay runner started and will run every 10m0s
2023-09-05T15:20:25.222Z DEBUG approval/runner.go:70 Approval runner started and will run every 1s
2023-09-05T15:20:25.222Z DEBUG metricreport/reporter.go:82 Metrics reporter started and will run every 1h0m0s
2023-09-05T15:20:25.222Z DEBUG plancheck/scheduler.go:48 Plan check scheduler started and will run every 1s
Doing curl inside the container i get a response:
root@fb60d7f7d8cc:/# curl 127.0.0.1:8087/healthz
OK!
Also checking ports exposed inside the container i get this:
root@fb60d7f7d8cc:/# netstat -tuln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.11:43639 0.0.0.0:* LISTEN
tcp6 0 0 :::8088 :::* LISTEN
tcp6 0 0 :::8087 :::* LISTEN
udp 0 0 127.0.0.11:42281 0.0.0.0:*