diff --git a/CHANGELOG.md b/CHANGELOG.md index a86eb77..602d16d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,17 @@ Notable changes to this stack. Format follows ## [Unreleased] +### Changed + +- `bootstrap.sh` creates only a `watchdog` healthchecks.io check per + project/environment, since that check reports the other scheduled jobs. + The `backup` and `restore-check` checks it used to create were never + pinged; delete them at healthchecks.io. `HC_JOBS` still overrides the list. + +### Fixed + +- `bootstrap.sh` prints each `PING_=` line on its own line. + ### Removed - `retired.yaml`: the hub has dropped the per-project rules it deleted. diff --git a/bootstrap.sh b/bootstrap.sh index 1d22e99..a274ec0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -6,7 +6,7 @@ # 1. renders the ProjectTelemetrySilent rule for every covered project/env; # 2. renders the coverage rule that catches projects never bootstrapped, and # reloads Grafana; -# 3. creates the project's healthchecks.io checks (if an API key is present); +# 3. creates the project's healthchecks.io watchdog check (if an API key is present); # 4. prints the `.env` block for the project host and the curls that vendor the # templates at a pinned tag. # @@ -131,11 +131,13 @@ fi # ------------------------------------------------------- 4. healthchecks.io + printout if [[ -n "${HEALTHCHECKS_API_KEY:-}" ]]; then - # Default job set; override per project with HC_JOBS="backup nightly-sync" etc. - for job in ${HC_JOBS:-backup watchdog restore-check}; do + # One watchdog check per project: it reports the project's other scheduled + # jobs, so a check per job would never be pinged. Override with + # HC_JOBS="watchdog nightly-sync" etc. for a job that pings its own check. + for job in ${HC_JOBS:-watchdog}; do # Key via curl's stdin config, not -H: argv is readable in `ps`. printf 'header = "X-Api-Key: %s"\n' "$HEALTHCHECKS_API_KEY" \ - | curl -fsS -K - -X POST https://healthchecks.io/api/v3/checks/ \ + | curl -fsS -w '\n' -K - -X POST https://healthchecks.io/api/v3/checks/ \ -H "Content-Type: application/json" \ -d "{\"name\":\"${project}-${env_name}-${job}\",\"slug\":\"${project}-${env_name}-${job}\",\"unique\":[\"name\"],\"timeout\":93600,\"grace\":3600,\"channels\":\"*\"}" \ | sed -n 's/.*"ping_url": *"\([^"]*\)".*/ PING_'"$(echo "$job" | tr 'a-z-' 'A-Z_')"'=\1/p' diff --git a/templates/README.md b/templates/README.md index 83d665b..f3961a3 100644 --- a/templates/README.md +++ b/templates/README.md @@ -90,8 +90,9 @@ no longer checks it, and the coverage rule no longer counts it as covered. ## Limits -The healthchecks.io free tier is 20 checks. `bootstrap.sh` creates three per -project/environment, so about six environments fit. +The healthchecks.io free tier is 20 checks. `bootstrap.sh` creates one per +project/environment (`watchdog`, which reports the other scheduled jobs), so +20 environments fit. Set `HC_JOBS` to create more. ## Verifying, from the monitoring host