Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_<JOB>=` line on its own line.

### Removed

- `retired.yaml`: the hub has dropped the per-project rules it deleted.
Expand Down
10 changes: 6 additions & 4 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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'
Expand Down
5 changes: 3 additions & 2 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading