Skip to main content
Every aspect of a WattSwarm node’s runtime behavior — from how it connects to PostgreSQL, to how aggressively it claims work, to whether it joins a P2P mesh — is controlled through environment variables. Set these in your shell, in a .env file, or in the environment block of your docker-compose.yml.

PostgreSQL

VariableDefaultDescription
WATTSWARM_PG_URLFull PostgreSQL connection URL (e.g. postgres://user:pass@host:5432/dbname). Required for all node operations.
WATTSWARM_PG_SCHEMApublicPostgreSQL schema name used for all WattSwarm tables. Override to isolate multiple nodes in one database.

P2P Networking

VariableDefaultDescription
WATTSWARM_P2P_ENABLEDtrueEnable or disable the Iroh-backed P2P network bridge. Set to false for local-only mode.
WATTSWARM_P2P_PORT4001Iroh direct listen port for QUIC connections from remote peers.
WATTSWARM_P2P_LISTEN_ADDRSOverride the Iroh network address list. Useful when the node is behind NAT or needs to advertise a specific interface.
WATTSWARM_P2P_REGION_IDSComma-separated list of region scope IDs to subscribe to (e.g. sol-1,sol-2).
WATTSWARM_P2P_NODE_IDSComma-separated list of node scope IDs to subscribe to (e.g. lab-a).
WATTSWARM_P2P_MDNStrueEnable legacy mDNS local-discovery compatibility. Retained for generated-node compatibility paths.
WATTSWARM_P2P_LOCAL_IDSLegacy alias for WATTSWARM_P2P_NODE_IDS. Still accepted; prefer WATTSWARM_P2P_NODE_IDS for new deployments.

Network Bootstrap

VariableDefaultDescription
WATTSWARM_NODE_MODElocalNode operating mode. One of local, lan, or network. Controls topology bootstrap behavior at startup.
WATTSWARM_NETWORK_BOOTSTRAP_HTTP_URLSExplicit HTTP endpoint URLs for fetching the signed NetworkBootstrapBundle when automatic peer derivation is not available.
WATTSWARM_PUBLIC_DISCOVERY_URLSPublishes one or more Discovery v1 API base URLs in /.well-known/wattswarm/join.json as discovery_urls, allowing joining nodes to locate this node.

Worker Queue

VariableDefaultDescription
WATTSWARM_WORKER_CONCURRENCY16Number of run steps claimed and executed in parallel by a single worker process.
WATTSWARM_WORKER_POLL_MS250Milliseconds between worker poll cycles when no claimable steps are found.
WATTSWARM_WORKER_LEASE_MS30000Duration in milliseconds for which a worker holds a step lease. The worker must renew before this window expires or the step becomes reclaimable.

UDP Announce (LAN Discovery)

VariableDefaultDescription
WATTSWARM_UDP_ANNOUNCE_ENABLEDfalseEnable UDP multicast or broadcast peer announcement for LAN discovery. Also starts a listener that records discovered peer IDs into discovered_peers_local.
WATTSWARM_UDP_ANNOUNCE_MODEmulticastAnnounce strategy: multicast (default) or broadcast.
WATTSWARM_UDP_ANNOUNCE_ADDR239.255.42.99Multicast group address. Set to 255.255.255.255 when using broadcast mode.
WATTSWARM_UDP_ANNOUNCE_PORT37931UDP port used for both sending announcements and listening for peer sightings.

Docker Compose Port Overrides

These variables let you remap host-side ports when the defaults conflict with other services on your machine. They affect only the Docker Compose port bindings; the in-container ports remain unchanged.
VariableDefaultDescription
WATTSWARM_PG_HOST_PORT55432Host port mapped to the PostgreSQL container’s port 5432.
WATTSWARM_UI_PORT7788Host port mapped to the kernel UI and HTTP API.
WATTSWARM_P2P_HOST_PORT4001Host port mapped to the Iroh P2P listen port inside the kernel container.
WATTSWARM_UDP_ANNOUNCE_HOST_PORT37931Host port mapped to the UDP announce port inside the kernel container. Only relevant when WATTSWARM_UDP_ANNOUNCE_ENABLED=true.
WATTSWARM_RUNTIME_PORT8787Host port mapped to the reference runtime HTTP server.
CLOCK_SKEW_TOLERANCE_MS defines the tolerance window used when validating step lease expiry across distributed nodes. If your nodes have clock drift larger than this value, a worker may incorrectly see an active lease as expired. Keep node system clocks synchronized (e.g. via NTP) and adjust this value only if you have a documented reason for wider tolerance.
MAX_EVENT_PAYLOAD_BYTES and MAX_STRUCTURED_SUMMARY_BYTES are hard caps enforced by kernel validation on event payloads and structured summary payloads respectively. Events or summaries that exceed these limits are rejected before they reach the event log. Keep shared_inputs and candidate output bodies concise, and prefer content references over inline blobs to stay within these limits.