From c4f7dc734c78f10f1f33f44c29d2a55485e313b9 Mon Sep 17 00:00:00 2001 From: jross Date: Tue, 7 Jul 2026 16:23:57 -0600 Subject: [PATCH 1/2] feat(monitoring): add OpenStatus monitoring-as-code config Adds openstatus.yaml at the repo root defining an HTTP monitor on the production /health endpoint (https://ocotillo-api.newmexicowaterdata.org/health) asserting statusCode == 200. Because /health returns 503 when Postgres is unreachable, a 200 proves both the app process and the database are healthy. Config-as-code per the recommendation in docs/api-monitoring-options.md: apply with `openstatus monitors apply --config openstatus.yaml`. Frequency/regions are tuned for the SaaS free tier (10m). Includes a commented db=ok body assertion (enable once the DB-checking /health from PR #773 is live in prod) and a commented staging monitor. Co-Authored-By: Claude Opus 4.8 --- openstatus.yaml | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 openstatus.yaml diff --git a/openstatus.yaml b/openstatus.yaml new file mode 100644 index 000000000..751dd35ab --- /dev/null +++ b/openstatus.yaml @@ -0,0 +1,59 @@ +# yaml-language-server: $schema=https://www.openstatus.dev/schema.json +# +# OpenStatus monitoring-as-code for OcotilloAPI. +# See docs/api-monitoring-options.md for the tool evaluation and rationale. +# +# Apply with the OpenStatus CLI (https://www.openstatus.dev/docs/cli): +# openstatus monitors apply --config openstatus.yaml +# Authenticate first via `openstatus login` (or set the OpenStatus API key per +# the CLI docs). `apply` diffs this file against the account and creates, +# updates, or deletes monitors to match — this file is the source of truth. +# +# frequency/regions are set for the SaaS free tier (10m interval). Raise the +# frequency and add regions once on a paid tier or self-hosted. + +ocotillo-api-production: + name: "OcotilloAPI — Production" + description: "Production OcotilloAPI health endpoint (FastAPI + PostGIS on App Engine)." + frequency: "10m" + active: true + regions: ["iad", "lax"] + retry: 3 + kind: http + request: + url: https://ocotillo-api.newmexicowaterdata.org/health + method: GET + headers: + User-Agent: openstatus + assertions: + # /health returns 503 when Postgres is unreachable (see core/app.py), so a + # 200 proves both the app process AND the database are healthy. + - kind: statusCode + compare: eq + target: 200 + # Extra insurance: assert the JSON "db" field is explicitly ok. Requires the + # DB-check /health (PR #773, > v1.1.5) to be live in production; enable once + # that release has deployed to prod. + # - kind: textBody + # compare: contains + # target: '"db":"ok"' + +# Staging monitor — uncomment to also watch staging (counts against the SaaS +# free-tier one-monitor limit; enable on a paid tier or self-host). +# ocotillo-api-staging: +# name: "OcotilloAPI — Staging" +# description: "Staging OcotilloAPI health endpoint." +# frequency: "10m" +# active: true +# regions: ["iad"] +# retry: 3 +# kind: http +# request: +# url: https://ocotillo-api-staging.newmexicowaterdata.org/health +# method: GET +# headers: +# User-Agent: openstatus +# assertions: +# - kind: statusCode +# compare: eq +# target: 200 From 7802f015134dcf22f436d3f7f6f937babb9caa0b Mon Sep 17 00:00:00 2001 From: jross Date: Tue, 7 Jul 2026 16:29:51 -0600 Subject: [PATCH 2/2] fix(monitoring): use single region for OpenStatus free tier `openstatus monitors apply` failed with "Region 'lax' is not available on your plan". The SaaS free tier allows a single region; drop to ["iad"]. Adding more regions requires a paid tier or self-hosted probes. Co-Authored-By: Claude Opus 4.8 --- openstatus.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openstatus.yaml b/openstatus.yaml index 751dd35ab..405d8a86c 100644 --- a/openstatus.yaml +++ b/openstatus.yaml @@ -17,7 +17,9 @@ ocotillo-api-production: description: "Production OcotilloAPI health endpoint (FastAPI + PostGIS on App Engine)." frequency: "10m" active: true - regions: ["iad", "lax"] + # SaaS free tier allows a single region; add more (e.g. "lax", "ams") on a + # paid tier or self-hosted probes. + regions: ["iad"] retry: 3 kind: http request: