Skip to content

Commit c20ca5d

Browse files
committed
fix: traefik relay accessibility
1 parent 1a6d6b3 commit c20ca5d

6 files changed

+20
-21
lines changed

infrastructure_files/base.setup.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ NETBIRD_SIGNAL_PORT=${NETBIRD_SIGNAL_PORT:-10000}
2323
# Relay
2424
NETBIRD_RELAY_DOMAIN=${NETBIRD_RELAY_DOMAIN:-$NETBIRD_DOMAIN}
2525
NETBIRD_RELAY_PORT=${NETBIRD_RELAY_PORT:-33080}
26+
NETBIRD_RELAY_ENDPOINT=${NETBIRD_RELAY_ENDPOINT:-rel://$NETBIRD_RELAY_DOMAIN:$NETBIRD_RELAY_PORT}
2627
# Relay auth secret
2728
NETBIRD_RELAY_AUTH_SECRET=
2829

@@ -133,5 +134,6 @@ export COTURN_TAG
133134
export NETBIRD_TURN_EXTERNAL_IP
134135
export NETBIRD_RELAY_DOMAIN
135136
export NETBIRD_RELAY_PORT
137+
export NETBIRD_RELAY_ENDPOINT
136138
export NETBIRD_RELAY_AUTH_SECRET
137139
export NETBIRD_RELAY_TAG

infrastructure_files/configure.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ fi
170170
if [[ "$NETBIRD_DISABLE_LETSENCRYPT" == "true" ]]; then
171171
export NETBIRD_DASHBOARD_ENDPOINT="https://$NETBIRD_DOMAIN:443"
172172
export NETBIRD_SIGNAL_ENDPOINT="https://$NETBIRD_DOMAIN:$NETBIRD_SIGNAL_PORT"
173+
export NETBIRD_RELAY_ENDPOINT="rels://$NETBIRD_DOMAIN:$NETBIRD_SIGNAL_PORT/relay"
173174

174175
echo "Letsencrypt was disabled, the Https-endpoints cannot be used anymore"
175176
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
178179
echo "- $NETBIRD_MGMT_API_ENDPOINT/api -http-> management:$NETBIRD_MGMT_API_PORT"
179180
echo "- $NETBIRD_MGMT_API_ENDPOINT/management.ManagementService/ -grpc-> management:$NETBIRD_MGMT_API_PORT"
180181
echo "- $NETBIRD_SIGNAL_ENDPOINT/signalexchange.SignalExchange/ -grpc-> signal:80"
182+
echo "- $NETBIRD_RELAY_ENDPOINT/ -http-> relay:33080"
181183
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."
182184
echo " The target of the forwards depends on your setup. Beware of the gRPC protocol instead of http for management and signal!"
183185
echo "You are also free to remove any occurrences of the Letsencrypt-volume $LETSENCRYPT_VOLUMENAME"

infrastructure_files/docker-compose.yml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ services:
5757
environment:
5858
- NB_LOG_LEVEL=info
5959
- NB_LISTEN_ADDRESS=:$NETBIRD_RELAY_PORT
60-
- NB_EXPOSED_ADDRESS=$NETBIRD_RELAY_DOMAIN:$NETBIRD_RELAY_PORT
60+
- NB_EXPOSED_ADDRESS=$NETBIRD_RELAY_ENDPOINT
6161
# todo: change to a secure secret
6262
- NB_AUTH_SECRET=$NETBIRD_RELAY_AUTH_SECRET
6363
ports:

infrastructure_files/docker-compose.yml.tmpl.traefik

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ services:
33
dashboard:
44
image: netbirdio/dashboard:$NETBIRD_DASHBOARD_TAG
55
restart: unless-stopped
6-
#ports:
7-
# - 80:80
8-
# - 443:443
96
environment:
107
# Endpoints
118
- NETBIRD_MGMT_API_ENDPOINT=$NETBIRD_MGMT_API_ENDPOINT
@@ -43,11 +40,6 @@ services:
4340
restart: unless-stopped
4441
volumes:
4542
- $SIGNAL_VOLUMENAME:/var/lib/netbird
46-
#ports:
47-
# - $NETBIRD_SIGNAL_PORT:80
48-
# # port and command for Let's Encrypt validation
49-
# - 443:443
50-
# command: ["--letsencrypt-domain", "$NETBIRD_LETSENCRYPT_DOMAIN", "--log-file", "console"]
5143
labels:
5244
- traefik.enable=true
5345
- traefik.http.routers.netbird-signal.rule=Host(`$NETBIRD_DOMAIN`) && PathPrefix(`/signalexchange.SignalExchange/`)
@@ -65,12 +57,10 @@ services:
6557
restart: unless-stopped
6658
environment:
6759
- NB_LOG_LEVEL=info
68-
- NB_LISTEN_ADDRESS=:$NETBIRD_RELAY_PORT
69-
- NB_EXPOSED_ADDRESS=$NETBIRD_RELAY_DOMAIN:$NETBIRD_RELAY_PORT
60+
- NB_LISTEN_ADDRESS=:33080
61+
- NB_EXPOSED_ADDRESS=$NETBIRD_RELAY_ENDPOINT
7062
# todo: change to a secure secret
7163
- NB_AUTH_SECRET=$NETBIRD_RELAY_AUTH_SECRET
72-
# ports:
73-
# - $NETBIRD_RELAY_PORT:$NETBIRD_RELAY_PORT
7464
logging:
7565
driver: "json-file"
7666
options:
@@ -79,7 +69,7 @@ services:
7969
labels:
8070
- traefik.enable=true
8171
- traefik.http.routers.netbird-relay.rule=Host(`$NETBIRD_DOMAIN`) && PathPrefix(`/relay`)
82-
- traefik.http.services.netbird-relay.loadbalancer.server.port=$NETBIRD_RELAY_PORT
72+
- traefik.http.services.netbird-relay.loadbalancer.server.port=33080
8373

8474
# Management
8575
management:
@@ -91,10 +81,6 @@ services:
9181
- $MGMT_VOLUMENAME:/var/lib/netbird
9282
- $LETSENCRYPT_VOLUMENAME:/etc/letsencrypt:ro
9383
- ./management.json:/etc/netbird/management.json
94-
#ports:
95-
# - $NETBIRD_MGMT_API_PORT:443 #API port
96-
# # command for Let's Encrypt validation without dashboard container
97-
# command: ["--letsencrypt-domain", "$NETBIRD_LETSENCRYPT_DOMAIN", "--log-file", "console"]
9884
command: [
9985
"--port", "33073",
10086
"--log-file", "console",
@@ -129,8 +115,6 @@ services:
129115
domainname: $TURN_DOMAIN
130116
volumes:
131117
- ./turnserver.conf:/etc/turnserver.conf:ro
132-
# - ./privkey.pem:/etc/coturn/private/privkey.pem:ro
133-
# - ./cert.pem:/etc/coturn/certs/cert.pem:ro
134118
network_mode: host
135119
command:
136120
- -c /etc/turnserver.conf

infrastructure_files/management.json.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"TimeBasedCredentials": false
2222
},
2323
"Relay": {
24-
"Addresses": ["rel://$NETBIRD_RELAY_DOMAIN:$NETBIRD_RELAY_PORT"],
24+
"Addresses": ["$NETBIRD_RELAY_ENDPOINT"],
2525
"CredentialsTTL": "24h",
2626
"Secret": "$NETBIRD_RELAY_AUTH_SECRET"
2727
},

infrastructure_files/setup.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,15 @@ NETBIRD_RELAY_DOMAIN=""
102102

103103
# Relay server connection port. If none is supplied
104104
# it will default to 33080
105+
# should be updated to match TLS-port of reverse proxy when netbird is running behind reverse proxy
105106
NETBIRD_RELAY_PORT=""
107+
108+
# Management API connectin port. If none is supplied
109+
# it will default to 33073
110+
# should be updated to match TLS-port of reverse proxy when netbird is running behind reverse proxy
111+
NETBIRD_MGMT_API_PORT=""
112+
113+
# Signal service connectin port. If none is supplied
114+
# it will default to 10000
115+
# should be updated to match TLS-port of reverse proxy when netbird is running behind reverse proxy
116+
NETBIRD_SIGNAL_PORT=""

0 commit comments

Comments
 (0)