Skip to content

Deployment ​

Data Persistence ​

Nexo stores all data under ./data/ by default:

data/
├── queues/     ← Queue messages (SQLite WAL)
├── streams/    ← Stream log + group state (single SQLite WAL database)
└── pubsub/     ← Pub/Sub retained messages (SQLite)

In Docker, this directory lives inside the container — meaning data is lost when the container is removed. To persist data across restarts, mount a Docker volume:

bash
# Simple: single volume for all brokers
docker run -d \
  -p 7654:7654 \
  -v nexo-data:/app/data \
  emanuelepifani/nexo

# Or bind to a host directory
docker run -d \
  -p 7654:7654 \
  -v /mnt/ssd/nexo:/app/data \
  emanuelepifani/nexo

Separate Disks (Advanced) ​

If your brokers have different I/O profiles (e.g. Streams write heavily, Queues need low latency), you can map each to a different disk using environment variables:

bash
docker run -d \
  -p 7654:7654 \
  -e QUEUE_ROOT_PERSISTENCE_PATH=/data/queues \
  -e STREAM_ROOT_PERSISTENCE_PATH=/data/streams \
  -e PUBSUB_ROOT_PERSISTENCE_PATH=/data/pubsub \
  -v /mnt/fast-ssd:/data/queues \
  -v /mnt/large-hdd:/data/streams \
  -v /mnt/fast-ssd:/data/pubsub \
  emanuelepifani/nexo

For most deployments, a single volume is sufficient.

Resource Provisioning ​

Provision Queue and Stream resources after the Nexo server becomes ready and before application workloads start. Run this from a deployment job or administrative process; application code should use get() and fail fast when a required resource is missing.

typescript
const client = await NexoClient.connect();
await client.queue.create('emails', { visibilityTimeoutMs: 30_000, maxDeliveries: 5 });
await client.stream.create('events', { retention: { maxAgeMs: 604_800_000 } });

Provisioning is safe to repeat when the effective configuration is identical. A different effective configuration raises ResourceConfigurationConflictError with the requested configuration, active configuration, and field-level differences.

Max Payload Size ​

Nexo enforces a maximum payload size per frame to prevent memory exhaustion from oversized or malicious requests. Any frame exceeding this limit is rejected at the protocol level before allocating memory.

The default limit is 10 MB. To increase it (e.g. for large stream messages or queue payloads):

bash
docker run -p 7654:7654 -e MAX_PAYLOAD_SIZE=52428800 emanuelepifani/nexo  # 50MB

Environment Variables ​

VariableDefaultDescription
SERVER_HOST127.0.0.1Bind address (set to 0.0.0.0 to expose on all interfaces, e.g. in Docker)
SERVER_SOCKET_TCP_PORT7654Client TCP socket port
NEXO_LOGerrorLog level (error, warn, info, debug, trace)
MAX_PAYLOAD_SIZE10485760Max frame payload in bytes (10 MB)
QUEUE_ROOT_PERSISTENCE_PATH./data/queuesQueue data directory
STREAM_ROOT_PERSISTENCE_PATH./data/streamsStream data directory
STREAM_STORAGE_QUEUE_CAPACITY16384Pending storage commands before publish backpressure
PUBSUB_ROOT_PERSISTENCE_PATH./data/pubsubPub/Sub data directory