Glimesh / broadcast-box

A broadcast, in a box.
MIT License
1.42k stars 78 forks source link

Possible to run behind Traefik reverse proxy? #189

Closed Roger-Roger-debug closed 1 week ago

Roger-Roger-debug commented 4 weeks ago

I'm using Traefik on my server and would like to use it as a reverse proxy for broadcast-box. However, to route network between containers, Traefik needs to share a network, meaning I can't set the network mode to host like in the example config for caddy.

This is what I currently have. It listens for https connections for my.stream.url and routes any connections to the internal 8080 port. It opens up 8080/udp for external connections as well.

With this the webui works, but trying to stream fails. I had hoped that just giving access to 8080/udp would make it work, but that doesn't seem to be the case. Is this even possible without host mode?

version: '3'

services:
  broadcast-box:
    container_name: broadcast-box
    hostname: broadcast-box
    image: seaduboi/broadcast-box:latest
    environment:
      - INCLUDE_PUBLIC_IP_IN_NAT_1_TO_1_IP=yes
      - UDP_MUX_PORT=8080
      - NETWORK_TEST_ON_START=true
    ports:
      - 8000:8080/udp
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik_public"
      - "traefik.http.routers.bbox.entrypoints=https"
      - "traefik.http.routers.bbox.rule=Host(`my.stream.url`)"
      - "traefik.http.services.bbox-service.loadbalancer.server.port=8080"
      - "traefik.http.routers.bbox.tls=true"
      - "traefik.http.routers.bbox.tls.certresolver=le"
    networks:
      - traefik_public

networks:
  traefik_public:
    external: true
Lucavon commented 1 week ago

This doesn't quite answer your question since it does use host mode, but I was also unable to get it running with nginx without host mode (I didn't try for very long, though). My solution was to set UDP_MUX_PORT to e.g. 20000 and HTTP_ADDRESSto e.g. 20001, enable host networking, and then configure the reverse proxy for 127.0.0.1:20001.

So changing the port and using host networking with 127.0.0.1 might work for you.

Roger-Roger-debug commented 1 week ago

I just noticed that I had

    ports:
      - 8000:8080/udp

when it should've been 8080:8080/udp. Changed that and it's working now :)