Skip to main content

Configuration

systemg uses YAML files to define services and their relationships.

Complete example

A single file can declare many projects under the projects: map, keyed by project id. The example below shows one project’s full set of sections. Project entries may override env and logs; top-level metrics and status settings apply across the loaded projects.

Supervisor configuration

Project manifests describe workloads. Supervisor-wide defaults live separately in ~/.local/share/systemg/supervisor.xml, or /var/lib/systemg/supervisor.xml with --sys:
  • pre_start_secs: default execution budget for deployment pre_start commands.
  • startup_stability_ms: survival window for services without a health check.
  • stop_verify_secs: time allowed to confirm that a terminated process is gone.
The file is created on first supervisor start. Existing compact XML remains compatible and is rewritten in the indented form after it parses successfully. SYSG_PRE_START_TIMEOUT_SECS remains a higher-precedence compatibility override.
Health-check attempt_timeout and total_timeout remain in the project manifest because readiness is workload-specific. IPC polling and live-upgrade deadlines are protocol invariants and are not operator settings.

Registered manifests

When you run a command with -c <file>, the resident supervisor remembers that manifest’s resolved path for each project it registers. Later commands can omit -c and target the registered project from any working directory. sysg restart treats the files at those paths as the source of truth. It reads and validates every registered manifest before touching a process, then re-registers added, changed, and removed projects and services. An invalid manifest returns SG0301 and leaves the running workloads unchanged.

Configuration sections

version

Required. Specifies the configuration schema version. The current schema is 2. Older version: "1" manifests are no longer accepted. For a legacy singular-project: manifest, run sysg migrate, which converts the shape and emits version: "2". For a loose or existing projects: manifest, update the version field directly. When upgrading from 0.54.x or older, also follow the state-layout migration.

projects

The canonical way to declare projects. A map keyed by project id, where each entry carries that project’s name, services, and optional env / logs sections. One file can hold as many projects as you like:
Each key is the project.id. When a name is omitted, the id doubles as the display name. Every project gets its own state directory — see State — and you target each one by id with -p/--project at runtime.
Treat the project id (the map key) as durable runtime identity. Changing it does not rename a project — it creates a new namespace, and the old one’s running services become orphaned state. Rename freely via name; never rename by editing the id.

Loose (project-less) services

Top-level services: with no project form a loose bundle. They still run, and their state persists under projects/__loose__/:
Use this for single-service or quick setups where a project id adds no value.

Singular project: (deprecated)

The older singular block still parses, so existing single-project manifests keep working — but it emits a deprecation warning. Prefer projects:.
The shorthand project: arbitration (which sets both id and name) is also still accepted. Convert old-shape manifests with sysg migrate. See Projects for how one supervisor hosts many projects at once and how -p/--project targets them at runtime.

env

Optional environment variables shared by all services.

logs

Optional defaults for service stdout/stderr handling.
Fields:
  • sink: file captures service output to systemg-managed log files. none discards service output without creating log-writer threads or files.
  • max_bytes: active log-file size before rotation for the file sink.
  • max_files: number of rotated files to retain per active log.
Use sink: none for noisy production services when service output is already collected by another logging pipeline.

status

Optional defaults for status and inspect runtime detail.
Fields:
  • snapshot_mode: off, summary, or detailed.
  • snapshot_interval_secs: seconds between background snapshot refreshes, clamped between 1 and 300.
Modes:
  • summary: default. Tracks service state, pid, health, last exit, cron state, and sampled metric summaries while skipping expensive process tree expansion.
  • detailed: includes runtime command details and process/spawn descendants for richer inspect output.
  • off: disables background runtime snapshot refresh and uses persisted state plus pid files.
For large deployments, keep summary globally and use focused inspect --service workflows when deeper investigation is needed.

metrics

Optional tuning for the CPU/memory sampling that powers status and inspect.
Fields:
  • retention_minutes: minutes of in-memory samples to keep (default 720).
  • sample_interval_secs: seconds between samples, clamped 1-60 (default 1).
  • max_memory_bytes: memory cap across all sample buffers (default 10 MiB).
  • spillover_path: optional directory for spilling older samples to disk, with spillover_max_bytes and spillover_segment_bytes controlling disk usage.

services

Defines the services to manage. Each entry under projects: requires its own services: map. A top-level services: map is optional and defines the loose bundle.

Service configuration

command

Required. The command to execute.

depends_on

Services that must start before this one.

env

Service-specific environment configuration.

restart_policy

Control how services recover from crashes.

Service logs

Override global logging settings for one service.
Policies:
  • always - Restart on non-zero exit codes
  • on-failure - Restart on non-zero exit codes
  • never - Don’t restart
A clean (zero) exit is treated as intentional and never triggers a restart, regardless of policy. Restarts respect backoff between attempts and stop after max_restarts (unlimited when unset).

hooks

Run commands when services start or stop.

cron

Run services on a schedule instead of continuously.

deployment

Control how services update during restarts.
Rolling deployments start the new instance, wait for health checks, then stop the old instance. For single-host zero-downtime with fixed ports, use blue_green so traffic can be switched between two slots. A blue-green deployment uses two identical slots, starts the new version in the idle slot, verifies it, and then switches traffic only after the candidate is ready.

Field reference

Service fields

Primary keys available on each service definition. user, group, supplementary_groups, capabilities, limits, and isolation only take effect in privileged mode - see Privileged mode for details and examples. Health checks are configured under deployment.health_check, not as a top-level service key.

Environment object

Environment sources and inline overrides merged into the service process environment.

Hooks object

Lifecycle callbacks you can trigger on service start/stop/restart outcomes. Each hook has success and error handlers with:
  • command - Command to execute
  • timeout - Maximum execution time

Health check object

Probe configuration used to determine readiness/health during deployment workflows.
attempt_timeout bounds one probe. total_timeout controls the whole readiness window, so connection refusals that return immediately do not exhaust a slow-starting service’s budget. A check fails only after both retries and total_timeout are exhausted. The failure carries a code by cause: SG0022 (could not reach), SG0023 (a probe timed out), or SG0104 (ran but reported unhealthy).

Deployment object

Controls how restarts are performed and what validation happens before cutover.
pre_start runs from the manifest directory with the service environment. Its output is captured in the service log. A non-zero exit is SG0103; exceeding the supervisor.xml pre_start_secs budget is SG0108, and the service is not launched.

Blue/green deployment object

Single-host zero-downtime options for alternating between two rollout slots (typically ports). ::::info Manifest schema compatibility The top-level version field declares the manifest schema version. The current schema is 2, accepted as either a string or integer, so version: "2" and version: 2 are equivalent. version: "1" is no longer accepted. systemg reads the declared version before the rest of the manifest. Version 1 is rejected rather than silently reinterpreted; version 2 is the only current runtime schema. systemg never rewrites a manifest as a side effect of starting services. When downgrading, the older binary can only parse versions it knows. Keep the previous manifest or convert it before starting an older release. Schema validation is separate from manifest shape conversion. To rewrite an old singular-project: manifest into the canonical projects: map, run sysg migrate — it prints the converted YAML to stdout unless --in-place is requested. ::::