Files
meshcore-hub/docker-compose.dev.yml
T
Louis King 385d1ab141 feat: add optional Redis caching layer for API endpoints
Add Redis-backed response caching for read-heavy API endpoints (nodes,
advertisements, messages, channels, dashboard, profiles) with configurable
TTL, key prefix isolation, and graceful fallback when Redis is unavailable.

New files:
- common/redis.py: CacheBackend, NullCache, RedisCacheBackend
- api/cache.py: @cached decorator, sorted_query_string helper
- tests/test_api/test_cache.py: 23 unit tests

Changes:
- pyproject.toml: add redis[hiredis] dependency
- common/config.py: 8 Redis settings on APISettings
- api/cli.py: Redis Click options + startup banner
- api/app.py: Redis lifespan init/cleanup, X-Cache middleware, health check
- 6 route files: apply @cached decorator to list endpoints
- docker-compose.yml: Redis service (cache profile), env vars
- docker-compose.dev.yml: Redis port exposure
- .env.example, README.md, AGENTS.md, docs/upgrading.md: documentation

Redis is disabled by default (REDIS_ENABLED=false). Enable with
--profile cache and REDIS_ENABLED=true.
2026-06-09 23:08:49 +01:00

32 lines
653 B
YAML

# MeshCore Hub - Development Docker Compose Override
#
# Exposes service ports for local development and testing.
# NOT intended for production use — use docker-compose.prod.yml instead.
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
services:
collector:
depends_on:
migrate:
condition: service_completed_successfully
mqtt:
condition: service_healthy
mqtt:
ports:
- "${MQTT_PORT:-1883}:${MQTT_PORT:-1883}"
api:
ports:
- "${API_PORT:-8000}:8000"
web:
ports:
- "${WEB_PORT:-8080}:8080"
redis:
ports:
- "${REDIS_PORT:-6379}:6379"