[PR #1464] [CLOSED] feat(Self-hosting NetBird script):support custom service port and DNS… #15419

Closed
opened 2026-08-05 03:07:36 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1464
Author: @xcstatus
Created: 1/13/2024
Status: Closed

Base: mainHead: feature/customPort-certificateManagement


📝 Commits (1)

  • 19942de feat(Self-hosting NetBird script):support custom service port and DNS challenge

📊 Changes

1 file changed (+51 additions, -21 deletions)

View changed files

📝 infrastructure_files/getting-started-with-zitadel.sh (+51 -21)

📄 Description

… challenge

Adding port variable support custom service port;
Adding the CUSTOM_INITIAL_FILES variable allows you to change the configuration files to allow DNS challenge configuration or manual certificate management

Most of the people who encountered this problem were from China, so I added the description in Chinese
I didn't test the conditions for port 80 and 443 deployments, so I didn't test this case

The following variables are added(增加了以下变量)

Custom ports(自定义端口)

export NETBIRD_HTTP_PORT=80;
export NETBIRD_HTTPS_PORT=443;
export TURN_MIN_PORT=49152;
export TURN_MAX_PORT=65535;
export TURN_LISTENING_PORT=3478;

Customize the initial configuration file(定制初始配置文件)
export CUSTOM_INITIAL_FILES=true;

Certificate Settings when customizing ports(自定义端口时证书的设置)

两种设置方式:DNS challenge、Manage certificates manually(手动管理证书)

DNS challenge

Automatically sign and renew certificates with caddy DNS challenge(通过 caddy DNS challenge自动签发、续签证书)

  1. Enable the custom initial profile option(启用定制初始配置文件选项): export CUSTOM_INITIAL_FILES=true;
  2. Modify the caddy image in docker-compose.yml. Mirroring requires the addition of plugs to support the DNS challenge(修改docker-compose.yml中caddy镜像。镜像需要增加plug,以支持DNS challenge)
  3. Modify Caddyfile to add DNS challenge configuration(修改Caddyfile,增加DNS challenge配置)

Take DNSPod as an example(以DNSPod为例)

Obtain or manually build caddy-dnspod. Modify the caddy image in docker-compose.yml.
(获取或手动构建caddy-dnspod。 修改docker-compose.yml中caddy镜像。)

Pasted image 20240113181331

Modify Caddyfile to add DNS challenge configuration
(修改Caddyfile,增加DNS challenge配置)

tls youremil@icloud.com {
  dns dnspod apiTokenId,apiToken
}

Pasted image 20240113181652

Manage certificates manually(手动管理证书)

Manage the certificates manually, and replace them manually when they expire
手动管理证书,到期需要手动替换证书

  1. Enable the custom initial profile option(启用定制初始配置文件选项): export CUSTOM_INITIAL_FILES=true;
  2. Get the certificate and upload it to the certs folder in your installation directory.(获取证书,将证书上传到安装目录下certs文件夹中。)
  3. Modify the caddy configuration in docker-compose.yml to mount the certificate file(docker-compose.yml中caddy配置,挂载证书文件)
  4. Modify Caddyfile to add the certificate configuration(修改Caddyfile,增加证书配置)

Get the certificate and upload it to the certs folder in your installation directory.(获取证书,将证书上传到安装目录下certs文件夹中。)

~/docker-netbird# tree certs
certs
├── netbird.my-domain.com.key
└── netbird.my-domain.com.pem

Modify the caddy configuration in docker-compose.yml to mount the certificate file(docker-compose.yml中caddy配置,挂载证书文件)

Pasted image 20240113182511

Modify Caddyfile to add the certificate configuration(修改Caddyfile,增加证书配置)

Pasted image 20240113182955

discussions
https://github.com/netbirdio/netbird/discussions/1406
issues
https://github.com/netbirdio/netbird/issues/1408
https://github.com/netbirdio/netbird/issues/1267

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/1464 **Author:** [@xcstatus](https://github.com/xcstatus) **Created:** 1/13/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/customPort-certificateManagement` --- ### 📝 Commits (1) - [`19942de`](https://github.com/netbirdio/netbird/commit/19942dec777228941ef585227b3db4902b2e552e) feat(Self-hosting NetBird script):support custom service port and DNS challenge ### 📊 Changes **1 file changed** (+51 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `infrastructure_files/getting-started-with-zitadel.sh` (+51 -21) </details> ### 📄 Description … challenge Adding port variable support custom service port; Adding the CUSTOM_INITIAL_FILES variable allows you to change the configuration files to allow DNS challenge configuration or manual certificate management Most of the people who encountered this problem were from China, so I added the description in Chinese I didn't test the conditions for port 80 and 443 deployments, so I didn't test this case ## The following variables are added(增加了以下变量) Custom ports(自定义端口) ``` export NETBIRD_HTTP_PORT=80; export NETBIRD_HTTPS_PORT=443; export TURN_MIN_PORT=49152; export TURN_MAX_PORT=65535; export TURN_LISTENING_PORT=3478; ``` Customize the initial configuration file(定制初始配置文件) `export CUSTOM_INITIAL_FILES=true;` ## Certificate Settings when customizing ports(自定义端口时证书的设置) 两种设置方式:DNS challenge、Manage certificates manually(手动管理证书) ### DNS challenge Automatically sign and renew certificates with caddy DNS challenge(通过 caddy DNS challenge自动签发、续签证书) 1. Enable the custom initial profile option(启用定制初始配置文件选项): export CUSTOM_INITIAL_FILES=true; 2. Modify the caddy image in docker-compose.yml. Mirroring requires the addition of plugs to support the DNS challenge(修改docker-compose.yml中caddy镜像。镜像需要增加plug,以支持DNS challenge) 3. Modify Caddyfile to add DNS challenge configuration(修改Caddyfile,增加DNS challenge配置) #### Take DNSPod as an example(以DNSPod为例) Obtain or manually build caddy-dnspod. Modify the caddy image in docker-compose.yml. (获取或手动构建caddy-dnspod。 修改docker-compose.yml中caddy镜像。) <img width="405" alt="Pasted image 20240113181331" src="https://github.com/netbirdio/netbird/assets/40375067/8ebd337e-56b9-4240-b959-2a2a265976f0"> Modify Caddyfile to add DNS challenge configuration (修改Caddyfile,增加DNS challenge配置) ``` tls youremil@icloud.com { dns dnspod apiTokenId,apiToken } ``` <img width="665" alt="Pasted image 20240113181652" src="https://github.com/netbirdio/netbird/assets/40375067/87a2c633-3aa5-47a8-807b-61b45ce1c9e7"> ### Manage certificates manually(手动管理证书) Manage the certificates manually, and replace them manually when they expire 手动管理证书,到期需要手动替换证书 1. Enable the custom initial profile option(启用定制初始配置文件选项): export CUSTOM_INITIAL_FILES=true; 2. Get the certificate and upload it to the certs folder in your installation directory.(获取证书,将证书上传到安装目录下certs文件夹中。) 3. Modify the caddy configuration in docker-compose.yml to mount the certificate file(docker-compose.yml中caddy配置,挂载证书文件) 4. Modify Caddyfile to add the certificate configuration(修改Caddyfile,增加证书配置) Get the certificate and upload it to the certs folder in your installation directory.(获取证书,将证书上传到安装目录下certs文件夹中。) ``` ~/docker-netbird# tree certs certs ├── netbird.my-domain.com.key └── netbird.my-domain.com.pem ``` Modify the caddy configuration in docker-compose.yml to mount the certificate file(docker-compose.yml中caddy配置,挂载证书文件) <img width="678" alt="Pasted image 20240113182511" src="https://github.com/netbirdio/netbird/assets/40375067/8d0b2945-d8b0-42e7-8435-f1229442bdbb"> Modify Caddyfile to add the certificate configuration(修改Caddyfile,增加证书配置) <img width="662" alt="Pasted image 20240113182955" src="https://github.com/netbirdio/netbird/assets/40375067/c7aeb737-4a7d-40f4-8650-2245bb7a8759"> ## Issue ticket number and link discussions https://github.com/netbirdio/netbird/discussions/1406 issues https://github.com/netbirdio/netbird/issues/1408 https://github.com/netbirdio/netbird/issues/1267 ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 03:07:36 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#15419