Monitoring stack, containers and dashboards
- API image (uv multi-stage, non-root, gunicorn, migrations on start, health check) and UI image (nginx, CSP, config.js rendered from API_BASE_URL); /healthz documented in OpenAPI - docker compose runs db, api and ui; the "monitoring" profile adds Prometheus, postgres-exporter and Grafana, all provisioned from files - Grafana dashboards: API overview (RED), Last.fm API, Usage, Database - Prometheus alert rules: API down, error rate, latency, auth failure spike, ignored scrobbles, DB pool saturation, Postgres down - Pool checkout gauge counts events (the pool's own counters lag the checkin event); error ratios show 0 instead of "No data" - Tests check dashboards and alerts only use metrics that exist - scripts/generate_traffic.py drives realistic traffic for demos Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
1 parent
faa74871a5
commit
ea705589f1
28 files changed
+3508
-14
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# Rendered by the nginx image's envsubst step (API_BASE_URL comes from the environment).
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
server_tokens off;
|
||||
|
||||
# add_header isn't inherited by locations that set their own, so the security
|
||||
# headers live in the location that serves pages.
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
# Files aren't fingerprinted, so always revalidate.
|
||||
add_header Cache-Control "no-cache";
|
||||
add_header Content-Security-Policy "default-src 'self'; connect-src 'self' ${API_BASE_URL}; img-src 'self' data:; style-src 'self'; font-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'" always;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Referrer-Policy same-origin always;
|
||||
}
|
||||
|
||||
location /fonts/ {
|
||||
add_header Cache-Control "public, max-age=2592000, immutable";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user