feat: enhance observability with dynamic links, Docker API integration, and health checks
This commit is contained in:
+78
-56
@@ -1,70 +1,92 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
# Dashboard nginx — runs as root to access Docker socket
|
||||
user root;
|
||||
worker_processes auto;
|
||||
pid /var/run/nginx.pid;
|
||||
pcre_jit on;
|
||||
|
||||
# CORS headers for API endpoints
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Allow-Methods "GET, OPTIONS";
|
||||
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options DENY;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header Referrer-Policy same-origin;
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# Gzip
|
||||
gzip on;
|
||||
gzip_types text/html text/css application/javascript application/json;
|
||||
|
||||
# Jaeger API proxy
|
||||
location /api/jaeger/ {
|
||||
proxy_pass http://jaeger:16686/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 30s;
|
||||
}
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Jaeger UI
|
||||
location /jaeger/ {
|
||||
proxy_pass http://jaeger:16686/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_read_timeout 86400s;
|
||||
}
|
||||
# Security headers
|
||||
add_header X-Frame-Options DENY;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header Referrer-Policy same-origin;
|
||||
|
||||
# OTel collector prometheus metrics
|
||||
location /api/metrics {
|
||||
proxy_pass http://otel-collector:8889/metrics;
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 10s;
|
||||
}
|
||||
# Jaeger API proxy
|
||||
location /api/jaeger/ {
|
||||
proxy_pass http://jaeger:16686/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 30s;
|
||||
}
|
||||
|
||||
# OTel collector health
|
||||
location /api/health {
|
||||
proxy_pass http://otel-collector:8888/healthz;
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 5s;
|
||||
}
|
||||
# Jaeger UI
|
||||
location /jaeger/ {
|
||||
proxy_pass http://jaeger:16686/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_read_timeout 86400s;
|
||||
}
|
||||
|
||||
# Static files (including index.html)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
expires 5s;
|
||||
add_header Cache-Control "public, must-revalidate";
|
||||
}
|
||||
# OTel collector prometheus metrics
|
||||
location /api/metrics {
|
||||
proxy_pass http://otel-collector:8889/metrics;
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 10s;
|
||||
}
|
||||
|
||||
# Deny hidden files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
# OTel collector health
|
||||
location /api/health {
|
||||
proxy_pass http://otel-collector:13133/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 5s;
|
||||
}
|
||||
|
||||
error_page 404 /index.html;
|
||||
# Docker API proxy (read-only Unix socket)
|
||||
location /api/docker/ {
|
||||
proxy_pass http://unix:/var/run/docker.sock:/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_read_timeout 10s;
|
||||
}
|
||||
|
||||
# Static files
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
expires 5s;
|
||||
add_header Cache-Control "public, must-revalidate";
|
||||
}
|
||||
|
||||
# Deny hidden files
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
error_page 404 /index.html;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user