- 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
14 lines
393 B
Bash
Executable File
14 lines
393 B
Bash
Executable File
#!/bin/sh
|
|
# Point the UI at the API: rewrite config.js from $API_BASE_URL at container start.
|
|
set -e
|
|
case "$API_BASE_URL" in
|
|
http://*|https://*) ;;
|
|
*) echo "API_BASE_URL must start with http:// or https://" >&2; exit 1 ;;
|
|
esac
|
|
url=$(printf '%s' "$API_BASE_URL" | sed 's#/*$##; s#["\\]##g')
|
|
cat > /usr/share/nginx/html/config.js <<JS
|
|
window.SCROBBLER_CONFIG = {
|
|
apiBaseUrl: "$url",
|
|
};
|
|
JS
|