mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-20 11:21:49 +00:00
2ea3e22db6
* feat(systemd): bound spinifex to a resource-limited slice Add a spinifex.slice parent ceiling (MemoryHigh=80%, MemoryMax=90%, MemorySwapMax=0) with a spinifex-system.slice child holding the seven control/infra services, so a runaway hits the slice instead of the host. A system.slice drop-in (MemoryMin=1G, CPUWeight=300) reserves RAM and CPU for sshd/journald/the operator, keeping the box reachable when spinifex is maxed. The drop-in is generated in setup.sh install_systemd() rather than shipped as a staged file, since the packaging globs flatten the systemd/ dir; this mirrors the existing sshd-keygen drop-in pattern. The two .slice files flow through every staging path unchanged. Within the single effective cgroup, a slice MemoryMax OOM picks the highest oom_score victim — guest QEMU (+500) before any service (-500) — so a slice OOM degrades by killing one guest while the daemon, storage tier, NATS, and the host all survive. * feat(setup): provision 8G host swapfile + vm.swappiness=10 Add a setup_swap stage that creates an 8G /swapfile, enables it, persists it to fstab, and writes vm.swappiness=10 so the kernel only swaps under real pressure. Backs spinifex.slice MemorySwapMax so the slice can spill to swap for graceful degradation instead of OOMing a guest. Idempotent; skipped under ISO_BUILD (firstboot provisions swap on ISO hosts). Reverses the prior swap=0 assumption.
51 lines
1.1 KiB
Desktop File
51 lines
1.1 KiB
Desktop File
[Unit]
|
|
Description=Spinifex Web UI
|
|
PartOf=spinifex.target
|
|
After=spinifex-awsgw.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
Slice=spinifex-system.slice
|
|
User=spinifex-ui
|
|
Group=spinifex
|
|
ExecStart=/usr/local/bin/spx service spinifex-ui start
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
OOMScoreAdjust=-500
|
|
Environment=SPINIFEX_UI_TLS_CERT=/etc/spinifex/server.pem
|
|
Environment=SPINIFEX_UI_TLS_KEY=/etc/spinifex/server.key
|
|
|
|
# Filesystem access
|
|
NoNewPrivileges=yes
|
|
ProtectSystem=strict
|
|
PrivateDevices=yes
|
|
ReadOnlyPaths=/etc/spinifex/server.pem /etc/spinifex/server.key
|
|
ReadWritePaths=/var/log/spinifex
|
|
|
|
# Hardening
|
|
ProtectHome=yes
|
|
PrivateTmp=yes
|
|
RestrictSUIDSGID=yes
|
|
LockPersonality=yes
|
|
RestrictRealtime=yes
|
|
RestrictNamespaces=yes
|
|
ProtectClock=yes
|
|
ProtectKernelTunables=yes
|
|
ProtectKernelModules=yes
|
|
ProtectKernelLogs=yes
|
|
ProtectControlGroups=yes
|
|
ProtectProc=invisible
|
|
SystemCallArchitectures=native
|
|
MemoryDenyWriteExecute=yes
|
|
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
|
|
CapabilityBoundingSet=
|
|
ProtectHostname=yes
|
|
KeyringMode=private
|
|
RemoveIPC=yes
|
|
LimitCORE=0
|
|
LimitNOFILE=65536
|
|
LimitNPROC=4096
|
|
|
|
[Install]
|
|
WantedBy=spinifex.target
|