Skip to content

Deployment Guide

This guide outlines the infrastructure requirements and operational hardening steps necessary to move Open Outbox Relay from a local demo to a high-availability production environment.

Before deploying, ensure your environment meets the following minimum requirements:

  • Database: PostgreSQL 12+ (PostgreSQL 13+ recommended for native gen_random_uuid() support).
  • Message Broker: Kafka 3.0+, NATS JetStream, or Redis 7.0+.
  • Network: The Relay requires outbound access to the database and broker. Inbound access to the Server Port (default 8080) is required for health probes and operational metrics via the /stats endpoint see Diagnostics & Observability.

The Relay is designed to be “migration-agnostic.” It does not automatically modify your production schema. You must apply the latest Open Outbox schema manually.

  1. Apply Schema: Execute the Open Outbox Core DDL in your database.
  2. Verify Permissions: Ensure the database user assigned to the Relay has SELECT, UPDATE, and DELETE permissions on the openoutbox_events table.
  3. Indexes: Ensure the composite indexes from the provided schema is applied. This index is critical for maintaining constant query performance as the outbox table grows.

Open Outbox Relay is distributed as a lightweight container, providing flexibility for different infrastructure strategies.

Run the Relay within the same Pod (Kubernetes) or Task (AWS ECS) as your application.

  • Lifecycle Coupling: The Relay is deployed alongside your app, ensuring event processing is always available when the app is running.
  • Operational Simplicity: Scales 1:1 with your application instances without requiring a separate deployment pipeline.
  • Best for: Small-to-medium services where simplified management is the priority.

Run a dedicated cluster of Relays as a standalone service.

  • Resource Efficiency: Allows you to scale the Relay independently of your application (e.g., 20 app instances serviced by 3 Relays), significantly reducing the number of open database connections.
  • Isolation: Prevents heavy event-processing spikes from consuming CPU or Memory reserved for your primary application.
  • Best for: High-volume production environments where database connection limits and resource optimization are critical.

For most production environments, the official Docker image is the recommended way to run the Relay.

A production-ready docker-compose.yaml should include environment-specific tuning and log configuration.

services:
relay:
image: openoutbox/relay:latest
restart: always
ports:
- "8080:8080"
environment:
- ENVIRONMENT=production
- STORAGE_TYPE=postgres
- STORAGE_URL=postgres://user:pass@db-host:5432/db
- PUBLISHER_TYPE=kafka
- PUBLISHER_URL=kafka-host:9092

When moving to production, default settings should be reviewed for reliability and performance.

VariableRecommendationPurpose
ENVIRONMENTproductionEnables structured JSON logging and production-level telemetry.
BATCH_SIZE500 - 2000Tune this based on your database IOPS and network throughput.
POLL_INTERVAL100msThe “sleep” duration when no events are found. Controls the trade-off between database idle load and “near real-time” latency.

See the configuration reference for more details.

We strongly recommend enabling OpenTelemetry to monitor your delivery health.

Terminal window
# Example OTLP configuration
OTEL_EXPORTER_OTLP_ENDPOINT="http://otel-collector:4317"
OTEL_TRACES_EXPORTER="otlp"
OTEL_METRICS_EXPORTER="otlp"

See the Diagonostics & Observability reference for more details.