Hello guys,
I am newbie to traefik and to docker, so excuse me the lack of knowledge.
I am trying to setup traefik for 2 docker micro-services (node-red) , I am almost done with that, the only problem is that node-red uses web sockets, right know I can access to them but page is not working properly.
Sometime ago I had similar problem with reverse proxy in synology Nas with node-red and I solved that this way
right now i am not sure how to setup traefik docker-compose.yml or the node-red docker compose.yml to take in account the Custom header.
anyone that willing to help, would be highly appreciated,
Thanks so much for your advice.
I have fixed that.
Now i have a problem, I am only able to see the web page of only one sub domain, when reaching the others I get "bad Gateway"
What I am missing?
version: '3'
services:
nodered1:
image: nodered/node-red-docker:latest
restart: always
environment:
- USER_UID=1000
- USER_GID=1000
networks:
- web
volumes:
- /home/luisgcu/noder_data/node1/:/data
ports:
- "1880:1880"
labels:
- "traefik.enable=true"
- "traefik.backend=nodered1"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:node1.xxxx.net"
- "traefik.port=80" // before I had here port 1880 and only this container was ok
// then I read somewhere in here goes the port traefik is listen is this right??
nodered2:
image: nodered/node-red-docker:latest
restart: always
environment:
- USER_UID=1000
- USER_GID=1000
networks:
- web
volumes:
- /home/luisgcu/noder_data/node2/:/data
ports:
- "1881:1880"
labels:
- "traefik.enable=true"
- "traefik.backend=nodered2"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:node2.xxxx.net"
- "traefik.port=80"
networks:
web:
external: true
I think I need 3 separate back-ends one for each front with its sub-domains, but notice that node2 and node3 subdomains are linked to the same back-ends, and that is creating problems between nodered2 and 3. How I can fix that? is that fix on the traefix.toml or in the docker compose.yml?
Thanks so much.
here are the latest files that I used
docker-compose.yml
version: '3'
# Create 3 node-red docker containers ready to operate behind traefik Reverse proxy
services:
nodered1: #Nodered Docker container 1
image: nodered/node-red-docker:latest
restart: always
user: root
environment:
- TZ= America/New_York
networks:
- web
volumes:
- /home/luisgcu/noder_data/node1/:/data # Do nor forget to set NR volumes
ports:
- "1880:1880"
labels:
- "traefik.enable=true"
- "traefik.backend=nodered1"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:node1.yourdomain.net"
nodered2: #Nodered Docker container 2
image: nodered/node-red-docker:latest
restart: always
user: root
environment:
- TZ= America/New_York
networks:
- web
volumes:
- /home/luisgcu/noder_data/node2/:/data # Do nor forget to set NR volumes
ports:
- "1881:1880"
labels:
- "traefik.enable=true"
- "traefik.backend=nodered2"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:node2.yourdomain.net"
nodered3: #Nodered Docker container 3
image: nodered/node-red-docker:latest
restart: always
user: root
environment:
- TZ= America/New_York
networks:
- web
volumes:
- /home/luisgcu/noder_data/node3/:/data # Do nor forget to set NR volumes
ports:
- "1882:1880"
labels:
- "traefik.enable=true"
- "traefik.backend=nodered2"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:node3.yourdomain.net"
traefix: # Traefix docker compose start here
image: traefik
command: --api --docker
restart: always
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /opt/traefik/traefik.toml:/traefik.toml
- /opt/traefik/acme.json:/acme.json
networks:
- web
labels:
- "traefik.frontend.headers.STSPreload=true"
- "traefik.frontend.passHostHeader=true"
networks:
web:
external: true