Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listen on ipv6 if available #3270

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ services:
ports:
- "$SERVER_HOST:80:80"
- "$SERVER_HOST:443:443"
#uncomment to enable IPv6 communication
# - "$SERVER_HOST6:80:80"
# - "$SERVER_HOST6:443:443"

coredns:
#network_mode: host
Expand Down
4 changes: 3 additions & 1 deletion scripts/netmaker.default.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
NM_EMAIL=
# The base domain of netmaker
NM_DOMAIN=
# Public IP of machine
# Public IPv4 endpoint of machine
SERVER_HOST=
# Public IPv6 endpoint of machine
SERVER_HOST6=
# The admin master key for accessing the API. Change this in any production installation.
MASTER_KEY=
# The username to set for MQ access
Expand Down
12 changes: 7 additions & 5 deletions scripts/nm-quick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ save_config() { (
save_config_item SERVER_IMAGE_TAG "$IMAGE_TAG"
fi
# copy entries from the previous config
local toCopy=("SERVER_HOST" "MASTER_KEY" "MQ_USERNAME" "MQ_PASSWORD" "LICENSE_KEY" "NETMAKER_TENANT_ID"
local toCopy=("SERVER_HOST" "SERVER_HOST6" "MASTER_KEY" "MQ_USERNAME" "MQ_PASSWORD" "LICENSE_KEY" "NETMAKER_TENANT_ID"
"INSTALL_TYPE" "NODE_ID" "DNS_MODE" "NETCLIENT_AUTO_UPDATE" "API_PORT"
"CORS_ALLOWED_ORIGIN" "DISPLAY_KEYS" "DATABASE" "SERVER_BROKER_ENDPOINT" "VERBOSITY"
"DEBUG_MODE" "REST_BACKEND" "DISABLE_REMOTE_IP_CHECK" "TELEMETRY" "ALLOWED_EMAIL_DOMAINS" "AUTH_PROVIDER" "CLIENT_ID" "CLIENT_SECRET"
Expand Down Expand Up @@ -509,14 +509,16 @@ set -e
# set_install_vars - sets the variables that will be used throughout installation
set_install_vars() {

IP_ADDR=$(dig -4 myip.opendns.com @resolver1.opendns.com +short)
if [ "$IP_ADDR" = "" ]; then
IP_ADDR=$(curl -s ifconfig.me)
fi
IP_ADDR=$(curl -s -4 ifconfig.me)
IP6_ADDR=$(curl -s -6 ifconfig.me)
if [ "$NETMAKER_BASE_DOMAIN" = "" ]; then
NETMAKER_BASE_DOMAIN=nm.$(echo $IP_ADDR | tr . -).nip.io
fi
SERVER_HOST=$IP_ADDR
SERVER_HOST6=$IP6_ADDR
if [ "$IP_ADDR" = "" ]; then
SERVER_HOST=$IP6_ADDR
fi
if test -z "$MASTER_KEY"; then
MASTER_KEY=$(
tr -dc A-Za-z0-9 </dev/urandom | head -c 30
Expand Down
Loading