This commit is contained in:
Mateusz Gruszczyński
2025-11-13 09:57:49 +01:00
parent 23af0faadb
commit 4f68ec54c6

View File

@@ -1262,7 +1262,7 @@ def ensure_nginx_symlink():
# ========== Angie / NPM template ========== # ========== Angie / NPM template ==========
ANGIE_CONF_TEMPLATE = """# run angie in foreground ANGIE_CONF_TEMPLATE = r"""# run angie in foreground
#daemon off; #daemon off;
load_module /etc/angie/modules/ngx_http_headers_more_filter_module.so; load_module /etc/angie/modules/ngx_http_headers_more_filter_module.so;
@@ -1270,6 +1270,7 @@ load_module /etc/angie/modules/ngx_http_brotli_filter_module.so;
load_module /etc/angie/modules/ngx_http_brotli_static_module.so; load_module /etc/angie/modules/ngx_http_brotli_static_module.so;
load_module /etc/angie/modules/ngx_http_zstd_filter_module.so; load_module /etc/angie/modules/ngx_http_zstd_filter_module.so;
load_module /etc/angie/modules/ngx_http_zstd_static_module.so; load_module /etc/angie/modules/ngx_http_zstd_static_module.so;
load_module /etc/angie/modules/ngx_http_echo_module.so;
# other modules # other modules
include /data/nginx/custom/modules[.]conf; include /data/nginx/custom/modules[.]conf;
@@ -1321,7 +1322,7 @@ http {
# QUIC settings # QUIC settings
quic_retry on; quic_retry on;
quic_gso on; # Performance boost dla Linux z UDP_SEGMENT quic_gso on;
quic_active_connection_id_limit 2; quic_active_connection_id_limit 2;
# Enable BPF for connection migration (Linux 5.7+) # Enable BPF for connection migration (Linux 5.7+)
@@ -1498,6 +1499,7 @@ def setup_angie(ipv6_enabled: bool):
"angie-module-headers-more", "angie-module-headers-more",
"angie-module-brotli", "angie-module-brotli",
"angie-module-zstd", "angie-module-zstd",
"angie-module-echo"
] ]
optional = ["angie-module-prometheus", "angie-console-light"] optional = ["angie-module-prometheus", "angie-console-light"]
apt_install(base) apt_install(base)
@@ -1526,10 +1528,72 @@ exec sudo -n /usr/sbin/angie "$@"
def write_metrics_files(): def write_metrics_files():
"""Create /etc/angie/metrics.conf (port 82 with console & status).""" """Create /etc/angie/metrics.conf (port 82 with console & status)."""
with step("Adding Angie metrics & console on :82"): with step("Adding Angie metrics & console on :82 / :8282 (https)"):
metrics = """include /etc/angie/prometheus_all.conf; metrics = """include /etc/angie/prometheus_all.conf;
server {
listen 8282 ssl;
http2 on;
access_log off;
ssl_certificate {cert_path};
ssl_certificate_key {key_path};
location / {
default_type text/html;
echo '<!DOCTYPE html>';
echo '<html><head><title>Status Page</title></head><body>';
echo '<h1>Server Status</h1>';
echo '<ul>';
echo '<li><a href="/console/">Console</a></li>';
echo '<li><a href="/nginx_status">Status</a></li>';
echo '<li><a href="/p8s">Prometheus Metrics</a></li>';
echo '</ul>';
echo '</body></html>';
}
location /nginx_status {
stub_status on;
access_log off;
allow all;
}
auto_redirect on;
location /status/ {
api /status/;
api_config_files on;
}
location /console/ {
alias /usr/share/angie-console-light/html/;
index index.html;
}
location /console/api/ {
api /status/;
}
location =/p8s {
prometheus all;
}
}
server { server {
listen 82; listen 82;
access_log off;
location / {
default_type text/html;
echo '<!DOCTYPE html>';
echo '<html><head><title>Status Page</title></head><body>';
echo '<h1>Server Status</h1>';
echo '<ul>';
echo '<li><a href="/console/">Console</a></li>';
echo '<li><a href="/nginx_status">Status</a></li>';
echo '<li><a href="/p8s">Prometheus Metrics</a></li>';
echo '</ul>';
echo '</body></html>';
}
location /nginx_status { location /nginx_status {
stub_status on; stub_status on;
@@ -3080,7 +3144,7 @@ server {{
status_zone npm_admin; status_zone npm_admin;
root {root_path}; root {root_path};
access_log /dev/null; access_log off;
location /api {{ location /api {{
return 302 /api/; return 302 /api/;
@@ -3272,12 +3336,14 @@ def update_motd(
################################ NPM / ANGIE ################################ ################################ NPM / ANGIE ################################
OS: {OSREL['PRETTY']} ({OSREL['ID']} {OSREL['VERSION_ID']}) OS: {OSREL['PRETTY']} ({OSREL['ID']} {OSREL['VERSION_ID']})
{npm_line} {npm_line}
Angie & Prometheus stats: http://{ip}:82/console | http://{ip}:82/p8s Angie & Prometheus stats: http://{ip}:82/console | http://{ip}:82/p8s
or https://{ip}:8282/console | https://{ip}:8282/p8s
Angie: {angie_v} (conf: /etc/angie -> /etc/nginx, reload: angie -s reload) Angie: {angie_v} (conf: /etc/angie -> /etc/nginx, reload: angie -s reload)
Node.js: v{node_v} Yarn: v{yarn_v} Node.js: v{node_v} Yarn: v{yarn_v}
NPM: {npm_v} NPM: {npm_v}
{npm_source} {npm_source}
Paths: app=/opt/npm data=/data cache=/var/lib/angie/cache Paths: app=/opt/npm data=/data cache=/var/lib/angie/cache certbot=/opt/certbot
{ipv6_line} {ipv6_line}
########################################################################### ###########################################################################
""" """
@@ -3318,7 +3384,9 @@ def print_summary(
else: else:
print(f"NPM panel address: http://{ip}:{NPM_ADMIN_HTTP_PORT}") print(f"NPM panel address: http://{ip}:{NPM_ADMIN_HTTP_PORT}")
print(f"Angie & Prometheus stats: http://{ip}:82/console | http://{ip}:82/p8s") print(f"Angie & Prometheus stats: http://{ip}:82/console | http://{ip}:82/p8s")
print(f"Angie & Prometheus stats (https): https://{ip}:8282/console | http://{ip}:8282/p8s")
print(f"Angie: v{angie_v}") print(f"Angie: v{angie_v}")
print(f"Node.js: v{node_v}") print(f"Node.js: v{node_v}")
print(f"Yarn: v{yarn_v}") print(f"Yarn: v{yarn_v}")
@@ -3326,7 +3394,7 @@ def print_summary(
print(f"IPv6: {'ENABLED' if ipv6_enabled else 'DISABLED'}") print(f"IPv6: {'ENABLED' if ipv6_enabled else 'DISABLED'}")
print( print(
"Paths: /opt/npm (app), /data (data), /etc/angie (conf), /var/log/angie (logs)" "Paths: /opt/npm (app), /data (data), /etc/angie (conf), /opt/certbot (cerbot venv)"
) )
print("Services: systemctl status angie.service / npm.service") print("Services: systemctl status angie.service / npm.service")