# Prometheus ## Description [Prometheus](https://prometheus.io/) is an open-source systems monitoring and alerting toolkit that collects and stores time-series metrics and provides a powerful query language (PromQL). ## Overview This role deploys Prometheus as part of the Infinito.Nexus stack using Docker Compose. It exposes the Prometheus web UI at `prometheus.` and protects it with SSO via Keycloak using oauth2-proxy. Universal logout is integrated for session termination. ## Cosmos The diagram places Prometheus in the Infinito.Nexus cosmos: the components it deploys (capabilities), the central services it consumes (dependencies), and its outward reach (federation and bridged external networks). ```mermaid flowchart LR subgraph deps [Dependencies] dep_svc_bkp_volume_2_local["svc-bkp-volume-2-local 💻"] dep_svc_net_tor["svc-net-tor 🐳🐝"] dep_web_app_dashboard["web-app-dashboard 🐳🐝"] dep_web_app_flowise["web-app-flowise 🐳🐝"] dep_web_app_hermes["web-app-hermes 🐳🐝"] dep_web_app_keycloak["web-app-keycloak 🐳🐝"] dep_web_app_matomo["web-app-matomo 🐳🐝"] dep_web_app_openclaw["web-app-openclaw 🐳🐝"] dep_web_app_openwebui["web-app-openwebui 🐳🐝"] dep_web_app_stalwart["web-app-stalwart 🐳🐝"] dep_web_svc_css["web-svc-css 💻"] dep_web_svc_logout["web-svc-logout 🐳🐝"] end subgraph role [web-app-prometheus 🐳🐝] svc_sso["sso"] svc_logout["logout"] svc_dashboard["dashboard"] svc_matomo["matomo"] svc_email["email"] svc_css["css"] svc_javascript["javascript"] svc_prometheus["prometheus"] svc_alertmanager["alertmanager"] svc_blackbox_exporter["blackbox-exporter"] svc_cadvisor["cadvisor"] svc_node_exporter["node-exporter"] svc_tor["tor"] svc_container_backup["container_backup"] svc_prometheusmcp["prometheusmcp"] svc_openwebui["openwebui"] svc_hermes["hermes"] svc_openclaw["openclaw"] svc_flowise["flowise"] end subgraph dependents [Dependents] dpt_web_app_akaunting["web-app-akaunting 🐳🐝"] dpt_web_app_baserow["web-app-baserow 🐳🐝"] dpt_web_app_bigbluebutton["web-app-bigbluebutton 🐳🐝"] dpt_web_app_bluesky["web-app-bluesky 🐳🐝"] dpt_web_app_bookwyrm["web-app-bookwyrm 🐳🐝"] dpt_web_app_bridgy_fed["web-app-bridgy-fed 🐳🐝"] dpt_web_app_checkmk["web-app-checkmk 🐳🐝"] dpt_web_app_chess["web-app-chess 🐳🐝"] dpt_web_app_confluence["web-app-confluence 🐳🐝"] dpt_web_app_dashboard["web-app-dashboard 🐳🐝"] dpt_web_app_decidim["web-app-decidim 🐳🐝"] dpt_web_app_discourse["web-app-discourse 🐳🐝"] dpt_more["..."] end dep_svc_bkp_volume_2_local -. "0..1" .-> svc_container_backup dep_svc_net_tor -. "0..1" .-> svc_tor dep_web_app_dashboard -. "0..1" .-> svc_dashboard dep_web_app_flowise -. "0..1" .-> svc_flowise dep_web_app_hermes -. "0..1" .-> svc_hermes dep_web_app_keycloak -. "0..1" .-> svc_sso dep_web_app_matomo -. "0..1" .-> svc_matomo dep_web_app_openclaw -. "0..1" .-> svc_openclaw dep_web_app_openwebui -. "0..1" .-> svc_openwebui dep_web_app_stalwart -. "0..1" .-> svc_email dep_web_svc_css -. "0..1" .-> svc_css dep_web_svc_logout -. "0..1" .-> svc_logout svc_sso -- "1:1" --> dpt_more svc_sso -. "0..1" .-> dpt_web_app_akaunting svc_sso -. "0..1" .-> dpt_web_app_baserow svc_sso -. "0..1" .-> dpt_web_app_bigbluebutton svc_sso -. "0..1" .-> dpt_web_app_bluesky svc_sso -. "0..1" .-> dpt_web_app_bookwyrm svc_sso -. "0..1" .-> dpt_web_app_bridgy_fed svc_sso -. "0..1" .-> dpt_web_app_checkmk svc_sso -. "0..1" .-> dpt_web_app_chess svc_sso -. "0..1" .-> dpt_web_app_confluence svc_sso -. "0..1" .-> dpt_web_app_dashboard svc_sso -. "0..1" .-> dpt_web_app_decidim svc_sso -. "0..1" .-> dpt_web_app_discourse ``` Solid `1:1` edges are fixed relationships; dashed `0..1` edges are conditional (enabled only in matching deployments); red `0..0` edges are turned off in this role. Node markers show the role's deploy modes (💻 host, 🐳 compose, 🐝 swarm); ❌ marks a service that is explicitly turned off, and ⚙️ an Ansible role dependency declared in `meta/main.yml`. ## Features - **Time-series metrics:** Collects and stores time-series data from configured targets. - **PromQL interface:** Query and explore metrics via the Prometheus web UI. - **SSO authentication:** Access is protected by Keycloak via oauth2-proxy. - **Universal logout:** Integrated session termination across the stack. ## Quick Setup ### Development Clone, set up the workstation, and deploy Prometheus onto the local stack: ```bash git clone https://github.com/infinito-nexus/core.git cd core make onboard make compose-deploy mode=reinstall apps=web-app-prometheus full_cycle=false ``` ### Production Run the published image to provision the inventory and deploy Prometheus to a managed server (the mounted volume persists the inventory): ```bash APP=web-app-prometheus HOST= DOMAIN= TLS_MODE=self_signed SSH_PUBLIC_KEY="" docker run --rm -it \ -v "$PWD/inventories:/etc/infinito.nexus/inventories" \ -e APP="$APP" -e HOST="$HOST" -e DOMAIN="$DOMAIN" -e TLS_MODE="$TLS_MODE" -e SSH_PUBLIC_KEY="$SSH_PUBLIC_KEY" \ ghcr.io/infinito-nexus/core/debian bash -c ' INVENTORY=/etc/infinito.nexus/inventories/production infinito administration inventory provision "$INVENTORY" \ --inventory-file "$INVENTORY/devices.yml" \ --host "$HOST" \ --include "$APP" \ --vars "{\"TLS_MODE\": \"$TLS_MODE\", \"DOMAIN_PRIMARY\": \"$DOMAIN\", \"users\": {\"administrator\": {\"authorized_keys\": [\"$SSH_PUBLIC_KEY\"]}}}" && infinito administration deploy dedicated "$INVENTORY/devices.yml" \ --password-file "$INVENTORY/.password" \ --diff -vv' ``` ## Further resources - [Prometheus Documentation](https://prometheus.io/docs/) - [prom/prometheus Docker image](https://hub.docker.com/r/prom/prometheus) ## Persona contract opt-outs [`meta/services.yml`](./meta/services.yml) admits only the Prometheus administrator RBAC group through the oauth2-proxy gate, so the `biber` persona is denied before it ever reaches a Prometheus page: [`templates/playwright.env.j2`](./templates/playwright.env.j2) declares `PERSONA_BIBER_BLOCKED=true`. That denial is not lost coverage — this role's own spec asserts it for every consumer, together with the admin reach and scrape-target parity checks. The `administrator` persona is blocked only when `services.sso.enabled` is false: without the co-deployed Keycloak there is no proxy in front of Prometheus, hence no login round-trip and no logout control to drive. The `guest` persona and the baseline reachability assertions run unconditionally. ## Credits Implemented by **[Alejandro Roman Ibanez](https://github.com/AlejandroRomanIbanez)**. Part of the [Infinito.Nexus Project](https://s.infinito.nexus/code) and maintained by [Kevin Veen-Birkenbach](https://www.veen.world). Licensed under the [Infinito.Nexus Community License (Non-Commercial)](https://s.infinito.nexus/license).