Alert investigation log and cluster health dashboard for Kubernetes. Built to give visibility into what alerts fired, what caused them, and what was done about it.
Note
Cowtail is a personal project built for a specific home lab setup. It's public so others can reference the patterns (nginx-proxied Convex, Prometheus cluster health, Alertmanager integration) but it's not designed as a general-purpose tool. Feel free to fork and adapt it to your own cluster.
This repo contains five projects:
cli/contains the local command-line clientios/contains the native iPhone app and XcodeGen projectweb/contains the React app and Convex functionsprotocol/contains shared transport contracts and schemashermes-plugin/contains the Hermes plugin that gives Hermes agents thecowtailtool
- Signed-in web app — the owner signs in with Pocket ID; without a session every page shows the login page, and item, alert and fix reads answer only the owner's session or a service token
- Home — what needs the owner, with Approve, Deny, Reply, Acknowledge and Snooze, what Hermes is on, what is snoozed, and cluster health; handled items are in History, which opens on the last 24 hours
- Cluster — the alert pipeline's Watchdog state, node CPU/memory and readiness, Ceph storage, firing alerts by namespace, 7-day volume and the noisiest alerts
- History — outcome mix, time to resolve and noise rate over an item log grouped by day, with each item's fix; the filter lives in the address (
/history?q=&source=&kind=&outcome=&range=&from=&to=) and opens on the last 24 hours - Item detail — the item's timeline, details, links and linked fix at
/items/:id - Settings — quiet hours, urgency overrides, approval and roundup preferences, and Sign out
- Roundup page — shareable summary view at
/roundup?from=...&to=... - PWA — installable with custom icon
Browser ──→ nginx ──→ Static files (Vite build)
├──→ /api/ → Convex backend (WebSocket sync + queries)
├──→ /actions/ → Convex HTTP actions (alert writes)
└──→ /prometheus/→ Prometheus API (cluster health)
- Frontend: React + TypeScript + Tailwind CSS + Vite
- Data: Convex (self-hosted) — real-time sync via WebSocket
- Queries: TanStack Query +
@convex-dev/react-query - Cluster health: Prometheus queries proxied through nginx
- Deployment: Docker (nginx:alpine) on Kubernetes
- Node.js, the version in
.node-version, and pnpm, the version inpackage.json'spackageManager - A Convex deployment (cloud or self-hosted)
- Prometheus (for cluster health panel)
pnpm install
cp web/.env.example web/.env
# Set COWTAIL_DEV_ACTIONS_URL to your Convex HTTP actions URL; `vite dev` proxies /actions to it
pnpm run dev:webFor container/runtime values, copy web/.env.container.example into your deployment environment and set the real upstreams there instead of hardcoding them in tracked nginx config.
The root install covers the CLI too. Run its commands from cli/, or use pnpm run build:cli, pnpm run check:cli and pnpm run test:cli from the root.
For iOS development, work from ios/, run xcodegen generate, and open ios/Cowtail.xcodeproj.
The Hermes plugin needs only Python 3.11 or later. Test it with python -m unittest discover -s hermes-plugin/tests -v, and install it by copying hermes-plugin/ into the Hermes plugins directory.
-
Build the Docker image:
docker build -f web/Dockerfile -t cowtail . -
Set container environment variables from
web/.env.container.examplefor:CONVEX_API_UPSTREAMCONVEX_ACTIONS_UPSTREAMPROMETHEUS_UPSTREAMUNIVERSAL_LINKS_APP_ID
-
Set environment variables for the Convex HTTP actions:
COWTAIL_WEB_ORIGIN— your Cowtail URL (used in alert deep links)SITE_ORIGIN— older name forCOWTAIL_WEB_ORIGIN, read when that is unsetPROMETHEUS_BASE_URL— optional explicit Prometheus endpoint if it does not live behind/prometheusAPNS_TOPIC— the native app bundle identifier used for APNsAPPLE_AUTH_AUDIENCE— optional explicit Sign in with Apple audience override; defaults toAPNS_TOPICCOWTAIL_WATCHDOG_MAX_SILENCE_MINUTES— optional; how long the Alertmanager Watchdog may stay silent before Cowtail raises "Alert pipeline silent" (default15)COWTAIL_HERMES_HOOK_SECRET— the shared secret Hermes signs its outbound webhooks withALERTMANAGER_BASE_URL— Alertmanager's API as Convex reaches it inside the cluster, such ashttp://alertmanager.example:9093. Maintenance windows silence alerts through it; unset, a window still holds back Cowtail's pushes and shows that the silence failed. No nginx route exposes it on the web origin.
-
Optional: sign in with Pocket ID (OIDC). Cowtail is single-owner, and Pocket ID signs in as the same owner as Sign in with Apple.
- In Pocket ID, add an OIDC client that is confidential (not public), with PKCE enabled and the callback URL
<COWTAIL_WEB_ORIGIN>/actions/api/auth/oidc/callback. - Find the owner's
sub: in Pocket ID, open the owner's user; its ID is thesubthe ID token carries. - Set all four of these on the Convex deployment, or none of them:
OIDC_ISSUER_URL— the Pocket ID base URL,https://onlyOIDC_CLIENT_IDandOIDC_CLIENT_SECRET— from the client aboveCOWTAIL_OWNER_OIDC_SUBJECT— the owner's Pocket IDsub
COWTAIL_OWNER_USER_IDmust already hold the owner's Sign in with Apple subject; a Pocket ID sign-in becomes that user. Every other Pocket ID user is refused.OIDC_DISPLAY_NAMEoptionally renames the button; it defaults toPocket ID.- With none set, the OIDC routes return 404. With only some set, they return 500 naming the missing ones.
- In Pocket ID, add an OIDC client that is confidential (not public), with PKCE enabled and the callback URL
-
Optional: Sign in with Apple on the web. The browser signs in as the same owner as the iOS app.
- In the Apple Developer portal, create a Services ID, enable Sign in with Apple on it with the Cowtail App ID as its primary App ID, and register the Cowtail web domain and the return URL
<COWTAIL_WEB_ORIGIN>/actions/api/auth/apple/callback. - Set
APPLE_WEB_SERVICES_IDon the Convex deployment to that Services ID. Only the Apple account whose subject isCOWTAIL_OWNER_USER_IDcan sign in. - Unset, the login page offers no Apple button and the Apple web routes return 404.
- In the Apple Developer portal, create a Services ID, enable Sign in with Apple on it with the Cowtail App ID as its primary App ID, and register the Cowtail web domain and the return URL
-
Deploy using the HelmRelease in your GitOps repo, or any Kubernetes deployment method.
POST alerts to the Convex HTTP action endpoint:
curl -X POST https://your-cowtail-instance/actions/api/alerts \
-H "Content-Type: application/json" \
-d '{
"alertname": "KubePodCrashLooping",
"severity": "warning",
"namespace": "default",
"node": "worker-01",
"status": "resolved",
"outcome": "fixed",
"summary": "Pod restarting due to OOM",
"action": "Increased memory limit to 512Mi",
"rootCause": "Memory limit too low for workload",
"messaged": false
}'kube-prometheus-stack ships Watchdog, an alert that always fires. Route it to Cowtail's Alertmanager webhook (/actions/api/alerts/webhook, authorized with COWTAIL_ALERTMANAGER_WEBHOOK_TOKEN) with a short repeat_interval, so Alertmanager re-sends it every few minutes:
route:
routes:
- receiver: cowtail-direct
matchers:
- alertname = "Watchdog"
group_wait: 0s
repeat_interval: 5mCowtail stores no alert for it. Each Watchdog records the pipeline's heartbeat, and GET /api/health reports it as alertPipeline: { state, lastWatchdogAt }, where state is not_configured before the first Watchdog, ok while they arrive, and silent once none has arrived for COWTAIL_WATCHDOG_MAX_SILENCE_MINUTES. While silent, Cowtail keeps one urgent Alert pipeline silent item open, and the next Watchdog resolves it. Keep repeat_interval well under the threshold.
Hermes's outbound webhooks bring blocked kanban tasks, rate-limited kanban workers and model provider errors into Cowtail as items. Add this block to the Hermes host's config.yaml, and set COWTAIL_HERMES_HOOK_SECRET to the same value on the Hermes host and in the Convex environment:
hooks:
outbound:
- name: cowtail
url: https://your-cowtail-instance/actions/api/hermes/hooks
events: [kanban_task_blocked, on_kanban_worker_exited, api_request_error]
secret_env: COWTAIL_HERMES_HOOK_SECRET| Event | Item |
|---|---|
kanban_task_blocked |
a question for today, one per task |
on_kanban_worker_exited with exit_kind: rate_limited |
a failure for today, one per provider or profile |
api_request_error |
a failure for whenever, one per provider and status; the tenth in an hour raises it to today |
Cowtail refuses a delivery whose X-Hermes-Signature-256 does not match with 401, stores each delivery_id once, and answers every other event with 200.
Each service that posts items is a registered source with its own token, display name and icon. Register one with the CLI, which prints its token once:
cowtail sources add deployer --name "Mac deployer" --icon deployer.pngThe service then posts with Authorization: Bearer cts_… to POST /actions/api/items, and Cowtail sets the item's source from the token. A source token reaches only item ingest and its own items' events. cowtail sources rotate issues a new token and cowtail sources disable stops the source. The release seeds the built-in sources alertmanager, hermes, cowtail and manual, which post with the service token.
Swiss dark mode — dark background, red accents, Space Grotesk + DM Mono, grid precision.
