# TEMPLATE -- copy to /etc/sysconfig/arrakis2frames and edit.
#
#     cp /etc/sysconfig/arrakis2frames{.example,}
#
# No instance will start until that copy exists: IMAGE is mandatory and is
# defined only here. This file itself is never read by the service, and a
# package update always refreshes it, so do not edit it in place.
#
# Defaults for all arrakis2frames@ instances. Per-instance files
# (arrakis2frames-<INSTANCE>) ship with the package and override
# these. Not a shell script: no command substitution, no cross-variable
# expansion. Changes take effect on the next restart; no daemon-reload needed.

# --- MUST be set for this site -----------------------------------------------
IMAGE=containers.ligo.org/ngdd/igwn-connect:0.8.0
ARRAKIS_SERVER=grpc://arrakis:31206

# --- Usually correct as shipped ----------------------------------------------
RUNAS=arrakis
DATA_ROOT=/kafka/arrakis
FRAME_DURATION=1
RETENTION_TIME=300
SKIP_ALL_GAP=--skip-all-gap
# Off for normal operation. Set to --verbose to turn on connector debug
# logging; it goes to the journal via --log-driver=journald, so leaving it on
# costs journal space on every node.
VERBOSE=
PULL_POLICY=missing

# Run the container detached, so "podman run" exits once it is up and only
# conmon remains as the service's main process. Saves 50-80 MB per instance:
# the resident podman is a Go binary that, with --log-driver=journald, is doing
# nothing but holding a stdio proxy nobody reads.
#
# Off by default so a package upgrade does not change a running fleet. Test one
# instance per OS and podman version before enabling site-wide.
#
# Verify by counting processes, not by looking at MainPID: --sdnotify=conmon
# hands MAINPID= to conmon either way, so MainPID reads "conmon" even when a
# foreground "podman run" is still resident. What changes is the cgroup:
#   u=arrakis2frames@<INSTANCE>.service
#   xargs -a /sys/fs/cgroup$(systemctl show -p ControlGroup --value $u)/cgroup.procs \
#     ps -o pid=,comm= -p          # want: conmon alone, no podman
#PODMAN_DETACH=true

# --- Resource limits ---------------------------------------------------------
# Sized from a 5-minute, 11-instance profile on kafkatest5 (2026-08-30):
# per-container cgroup memory.current 99.1-200.0 MB, largest peak 203.4 MB;
# CPU 2.4% of one core per instance; 20 threads per instance.
#
# Memory does NOT track channel count -- a least-squares fit against channels
# explains 2% of the variance (r2=0.02). The 2-channel instance is the
# smallest at 99 MB, but the largest at 200 MB carries 5 channels while a
# 10-channel instance sits at 158 MB. Sample rate and data volume drive it.
# Size from the observed maximum, not from a per-channel model.
#
# 1g is ~5x the observed peak: enough to absorb page cache (memory.max counts
# it, and frames are written continuously) while still catching a real leak.
MEMORY_LIMIT=1g

# Equal to MEMORY_LIMIT means NO swap allowance. Podman's default when this is
# unset is 2x MEMORY_LIMIT, which would permit swapping on any node that has
# swap enabled. These nodes have none; this makes the intent explicit and
# survives a node that is provisioned differently.
MEMORY_SWAP=1g

# ~12x the observed 20 threads/instance. Podman's own default is 2048.
PIDS_LIMIT=256

# Left unset: all 11 instances together used 26.4% of one core, peaking at
# 30.7%. Capping CPU would mainly throttle the burst while a restarted
# connector catches up, which is exactly when you want it to run fast.
# igwn_connect.slice CPUQuota=200% is the backstop, 6.5x the measured peak.
#CPU_LIMIT=

# --- Reaper ------------------------------------------------------------------
# Cutoff derives from RETENTION_TIME * REAPER_MARGIN, floored at
# REAPER_MIN_AGE_SEC. Defaults (4x, 600s) give 1200s at RETENTION_TIME=300.
#REAPER_MARGIN=4
#REAPER_MIN_AGE_SEC=600
