Skip to content

Compose stacks

The Docker Compose files in stealth_name_service/backend/: which services each one defines, their replicas, ports and volumes, and which deploy mode loads it.

deploy.sh deploys them as a Docker Swarm stack with docker stack deploy, merging the files for the chosen mode. It sources .env first so ${VAR:-default} placeholders in the files are substituted. Services that use env_file: .env also receive the whole file as their environment. All stacks share one overlay network, app-network (driver: overlay, attachable: true), defined in docker-compose.backend.yml. See Deploying the stack and deploy.sh.

File Services Loaded by deploy.sh
docker-compose.backend.yml backend Every mode
docker-compose.bridge.yml event_listener, event_handler bridge, hybrid
docker-compose.benchmark.yml loadtest benchmark, hybrid
docker-compose.consensus.yml consensus_committee bridge and hybrid, when CONSENSUS_ENABLED is on
docker-compose.standalone.yml backend-standalone Never; for running one backend by hand

How deploy.sh selects files

compose_files_for_mode starts with the backend file and adds one set per mode:

Mode Files, in order Services started
bridge (default) backend, bridge backend, event_listener, event_handler. No load generator, so deploying never starts a test.
benchmark backend, benchmark backend, loadtest
hybrid backend, benchmark, bridge backend, loadtest, event_listener, event_handler

With CONSENSUS_ENABLED set to true, 1 or yes, the consensus file is appended in bridge and hybrid modes and consensus_committee joins the stack. In benchmark mode it is ignored with a warning. The stack is named stealth-name-service-backend_<mode>; service names in logs are <stack>_<service>.

docker-compose.backend.yml

Setting Value
Service backend, image stealth-backend:latest
Hostname backend.{{.Task.Slot}}.{{.Task.ID}}. The backend derives its coin partition from the slot.
Replicas 10. Keep it equal to the value COINS_PER_REPLICA assumes.
Ports Container 5000, published as ${BACKEND_PORT:-5000} in ingress mode (load-balanced across replicas).
Limits 3G memory, 2 CPUs per replica.
Environment env_file: .env.
Healthcheck curl -f http://localhost:5000/health every 5s, timeout 4s, 3 retries, start_period 180s (so a slow node does not get replicas killed while they start).
Volumes ./shared_data:/app/output; ./testing_backend/iota.keystore:/app/iota.keystore:ro

docker-compose.bridge.yml

Both services use the image event-listener:latest (built from the same testing_backend/Dockerfile), env_file: .env, depends_on: backend, and restart_policy: any. The handler lives here, not in an overlay of its own, because the listener posts straight to it; without it EVENT_HANDLER_URL resolves to nothing.

Service Command Volumes
event_listener /app/event_listener ./events_data:/app/data
event_handler /app/event_handler ./testing_backend/iota.keystore:/app/iota.keystore:ro; ./events_data:/app/data

Neither publishes a port; the other services reach the handler at event_handler:5000 over app-network. bridge_results.csv appears on the host as events_data/bridge_results.csv.

docker-compose.benchmark.yml

Setting Value
Service loadtest, image stealth-loadtest:latest, depends_on: backend
Environment OUTPUT_DIR=/app/output
Volumes ./shared_data:/app/output; ./agent/payloads:/app/payloads:ro; ./testing_backend/iota.keystore:/app/iota.keystore:ro
Restart condition: none (a load test runs once)
Limits 12G memory, 4 CPUs; nofile soft and hard 65536
Command /app/loadtest with --agents, --interval, --requests, --gas-budget, --target-url, --json, --arrival-type, --poisson-lambda, --increment-interval, --max-requests-per-interval and --pipeline-depth, each substituted from the .env variable of the same group with a compose fallback. See Load test.

docker-compose.consensus.yml

Setting Value
Service consensus_committee, image event-listener:latest, command /app/consensus_committee
Environment env_file: .env, plus CONSENSUS_HOME=/app/consensus and COMETBFT_BIN=/usr/local/bin/cometbft
Volumes ./consensus_data:/app/consensus. CometBFT homes and each node's cometbft.log land here, wiped on every start.
Restart condition: any
Ports None published. The listener posts to consensus_committee:5000.

One container runs every virtual node: a CometBFT process per validator, each driving its own ABCI app inside the Rust process, all on the container's loopback. See Adding the consensus committee.

docker-compose.standalone.yml

A single backend with no Swarm features, for running the HTTP API by hand.

Setting Value
Service backend-standalone, built from ./testing_backend, image stealth-backend:latest
Ports 5000:5000
Environment RUST_LOG=info, ENABLE_HTTPS=false, ACTIX_WORKERS=1, plus env_file: .env
Healthcheck Same as backend
Volumes ./shared_data:/app/output; ./testing_backend/iota.keystore:/app/iota.keystore:ro