Files
meshcore-hub/docker-compose.test-db.yml
Louis King 3593d14878 feat(api): make Redis a required cache dependency
Redis becomes mandatory infrastructure (PostgreSQL-parity): the
REDIS_ENABLED flag, NullCache backend, and every conditional caching
code path are removed. /health/ready reports not_ready (503) when
Redis is unreachable and cached endpoints return 503 instead of
silently degrading; invalidation helpers never raise after a
committed write.

The bundled redis container joins the core profile only via
docker-compose.dev.yml (production points REDIS_* at an external
instance, same no-shadowing pattern as postgres), the backend suite
runs against real Redis (test-redis on 127.0.0.1:55433, CI redis:8
service container, per-xdist-worker key prefixes), and operator docs
describe the required-dependency setup (upgrading.md gains the
v0.20.0 section).
2026-08-30 21:51:51 +01:00

53 lines
1.8 KiB
YAML

# ==========================================================================
# Throwaway PostgreSQL + Redis instances for the backend test suite (pytest).
#
# NOT part of the application stack. Start/stop with:
# make test-db-up
# make test-db-down
#
# The Makefile pins -p meshcore-hub-test-db so a COMPOSE_PROJECT_NAME set in
# the repo .env (the dev stack) can never make `down` target dev services.
#
# The meshcorehub role owns the meshcorehub_test database (image entrypoint),
# which is exactly the privilege the per-xdist-worker test schemas need
# (CREATE SCHEMA) — no superuser and no CREATEDB required. The data directory
# is a tmpfs mount, so nothing survives `down`. Redis (required cache
# infrastructure) is published on 55433 with the same tmpfs treatment.
# ==========================================================================
name: meshcore-hub-test-db
services:
test-postgres:
image: postgres:17-alpine
container_name: meshcore-hub-test-postgres
ports:
- "127.0.0.1:55432:5432"
environment:
- POSTGRES_USER=meshcorehub
- POSTGRES_PASSWORD=meshcorehub-test
- POSTGRES_DB=meshcorehub_test
# Every pytest-xdist worker holds its own pooled engine (pool_size=20 +
# max_overflow=30) against this one instance, so raise max_connections
# above the Postgres default of 100.
command: ["postgres", "-c", "max_connections=200"]
tmpfs:
- /var/lib/postgresql/data:size=512m
healthcheck:
test: ["CMD-SHELL", "pg_isready -U meshcorehub -d meshcorehub_test"]
interval: 5s
timeout: 5s
retries: 10
test-redis:
image: redis:8-alpine
container_name: meshcore-hub-test-redis
ports:
- "127.0.0.1:55433:6379"
tmpfs:
- /data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10