Hi,
I'v searched on the whole internet a solution about my issue but I can't make it work.
I've a Synology NAS running with some reverse proxies enabled and I was looking to switch to traefik for exposed containers.
I wanted to still have access to the 80 and 443 ports on Synology so I've created a macvlan using
ip link add macvlan0 link eth0 type macvlan mode bridge
ip addr add 192.168.0.103/32 dev macvlan0
ip link set macvlan0 up
ip route add 192.168.0.102/31 dev macvlan0
It seems to work as I can see the route
and from SSH Synology I can ping traefik (192.168.0.102)
Here is my docker-compose for traefik
version: '3'
services:
traefik:
image: traefik:latest
container_name: traefik
restart: unless-stopped
ports:
- 80:80
- 443:443
- 8080:8080
networks:
macvlan:
traefik:
volumes:
- /volume1/docker/traefik/config:/etc/traefik
- /volume1/docker/traefik/config/dyn_traefik/:/dyn_traefik/
- /volume1/docker/traefik/config/acme.json:/acme.json
- /etc/localtime:/etc/localtime:ro
depends_on:
- socket-proxy
environment:
OVH_ENDPOINT: ovh-eu
OVH_APPLICATION_KEY: xxxxx
OVH_APPLICATION_SECRET: xxxxx
OVH_CONSUMER_KEY: xxxxx
socket-proxy:
image: tecnativa/docker-socket-proxy
container_name: traefik_docker_socket-proxy
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
CONTAINERS: 1
networks:
- traefik
networks:
macvlan:
name: macvlan
driver: macvlan
driver_opts:
parent: eth0
ipam:
config:
- subnet: 192.168.0.0/24
ip_range: 192.168.0.102/32
gateway: 192.168.0.1
traefik:
name: traefik
and ./traefik/config/traefik.yml
global:
checkNewVersion: true
sendAnonymousUsage: false
entrypoints:
web:
address: :80
websecure:
address: :443
traefik:
address: :8080
ping : {}
log:
level: debug
accessLog:
filePath: "/etc/traefik/access.log"
serversTransport:
insecureSkipVerify: true
api:
dashboard: true
insecure: true
debug: true
providers:
docker:
endpoint: tcp://socket-proxy:2375
exposedByDefault: false
file:
filename: /etc/traefik/rules.yaml
certificatesResolvers:
staging:
acme:
email: xxxx@xxxx.com
storage: /etc/traefik/certs/acme.json
caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
dnsChallenge:
provider: ovh
resolvers:
- "1.1.1.1:53"
- "8.8.8.8:53"
production:
acme:
email: xxxx@xxxx.com
storage: /etc/traefik/certs/acme.json
caServer: "https://acme-v02.api.letsencrypt.org/directory"
dnsChallenge:
provider: ovh
resolvers:
- "1.1.1.1:53"
- "8.8.8.8:53"
Let's pick one container I try to deploy code-server
version: "2.1"
services:
code-server:
image: lscr.io/linuxserver/code-server:latest
container_name: code-server
environment:
- PUID=XXXX
- PGID=XXX
volumes:
- /volume1/docker/codeserver/config:/config
restart: unless-stopped
networks:
traefik:
labels:
traefik.enable: true
traefik.http.routers.code-server.rule: Host(`vs.my-domain.com`)
traefik.http.routers.code-server.entrypoints: web, websecure
traefik.http.routers.code-server.tls: true
traefik.http.routers.code-server.tls.certresolver: staging
networks:
traefik:
external: true
Now the issue :
Traefik is running fine, it can see code-server container with the Docker IP (not NAS IP) and port
But when I do vs.my-domain.com there are 2 cases :
- with WebStation turned off : I am redirected to https://vs.my-domain.com:5001/ (Synology DSM)
- with WebStation turned on : Error 502 bad gateway
I am lost on what to try next as I would like to keep the 80 and 443 port of Synology (for not exposed containers for example)
Additional info :
- On portainer, when accessing traefik with console as /bin/sh, I can't ping my NAS
- I am running a DNS server on Synology
- When accessing from outside without local DNS, I am still redirected to port 5001 and the page loads and reloads and reloads for ever
Thank you for your help