Redis Configuration

Configure the cache layer for distributed and standalone modes.

Compozy’s cache layer supports two modes:

  • distributed: connect to an external Redis instance (production/staging)
  • standalone: run an embedded, Redis‑compatible server with optional snapshots (development/CI)

Configuration Structure

compozy.yaml
redis:
  mode: distributed | standalone

  distributed:
    addr: localhost:6379
    password: ""
    db: 0
    tls:
      enabled: false
      insecure_skip_verify: false

  standalone:
    persistence:
      enabled: false
      dir: ./.tmp/redis
      interval: 60s

Distributed Mode (External Redis)

Use this for production and shared environments.

redis:
  mode: distributed
  distributed:
    addr: redis.prod.internal:6379
    password: ${REDIS_PASSWORD}
    tls:
      enabled: true

Environment Variables

PathEnv
redis.modeREDIS_MODE
redis.distributed.addrREDIS_ADDR
redis.distributed.passwordREDIS_PASSWORD
redis.distributed.dbREDIS_DB

Standalone Mode (Embedded)

Runs a Redis‑compatible server inside the Compozy process.

redis:
  mode: standalone
  standalone:
    persistence:
      enabled: true
      dir: ./.tmp/redis
      interval: 30s

Persistence Options

  • enabled: turn on periodic snapshots for CI scenarios that need restarts
  • dir: where snapshots are stored; ensure the process can write here
  • interval: snapshot frequency (time.Duration syntax)

Performance Tuning

  • Prefer distributed with managed Redis for high throughput
  • For standalone, disable snapshots in tight loops to minimize I/O
  • Use separate DB indexes (db) per tenant in shared dev boxes

Monitoring & Metrics

  • In distributed mode, use INFO, latency monitors, and your provider’s dashboards
  • In standalone, observe Compozy logs; enable debug logs when diagnosing cache behavior

Troubleshooting

  • "connection refused" (standalone): ensure the process owns the snapshot dir and no port conflicts
  • Authentication failures (distributed): verify password and TLS settings
  • Snapshot errors: validate interval format and directory permissions

See Also