Skip to content

Commit f20fa94

Browse files
fix: nodejs default v24 LTS (was v22); nginx install now opens UDP 443 + adds stream block on all 9 distros
1 parent 88e41b8 commit f20fa94

1 file changed

Lines changed: 28 additions & 6 deletions

File tree

panel/routes/os_utils.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,35 @@ def add_repo_key(url, keyring_path):
110110
)
111111

112112
def nginx_install_script(channel='stable'):
113-
"""Nginx official install script for all distros"""
113+
"""Nginx official install script for all distros.
114+
Also:
115+
- Opens UDP 443 in firewall (required for HTTP/3 QUIC)
116+
- Adds stream {} block to nginx.conf (required for TCP load balancing)
117+
"""
114118
os_info = get_os()
119+
stream_setup = (
120+
# Add stream block if missing — needed for TCP LB
121+
'grep -q "^stream" /etc/nginx/nginx.conf 2>/dev/null || '
122+
'echo -e "\\nstream {\\n include /etc/nginx/stream.d/*.conf;\\n}" >> /etc/nginx/nginx.conf; '
123+
'mkdir -p /etc/nginx/stream.d; '
124+
# Open UDP 443 for HTTP/3 QUIC — idempotent
125+
'(ufw status 2>/dev/null | grep -q "Status: active" && ufw allow 443/udp 2>/dev/null); '
126+
'(firewall-cmd --state 2>/dev/null | grep -q running && '
127+
'firewall-cmd --add-port=443/udp --permanent 2>/dev/null && '
128+
'firewall-cmd --reload 2>/dev/null); '
129+
'true'
130+
)
115131
if os_info['family'] == 'debian':
116132
repo = 'http://nginx.org/packages/ubuntu' if channel == 'stable' else 'http://nginx.org/packages/mainline/ubuntu'
117133
return (
118134
f'curl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --batch --no-tty --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg && '
119135
f'echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] {repo} {os_info["codename"]} nginx" > /etc/apt/sources.list.d/nginx.list && '
120136
f'{pkg_update()} && '
121137
f'{pkg_install("nginx")} && '
122-
f'systemctl enable nginx && systemctl start nginx'
138+
f'systemctl enable nginx && systemctl start nginx && '
139+
f'{stream_setup}'
123140
)
124-
elif os_info['family'] in ('rhel','fedora'):
141+
elif os_info['family'] in ('rhel', 'fedora'):
125142
return (
126143
f'cat > /etc/yum.repos.d/nginx.repo << EOF\n'
127144
f'[nginx-{channel}]\n'
@@ -132,9 +149,13 @@ def nginx_install_script(channel='stable'):
132149
f'gpgkey=https://nginx.org/keys/nginx_signing.key\n'
133150
f'EOF\n'
134151
f'{pkg_install("nginx")} && '
135-
f'systemctl enable nginx && systemctl start nginx'
152+
f'systemctl enable nginx && systemctl start nginx && '
153+
f'{stream_setup}'
136154
)
137-
return f'{pkg_install("nginx")} && systemctl enable nginx && systemctl start nginx'
155+
return (
156+
f'{pkg_install("nginx")} && systemctl enable nginx && systemctl start nginx && '
157+
f'{stream_setup}'
158+
)
138159

139160
def php_install_script(ver):
140161
"""PHP install script for all distros"""
@@ -271,9 +292,10 @@ def docker_install_script():
271292
)
272293
return 'curl -fsSL https://get.docker.com | sh && systemctl enable docker && systemctl start docker'
273294

274-
def nodejs_install_script(ver='22'):
295+
def nodejs_install_script(ver='24'):
275296
"""Node.js official install script for all distros"""
276297
return (
298+
f'rm -f /etc/apt/sources.list.d/nodesource.list /usr/share/keyrings/nodesource.gpg /usr/share/keyrings/nodesource-repo.gpg 2>/dev/null; '
277299
f'curl -fsSL https://deb.nodesource.com/setup_{ver}.x | bash - 2>/dev/null || '
278300
f'curl -fsSL https://rpm.nodesource.com/setup_{ver}.x | bash - 2>/dev/null; '
279301
f'{pkg_install("nodejs")}'

0 commit comments

Comments
 (0)