[misc] fix: traefik relay accessibility (#3696)

This commit is contained in:
Ghazy Abdallah 2025-06-05 15:15:01 +03:00 committed by GitHub
parent 84354951d3
commit 6c0cdb6ed1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 20 additions and 21 deletions

View File

@ -23,6 +23,7 @@ NETBIRD_SIGNAL_PORT=${NETBIRD_SIGNAL_PORT:-10000}
# Relay # Relay
NETBIRD_RELAY_DOMAIN=${NETBIRD_RELAY_DOMAIN:-$NETBIRD_DOMAIN} NETBIRD_RELAY_DOMAIN=${NETBIRD_RELAY_DOMAIN:-$NETBIRD_DOMAIN}
NETBIRD_RELAY_PORT=${NETBIRD_RELAY_PORT:-33080} NETBIRD_RELAY_PORT=${NETBIRD_RELAY_PORT:-33080}
NETBIRD_RELAY_ENDPOINT=${NETBIRD_RELAY_ENDPOINT:-rel://$NETBIRD_RELAY_DOMAIN:$NETBIRD_RELAY_PORT}
# Relay auth secret # Relay auth secret
NETBIRD_RELAY_AUTH_SECRET= NETBIRD_RELAY_AUTH_SECRET=
@ -135,5 +136,6 @@ export COTURN_TAG
export NETBIRD_TURN_EXTERNAL_IP export NETBIRD_TURN_EXTERNAL_IP
export NETBIRD_RELAY_DOMAIN export NETBIRD_RELAY_DOMAIN
export NETBIRD_RELAY_PORT export NETBIRD_RELAY_PORT
export NETBIRD_RELAY_ENDPOINT
export NETBIRD_RELAY_AUTH_SECRET export NETBIRD_RELAY_AUTH_SECRET
export NETBIRD_RELAY_TAG export NETBIRD_RELAY_TAG

View File

@ -170,6 +170,7 @@ fi
if [[ "$NETBIRD_DISABLE_LETSENCRYPT" == "true" ]]; then if [[ "$NETBIRD_DISABLE_LETSENCRYPT" == "true" ]]; then
export NETBIRD_DASHBOARD_ENDPOINT="https://$NETBIRD_DOMAIN:443" export NETBIRD_DASHBOARD_ENDPOINT="https://$NETBIRD_DOMAIN:443"
export NETBIRD_SIGNAL_ENDPOINT="https://$NETBIRD_DOMAIN:$NETBIRD_SIGNAL_PORT" export NETBIRD_SIGNAL_ENDPOINT="https://$NETBIRD_DOMAIN:$NETBIRD_SIGNAL_PORT"
export NETBIRD_RELAY_ENDPOINT="rels://$NETBIRD_DOMAIN:$NETBIRD_SIGNAL_PORT/relay"
echo "Letsencrypt was disabled, the Https-endpoints cannot be used anymore" echo "Letsencrypt was disabled, the Https-endpoints cannot be used anymore"
echo " and a reverse-proxy with Https needs to be placed in front of netbird!" echo " and a reverse-proxy with Https needs to be placed in front of netbird!"
@ -178,6 +179,7 @@ if [[ "$NETBIRD_DISABLE_LETSENCRYPT" == "true" ]]; then
echo "- $NETBIRD_MGMT_API_ENDPOINT/api -http-> management:$NETBIRD_MGMT_API_PORT" echo "- $NETBIRD_MGMT_API_ENDPOINT/api -http-> management:$NETBIRD_MGMT_API_PORT"
echo "- $NETBIRD_MGMT_API_ENDPOINT/management.ManagementService/ -grpc-> management:$NETBIRD_MGMT_API_PORT" echo "- $NETBIRD_MGMT_API_ENDPOINT/management.ManagementService/ -grpc-> management:$NETBIRD_MGMT_API_PORT"
echo "- $NETBIRD_SIGNAL_ENDPOINT/signalexchange.SignalExchange/ -grpc-> signal:80" echo "- $NETBIRD_SIGNAL_ENDPOINT/signalexchange.SignalExchange/ -grpc-> signal:80"
echo "- $NETBIRD_RELAY_ENDPOINT/ -http-> relay:33080"
echo "You most likely also have to change NETBIRD_MGMT_API_ENDPOINT in base.setup.env and port-mappings in docker-compose.yml.tmpl and rerun this script." echo "You most likely also have to change NETBIRD_MGMT_API_ENDPOINT in base.setup.env and port-mappings in docker-compose.yml.tmpl and rerun this script."
echo " The target of the forwards depends on your setup. Beware of the gRPC protocol instead of http for management and signal!" echo " The target of the forwards depends on your setup. Beware of the gRPC protocol instead of http for management and signal!"
echo "You are also free to remove any occurrences of the Letsencrypt-volume $LETSENCRYPT_VOLUMENAME" echo "You are also free to remove any occurrences of the Letsencrypt-volume $LETSENCRYPT_VOLUMENAME"

View File

@ -57,7 +57,7 @@ services:
environment: environment:
- NB_LOG_LEVEL=info - NB_LOG_LEVEL=info
- NB_LISTEN_ADDRESS=:$NETBIRD_RELAY_PORT - NB_LISTEN_ADDRESS=:$NETBIRD_RELAY_PORT
- NB_EXPOSED_ADDRESS=$NETBIRD_RELAY_DOMAIN:$NETBIRD_RELAY_PORT - NB_EXPOSED_ADDRESS=$NETBIRD_RELAY_ENDPOINT
# todo: change to a secure secret # todo: change to a secure secret
- NB_AUTH_SECRET=$NETBIRD_RELAY_AUTH_SECRET - NB_AUTH_SECRET=$NETBIRD_RELAY_AUTH_SECRET
ports: ports:

View File

@ -3,9 +3,6 @@ services:
dashboard: dashboard:
image: netbirdio/dashboard:$NETBIRD_DASHBOARD_TAG image: netbirdio/dashboard:$NETBIRD_DASHBOARD_TAG
restart: unless-stopped restart: unless-stopped
#ports:
# - 80:80
# - 443:443
environment: environment:
# Endpoints # Endpoints
- NETBIRD_MGMT_API_ENDPOINT=$NETBIRD_MGMT_API_ENDPOINT - NETBIRD_MGMT_API_ENDPOINT=$NETBIRD_MGMT_API_ENDPOINT
@ -43,11 +40,6 @@ services:
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- $SIGNAL_VOLUMENAME:/var/lib/netbird - $SIGNAL_VOLUMENAME:/var/lib/netbird
#ports:
# - $NETBIRD_SIGNAL_PORT:80
# # port and command for Let's Encrypt validation
# - 443:443
# command: ["--letsencrypt-domain", "$NETBIRD_LETSENCRYPT_DOMAIN", "--log-file", "console"]
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.http.routers.netbird-signal.rule=Host(`$NETBIRD_DOMAIN`) && PathPrefix(`/signalexchange.SignalExchange/`) - traefik.http.routers.netbird-signal.rule=Host(`$NETBIRD_DOMAIN`) && PathPrefix(`/signalexchange.SignalExchange/`)
@ -65,12 +57,10 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
- NB_LOG_LEVEL=info - NB_LOG_LEVEL=info
- NB_LISTEN_ADDRESS=:$NETBIRD_RELAY_PORT - NB_LISTEN_ADDRESS=:33080
- NB_EXPOSED_ADDRESS=$NETBIRD_RELAY_DOMAIN:$NETBIRD_RELAY_PORT - NB_EXPOSED_ADDRESS=$NETBIRD_RELAY_ENDPOINT
# todo: change to a secure secret # todo: change to a secure secret
- NB_AUTH_SECRET=$NETBIRD_RELAY_AUTH_SECRET - NB_AUTH_SECRET=$NETBIRD_RELAY_AUTH_SECRET
# ports:
# - $NETBIRD_RELAY_PORT:$NETBIRD_RELAY_PORT
logging: logging:
driver: "json-file" driver: "json-file"
options: options:
@ -79,7 +69,7 @@ services:
labels: labels:
- traefik.enable=true - traefik.enable=true
- traefik.http.routers.netbird-relay.rule=Host(`$NETBIRD_DOMAIN`) && PathPrefix(`/relay`) - traefik.http.routers.netbird-relay.rule=Host(`$NETBIRD_DOMAIN`) && PathPrefix(`/relay`)
- traefik.http.services.netbird-relay.loadbalancer.server.port=$NETBIRD_RELAY_PORT - traefik.http.services.netbird-relay.loadbalancer.server.port=33080
# Management # Management
management: management:
@ -91,10 +81,6 @@ services:
- $MGMT_VOLUMENAME:/var/lib/netbird - $MGMT_VOLUMENAME:/var/lib/netbird
- $LETSENCRYPT_VOLUMENAME:/etc/letsencrypt:ro - $LETSENCRYPT_VOLUMENAME:/etc/letsencrypt:ro
- ./management.json:/etc/netbird/management.json - ./management.json:/etc/netbird/management.json
#ports:
# - $NETBIRD_MGMT_API_PORT:443 #API port
# # command for Let's Encrypt validation without dashboard container
# command: ["--letsencrypt-domain", "$NETBIRD_LETSENCRYPT_DOMAIN", "--log-file", "console"]
command: [ command: [
"--port", "33073", "--port", "33073",
"--log-file", "console", "--log-file", "console",
@ -129,8 +115,6 @@ services:
domainname: $TURN_DOMAIN domainname: $TURN_DOMAIN
volumes: volumes:
- ./turnserver.conf:/etc/turnserver.conf:ro - ./turnserver.conf:/etc/turnserver.conf:ro
# - ./privkey.pem:/etc/coturn/private/privkey.pem:ro
# - ./cert.pem:/etc/coturn/certs/cert.pem:ro
network_mode: host network_mode: host
command: command:
- -c /etc/turnserver.conf - -c /etc/turnserver.conf

View File

@ -21,7 +21,7 @@
"TimeBasedCredentials": false "TimeBasedCredentials": false
}, },
"Relay": { "Relay": {
"Addresses": ["rel://$NETBIRD_RELAY_DOMAIN:$NETBIRD_RELAY_PORT"], "Addresses": ["$NETBIRD_RELAY_ENDPOINT"],
"CredentialsTTL": "24h", "CredentialsTTL": "24h",
"Secret": "$NETBIRD_RELAY_AUTH_SECRET" "Secret": "$NETBIRD_RELAY_AUTH_SECRET"
}, },

View File

@ -102,4 +102,15 @@ NETBIRD_RELAY_DOMAIN=""
# Relay server connection port. If none is supplied # Relay server connection port. If none is supplied
# it will default to 33080 # it will default to 33080
# should be updated to match TLS-port of reverse proxy when netbird is running behind reverse proxy
NETBIRD_RELAY_PORT="" NETBIRD_RELAY_PORT=""
# Management API connectin port. If none is supplied
# it will default to 33073
# should be updated to match TLS-port of reverse proxy when netbird is running behind reverse proxy
NETBIRD_MGMT_API_PORT=""
# Signal service connectin port. If none is supplied
# it will default to 10000
# should be updated to match TLS-port of reverse proxy when netbird is running behind reverse proxy
NETBIRD_SIGNAL_PORT=""