This commit is contained in:
Mateusz Gruszczyński
2025-11-13 10:24:11 +01:00
parent 15d76f95e6
commit bd42b7ad0b

View File

@@ -1527,14 +1527,13 @@ exec sudo -n /usr/sbin/angie "$@"
def write_metrics_files(): def write_metrics_files():
cert_path = NPM_ADMIN_CERT_PATH cert_path = NPM_ADMIN_CERT_PATH
key_path = NPM_ADMIN_KEY_PATH key_path = NPM_ADMIN_KEY_PATH
"""Create /etc/angie/metrics.conf (port 82/8282 with console & status).""" """Create /etc/angie/metrics.conf (port 82/8282 with console & status)."""
with step("Adding Angie metrics & console on :82 / :8282 (https)"): with step("Adding Angie metrics & console on :82 / :8282 (https)"):
metrics = f"""include /etc/angie/prometheus_all.conf; metrics = f"""include /etc/angie/prometheus_all.conf;
server { server {{
listen 8282 ssl; listen 8282 ssl;
http2 on; http2 on;
access_log off; access_log off;
@@ -1542,7 +1541,7 @@ server {
ssl_certificate {cert_path}; ssl_certificate {cert_path};
ssl_certificate_key {key_path}; ssl_certificate_key {key_path};
location / { location / {{
default_type text/html; default_type text/html;
echo '<!DOCTYPE html>'; echo '<!DOCTYPE html>';
echo '<html><head><title>Status Page</title></head><body>'; echo '<html><head><title>Status Page</title></head><body>';
@@ -1553,40 +1552,40 @@ server {
echo '<li><a href="/p8s">Prometheus Metrics</a></li>'; echo '<li><a href="/p8s">Prometheus Metrics</a></li>';
echo '</ul>'; echo '</ul>';
echo '</body></html>'; echo '</body></html>';
} }}
location /nginx_status { location /nginx_status {{
stub_status on; stub_status on;
access_log off; access_log off;
allow all; allow all;
} }}
auto_redirect on; auto_redirect on;
location /status/ { location /status/ {{
api /status/; api /status/;
api_config_files on; api_config_files on;
} }}
location /console/ { location /console/ {{
alias /usr/share/angie-console-light/html/; alias /usr/share/angie-console-light/html/;
index index.html; index index.html;
} }}
location /console/api/ { location /console/api/ {{
api /status/; api /status/;
} }}
location =/p8s { location =/p8s {{
prometheus all; prometheus all;
} }}
} }}
server { server {{
listen 82; listen 82;
access_log off; access_log off;
location / { location / {{
default_type text/html; default_type text/html;
echo '<!DOCTYPE html>'; echo '<!DOCTYPE html>';
echo '<html><head><title>Status Page</title></head><body>'; echo '<html><head><title>Status Page</title></head><body>';
@@ -1597,34 +1596,34 @@ server {
echo '<li><a href="/p8s">Prometheus Metrics</a></li>'; echo '<li><a href="/p8s">Prometheus Metrics</a></li>';
echo '</ul>'; echo '</ul>';
echo '</body></html>'; echo '</body></html>';
} }}
location /nginx_status { location /nginx_status {{
stub_status on; stub_status on;
access_log off; access_log off;
allow all; allow all;
} }}
auto_redirect on; auto_redirect on;
location /status/ { location /status/ {{
api /status/; api /status/;
api_config_files on; api_config_files on;
} }}
location /console/ { location /console/ {{
alias /usr/share/angie-console-light/html/; alias /usr/share/angie-console-light/html/;
index index.html; index index.html;
} }}
location /console/api/ { location /console/api/ {{
api /status/; api /status/;
} }}
location =/p8s { location =/p8s {{
prometheus all; prometheus all;
} }}
} }}
""" """
write_file(Path("/etc/angie/metrics.conf"), metrics, 0o644) write_file(Path("/etc/angie/metrics.conf"), metrics, 0o644)