Skip to content

[Backend] Add a health-check and readiness endpoint covering Redis, RPC, and indexer lag #248

Description

@grantfox-oss

Problem

The microservices architecture introduces real distributed-systems failure modes (Redis down, indexer worker crashed, RPC unreachable) but the README only mentions /metrics for Prometheus scraping — there's no lightweight /healthz//readyz for orchestrators (Docker Compose healthchecks, PM2, k8s if ever adopted) to use for restart/alerting decisions.
Proposed work

Add /api/health (liveness: is the process up) and /api/ready (readiness: can Redis be reached, is the indexer's last-seen ledger within an acceptable lag window) endpoints to server-decoupled.ts.
Wire the existing docker-compose.microservices.yml services to use these for their healthcheck blocks instead of (presumably) no healthcheck or a naive TCP check.
Document expected response shapes and status codes in MICROSERVICES_ARCHITECTURE.md.

Acceptance criteria

Killing the Redis container causes /api/ready to report unhealthy within one polling interval, verified manually or via test.
Docker Compose correctly restarts/holds back dependent services based on these healthchecks.
Endpoints return structured JSON (not just 200/500) so monitoring tools can distinguish which dependency failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions