Skip to main content
Version: Next 🚧

Configuration

Orisun reads environment variables with the ORISUN_ prefix.

Configuration is shared across release binaries, Docker images, and embedded deployments that call config.InitializeConfig(). If you run the binary directly, set these variables in your shell, process supervisor, service manager, or platform secret store. The compiled defaults come from config/config.yaml.

Bootstrap settings​

VariableDefaultDescription
ORISUN_ADMIN_BOUNDARYorisun_adminBoundary used for admin state.
ORISUN_ADMIN_PASSWORDchangeitBootstrap admin password. The default is for local development only; it does not reset an existing user password.

For PostgreSQL, also set:

VariableDefaultDescription
ORISUN_PG_HOSTlocalhostPostgreSQL host.
ORISUN_PG_PORT5434PostgreSQL port.
ORISUN_PG_USERpostgresPostgreSQL user.
ORISUN_PG_PASSWORDpostgresPostgreSQL password.
ORISUN_PG_NAMEorisunPostgreSQL database.
ORISUN_PG_ADMIN_SCHEMAadminPostgreSQL schema containing the admin boundary. Application-boundary placements come from the catalog.
ORISUN_PG_SSLMODEdisablePostgreSQL SSL mode passed to the driver.

For SQLite, set:

VariableDefaultDescription
ORISUN_SQLITE_IN_MEMORYfalseKeep all SQLite databases in RAM for the store lifetime; ignore the database directory.
ORISUN_SQLITE_DIR./data/orisun/sqliteDirectory for per-boundary SQLite database files.
ORISUN_SQLITE_SYNCHRONOUSFULLRecommended SQLite durability mode. Use NORMAL only when you explicitly accept the power-loss durability tradeoff.
ORISUN_NATS_CLUSTER_ENABLEDfalseMust stay false for SQLite.

Boundary management​

Boundaries are defined through the Admin CreateBoundary RPC and stored as lifecycle events in the admin boundary. They do not require a startup boundary list.

For PostgreSQL, ORISUN_PG_ADMIN_SCHEMA identifies the schema that contains the admin boundary:

ORISUN_PG_ADMIN_SCHEMA=admin

Application-boundary names and placements are replayed from the admin catalog. Create them with CreateBoundary; there is no startup application-boundary list. SQLite bootstraps only the admin boundary on a fresh installation. Boundary names must be valid PostgreSQL identifiers even when using SQLite: 1-63 characters, starting with a letter or underscore, then letters, digits, or underscores. This keeps boundary names portable across backends.

Existing storage​

Fresh boundaries initialize the current schema directly. Existing storage must use the current or 0.13.0 storage format. Startup upgrades the 0.13.0 version and rejects older and unversioned event stores. No historical boundary discovery runs. To attach restored storage in the current format, call CreateBoundary with its placement.

Server settings​

VariableDefaultDescription
ORISUN_BACKENDpostgresAll-backends binary selector: postgres or sqlite. Backend-specific binaries fix their backend.
ORISUN_GRPC_PORT5005gRPC API port.
ORISUN_GRPC_ENABLE_REFLECTIONtrueEnable gRPC reflection for tools such as grpcurl.
ORISUN_GRPC_CONNECTION_TIMEOUT60sServer connection timeout.
ORISUN_GRPC_KEEP_ALIVE_TIME30sServer keepalive ping interval.
ORISUN_GRPC_KEEP_ALIVE_TIMEOUT5sKeepalive ping timeout.
ORISUN_GRPC_MAX_CONCURRENT_STREAMS10000Maximum concurrent HTTP/2 streams per connection.
ORISUN_GRPC_MAX_RECEIVE_MESSAGE_SIZE67108864Maximum inbound gRPC message size, 64 MB by default.
ORISUN_GRPC_MAX_SEND_MESSAGE_SIZE67108864Maximum outbound gRPC message size, 64 MB by default.
ORISUN_GRPC_INITIAL_WINDOW_SIZE1048576Fixed HTTP/2 stream flow-control window, 1 MB by default. Automatic window sizing is disabled.
ORISUN_GRPC_INITIAL_CONN_WINDOW_SIZE1048576Fixed HTTP/2 connection flow-control window, 1 MB by default. Automatic window sizing is disabled.
ORISUN_GRPC_WRITE_BUFFER_SIZE65536gRPC write buffer size.
ORISUN_GRPC_READ_BUFFER_SIZE65536gRPC read buffer size.
ORISUN_GRPC_KEEPALIVE_MIN_TIME5sMinimum client keepalive interval accepted by the server.
ORISUN_GRPC_KEEPALIVE_PERMIT_WITHOUT_STREAMtrueAllow client keepalive pings without active streams.
ORISUN_ADMIN_PORT8991Admin HTTP port.
ORISUN_ADMIN_USERNAMEadminBootstrap admin username.
ORISUN_ADMIN_PASSWORDchangeitBootstrap admin password.
ORISUN_AUTH_SESSION_TTL24hInactivity timeout for x-auth-token sessions. Successful token use renews the deadline. Must be greater than zero.
ORISUN_LOGGING_LEVELINFODEBUG, INFO, WARN, or ERROR.
ORISUN_SUBSCRIPTION_IDLE_THRESHOLD10sPositive silence threshold since a subscription last received a hint; its watchdog publishes a NATS hint at expiry. No periodic backend reads.

SQLite settings​

Set ORISUN_BACKEND=sqlite and ORISUN_SQLITE_IN_MEMORY=true to keep all SQLite boundary databases in RAM, including the admin catalog, users, event data, and projector state. Embedded Go applications can set cfg.Sqlite.InMemory = true before calling embedded/sqlite.Start.

This mode is ephemeral: closing the store or restarting the process discards all SQLite state. Create application boundaries again after starting a fresh store. Each embedded store has independent databases, even when names and directories match. SQLite remains single-node only; NATS clustering is rejected.

Memory mode ignores ORISUN_SQLITE_DIR and creates no SQLite files. Each event or metadata database uses one connection shared by reads and writes, so reads and writes serialize within that database. ORISUN_SQLITE_READ_POOL_SIZE, ORISUN_SQLITE_MMAP_SIZE, and ORISUN_SQLITE_WAL_AUTO_CHECKPOINT do not apply; journals and temporary storage stay in memory regardless of TEMP_STORE. SYNCHRONOUS cannot provide restart or power-loss durability in this mode. The setting controls SQLite storage; embedded NATS still has its separately configured ORISUN_NATS_STORE_DIR.

VariableDefaultDescription
ORISUN_SQLITE_IN_MEMORYfalseKeep all SQLite databases in RAM for the store lifetime; ignore the database directory.
ORISUN_SQLITE_DIR./data/orisun/sqliteDirectory containing one {boundary}.db event-log file and one {boundary}_metadata.db file per boundary. Metadata files hold projector checkpoints, admin users, count caches.
ORISUN_SQLITE_SYNCHRONOUSFULLRecommended SQLite synchronous mode. FULL makes acknowledged WAL commits durable across OS crashes and power loss. NORMAL can improve write throughput, but acknowledged commits may be lost until a checkpoint reaches durable storage; use it only as an explicit, measured opt-out.
ORISUN_SQLITE_BUSY_TIMEOUT_MS5000Busy timeout for contended SQLite operations.
ORISUN_SQLITE_READ_POOL_SIZE0Read pool size. 0 lets Orisun choose a CPU-based default.
ORISUN_SQLITE_CACHE_SIZE0SQLite PRAGMA cache_size override: positive values are pages; negative values are KiB. 0 leaves the SQLite default unchanged.
ORISUN_SQLITE_MMAP_SIZE0SQLite PRAGMA mmap_size override in bytes. 0 leaves the SQLite default unchanged.
ORISUN_SQLITE_WAL_AUTO_CHECKPOINT0WAL auto-checkpoint threshold in pages. 0 leaves the SQLite default unchanged.
ORISUN_SQLITE_TEMP_STOREMEMORYSQLite temp-store mode.
ORISUN_SQLITE_PUBLISHER_WAKE_DELAY5msCoalesce notification relay wake-ups after SQLite commits. Set 0s for immediate wake-ups; idle watchdog hints recover missed signals while NATS is healthy.
ORISUN_SQLITE_GC_MAX_BATCH_REQUESTS128Maximum save requests flushed by one SQLite group-commit batch. All SDK save methods use the same V2 RPC.
ORISUN_SQLITE_GC_MAX_BATCH_EVENTS1024Maximum events flushed by one SQLite group-commit batch. A request that would exceed the cap is carried to the next flush.
ORISUN_SQLITE_GC_MAX_DELAY0sOptional wait to fill a SQLite group-commit batch. 0s keeps batching opportunistic.
ORISUN_SQLITE_GC_MAX_PENDING4096Per-boundary queued save-request capacity before callers block.
ORISUN_SQLITE_GC_FLUSH_TIMEOUT30sTimeout for one SQLite group-commit flush.

PostgreSQL settings​

Orisun uses per-boundary group commit plus separate PostgreSQL pools for writes, reads, and admin work. Size the pools' combined open connections below the database connection limit or the PgBouncer pool size.

VariableDefaultDescription
ORISUN_PG_LISTEN_ENABLEDtrueUse PostgreSQL LISTEN/NOTIFY wake-ups. When disabled, subscriptions rely on their idle watchdogs. Subscription idle watchdogs also publish hints after notification silence; healthy NATS is required.
ORISUN_PG_WRITE_MAX_OPEN_CONNS25Write pool open-connection cap.
ORISUN_PG_WRITE_MAX_IDLE_CONNS10Write pool idle-connection cap.
ORISUN_PG_WRITE_CONN_MAX_IDLE_TIME5mWrite pool idle lifetime.
ORISUN_PG_WRITE_CONN_MAX_LIFETIME30mWrite pool max connection lifetime.
ORISUN_PG_GC_MAX_BATCH_REQUESTS512Maximum save requests committed in one PostgreSQL group-commit transaction. All SDK save methods use the same V2 RPC.
ORISUN_PG_GC_MAX_BATCH_EVENTS1024Maximum events committed in one PostgreSQL group-commit transaction. A request that would exceed the cap is carried to the next flush.
ORISUN_PG_GC_MAX_DELAY0sOptional wait to fill a PostgreSQL group-commit batch. 0s keeps batching opportunistic.
ORISUN_PG_GC_MAX_PENDING4096Per-boundary queued save-request capacity before callers block.
ORISUN_PG_GC_FLUSH_TIMEOUT30sTimeout for one PostgreSQL group-commit flush.
ORISUN_PG_READ_MAX_OPEN_CONNS50Read pool open-connection cap.
ORISUN_PG_READ_MAX_IDLE_CONNS25Read pool idle-connection cap.
ORISUN_PG_READ_CONN_MAX_IDLE_TIME5mRead pool idle lifetime.
ORISUN_PG_READ_CONN_MAX_LIFETIME30mRead pool max connection lifetime.
ORISUN_PG_ADMIN_MAX_OPEN_CONNS5Admin pool open-connection cap.
ORISUN_PG_ADMIN_MAX_IDLE_CONNS2Admin pool idle-connection cap.
ORISUN_PG_ADMIN_CONN_MAX_IDLE_TIME5mAdmin pool idle lifetime.
ORISUN_PG_ADMIN_CONN_MAX_LIFETIME30mAdmin pool max connection lifetime.

NATS settings​

VariableDefaultDescription
ORISUN_NATS_URLemptyExternal JetStream-enabled NATS URL. When set, Orisun connects to it instead of starting embedded NATS.
ORISUN_NATS_SERVER_NAMEorisun-nats-2Embedded NATS server name. Use a unique value per clustered node.
ORISUN_NATS_PORT4224Embedded NATS client port.
ORISUN_NATS_MAX_PAYLOAD1048576NATS max payload.
ORISUN_NATS_STORE_DIR./data/orisun/natsNATS data directory.
ORISUN_NATS_PUBLISH_ASYNC_MAX_PENDING8192In-flight JetStream async publish acknowledgements for admin messaging; does not buffer subscription hints.

Core NATS carries empty transient hints without stream retention or replicas. NATS listeners use the client’s default bounded pending queue; each drain keeps one coalesced pending wake-up. JetStream remains required for leases and admin messaging. Idle watchdog hints trigger ordinary backend drains, so tune the threshold against notification and backend read load. Healthy NATS is required for ongoing subscription delivery.

TLS settings​

VariableDefault
ORISUN_GRPC_TLS_ENABLEDfalse
ORISUN_GRPC_TLS_CERT_FILE/etc/orisun/tls/server.crt
ORISUN_GRPC_TLS_KEY_FILE/etc/orisun/tls/server.key
ORISUN_GRPC_TLS_CA_FILE/etc/orisun/tls/ca.crt
ORISUN_GRPC_TLS_CLIENT_AUTH_REQUIREDfalse

Telemetry and profiling​

VariableDefaultDescription
ORISUN_OTEL_ENABLEDtrueEnable OpenTelemetry traces and metrics.
ORISUN_OTEL_ENDPOINTlocalhost:4317OTLP gRPC endpoint.
ORISUN_OTEL_SERVICE_NAMEorisunService name attached to exported telemetry.
ORISUN_PPROF_ENABLEDfalseEnable pprof.
ORISUN_PPROF_PORT6060pprof port.

Cluster settings​

VariableDefault
ORISUN_NATS_CLUSTER_ENABLEDfalse
ORISUN_NATS_CLUSTER_NAMEorisun-nats-cluster
ORISUN_NATS_CLUSTER_HOST0.0.0.0
ORISUN_NATS_CLUSTER_PORT6222
ORISUN_NATS_CLUSTER_ROUTESnats://0.0.0.0:6223,nats://0.0.0.0:6224
ORISUN_NATS_CLUSTER_USERNAMEnats
ORISUN_NATS_CLUSTER_PASSWORDpassword@1
ORISUN_NATS_CLUSTER_TIMEOUT1800s

Clustered Orisun deployments require the PostgreSQL backend. SQLite startup fails when ORISUN_NATS_CLUSTER_ENABLED=true.