Add database readiness and native container health checks #58
No reviewers
Labels
No labels
activitypub
actor
admin
ai-safety
article
articles
atproto
bug
cli
configuration
content
dev-environment
docker
enhancement
feature
federation
fediverse
forgejo
garage
health
how-to
logging
markdown
mastodon
media
navigation
opengraph
passkeys
preview
priority:medium
production
release
rendering
s3
settings
setup
status:active
status:done
status:inprogress
technical
webauthn
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
erik/slugkit.com!58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/task-5e994039-readiness-healthchecks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add the current template's runtime health improvements while retaining slugkit.com's reference API and recent security/federation changes.
/ready: HTTP 200/ready only when an existing database connection contains every packaged migration marker; otherwise HTTP 503/not_ready. Responses are generic JSON with no-store caching./healthand/api/1.1.0/healthdatabase-independent and unchanged.scripts/healthcheck.mjsinto the runtime image and add the template's Docker HEALTHCHECK (30s interval, 5s timeout, 10s start period, 3 retries). Probe fetch has a 3s abort timeout, rejects redirects, honors existing binding precedence and succeeds only for HTTP 200/ready JSON.docs/health-checks.md.Task: task-5e994039
Verification
./scripts/pre-pr.shPASS: formatting, typecheck, build/reproducible CSS and 550 tests across 56 files.New regressions cover closed/uninitialized/unmigrated/read-only connections; missing/extra migration markers and recovery; no probe writes/schema creation/storage initialization/network calls; unchanged liveness and security headers; native probe address precedence, failures/JSON/redirects/timeout configuration; runtime Dockerfile script/HEALTHCHECK wiring; and real native Node subprocess success/failure/recovery against isolated loopback HTTP fixtures.
Pure mocked/configuration tests remain deterministic CI tests. Actual HTTP/subprocess verification is in
container-healthcheck.integration.test.ts, excluded from CI by the existing test:ci policy. No Docker/container/browser/federation integration provisioning or execution was added to CI/release workflows.Verification limit: the local Docker daemon is unavailable. No image build or actual container smoke test was performed. Static Docker configuration and native process/HTTP checks passed; those are not claimed as image-level verification.
Boundaries
No dependencies, migration SQL, production data/storage, application binding/version configuration, reference API/schema/archive, browser security/federation identity, branding or release workflow behavior changed. No image/tag publication, production deployment or homelab mutation was performed.
Docker image health metadata does not configure Kubernetes probes. Any Kubernetes readiness/liveness/startup manifest changes must be reviewed separately in homelab through Flux/GitOps, with startup migrations and rollout timings considered. Publishing/deployment remain separately approved operations.
Independent review —
46eefd54b7A separate fresh-context Pi reviewer inspected the full diff and relevant startup/application/database/configuration/test code with read/grep/find/ls only. Result: No actionable defects found.
Review confirmed existing-connection/SELECT-only readiness with fail-closed 200/503 responses and no-store caching; unchanged startup and database-independent liveness; correct packaged migration paths/runtime copying; probe binding/port precedence, timeout/redirect/response/exit handling; CI exclusion of real process/HTTP integration tests; and preservation of API/schema archives, security/federation, packages, migration SQL and workflows.
Optional suggestion: add a local-only delayed-header or stalled-body fixture for the actual three-second abort behavior. Deferred as non-blocking follow-up. Current unit tests verify configured timeout/error handling; actual native-process HTTP tests exercise success/failure/recovery and redirect rejection, not real stalled-body timing.
Verification limits: independent review was static/read-only and did not rerun checks. Implementation-session scripts/pre-pr.sh passed (550 tests in 56 files, formatting/types/build/reproducible CSS), and Forgejo PR CI run #57 passed for this exact commit. CI was checked via fj actions tasks due to the known fj pr status parser issue.
The Docker daemon is unavailable: no image build or container smoke test was performed. Static Docker configuration and native-process/loopback HTTP verification are not claimed as image-level or production verification. No image/tag publication, production deployment, homelab mutation or Kubernetes probe application was performed or authorized.