feat(harness): systemd-юниты + Lima-конфиг + E2E-харнесс (файлы)
systemd/ (target/data.mount/firstboot/machineid/power/settings/shell + dbus-policy + journald/zram/oomd): ordering data.mount->firstboot->machineid->dbus->power+settings->shell; Requires+After firstboot; OOMScoreAdjust. lima/shturman.yaml (vz, Ubuntu ARM64, /data loopback, провижининг). tests/e2e/run.sh (каркас приёмки). justfile: vm-up/down/reset/shell, run, e2e, shell-frame. Валидация — часть 2 (поднятие Lima). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Alexander <akotenev2003@gmail.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Журналируемый /data (power-safe). Loopback-образ создаёт provisioning (lima/shturman.yaml).
|
||||
# Имя юнита (data.mount) обязано соответствовать Where=/data.
|
||||
[Unit]
|
||||
Description=Штурман /data (журналируемый, power-safe)
|
||||
Before=shturman-firstboot.service
|
||||
|
||||
[Mount]
|
||||
What=/var/lib/shturman/data.img
|
||||
Where=/data
|
||||
Type=ext4
|
||||
# барьеры — дефолт ядра; errors=remount-ro — реально отображаемая non-default опция (ассертит E2E).
|
||||
Options=rw,noatime,errors=remount-ro,loop
|
||||
|
||||
[Install]
|
||||
WantedBy=shturman.target
|
||||
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<!--
|
||||
Системная шина устройства (ipc §1). v0: сервисы под root, политика разрешает own/send для ru.shturman.*.
|
||||
dev-mock (ru.shturman.dev.PowerMock1) — это ИНТЕРФЕЙС на объекте Power, отдельное bus-имя НЕ нужно
|
||||
(send_destination=ru.shturman.Power покрывает все его интерфейсы); гейт dev — только cargo-фича.
|
||||
Тонкая per-app прокси-фильтрация (портал-паттерн) — v3 (App-Host). Выделенный shturman-user — позже (hardening).
|
||||
-->
|
||||
<busconfig>
|
||||
<policy context="default">
|
||||
<allow own="ru.shturman.Power"/>
|
||||
<allow own="ru.shturman.Settings"/>
|
||||
<allow send_destination="ru.shturman.Power"/>
|
||||
<allow send_destination="ru.shturman.Settings"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
@@ -0,0 +1,7 @@
|
||||
# journald drop-in (A10): журнал в RAM (не на flash), rate-limit. Критичное → fsync в /data (каркас common).
|
||||
# Установка: /etc/systemd/journald.conf.d/shturman.conf
|
||||
[Journal]
|
||||
Storage=volatile
|
||||
RuntimeMaxUse=64M
|
||||
RateLimitIntervalSec=30s
|
||||
RateLimitBurst=1000
|
||||
@@ -0,0 +1,5 @@
|
||||
# systemd-oomd drop-in (A09): защищаем critical set (OOMScoreAdjust в юнитах); первые жертвы — фон/плагины.
|
||||
# Установка: /etc/systemd/oomd.conf.d/shturman.conf (+ systemctl enable --now systemd-oomd).
|
||||
[OOM]
|
||||
SwapUsedLimit=90%
|
||||
DefaultMemoryPressureLimit=60%
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Штурман first-boot provisioning (/data init + machine-id, A06)
|
||||
ConditionPathExists=!/data/.shturman-provisioned
|
||||
Requires=data.mount
|
||||
After=data.mount
|
||||
Before=shturman-machineid.service shturman-settings.service shturman-power.service shturman-shell.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/usr/local/bin/shturman-firstboot
|
||||
|
||||
[Install]
|
||||
WantedBy=shturman.target
|
||||
@@ -0,0 +1,16 @@
|
||||
# Every-boot привязка persistent machine-id из /data → /etc/machine-id (a-base §11):
|
||||
# генерация — one-shot в firstboot; bind волатилен и нужен на КАЖДЫЙ boot, до dbus.
|
||||
[Unit]
|
||||
Description=Штурман bind persistent machine-id (/data → /etc/machine-id)
|
||||
Requires=data.mount
|
||||
After=data.mount shturman-firstboot.service
|
||||
Before=dbus.service shturman-settings.service shturman-power.service shturman-shell.service
|
||||
ConditionPathExists=/data/state/machine-id
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
ExecStart=/bin/sh -c 'mount --bind /data/state/machine-id /etc/machine-id'
|
||||
|
||||
[Install]
|
||||
WantedBy=shturman.target
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Штурман Power (ru.shturman.Power1)
|
||||
Requires=data.mount shturman-firstboot.service
|
||||
After=data.mount shturman-firstboot.service shturman-machineid.service dbus.service
|
||||
PartOf=shturman.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/shturman-power
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
OOMScoreAdjust=-600
|
||||
|
||||
[Install]
|
||||
WantedBy=shturman.target
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Штурман Settings (ru.shturman.Settings1)
|
||||
# Requires+After firstboot: не стартуем против полу-провиженного /data (Wants недостаточно).
|
||||
Requires=data.mount shturman-firstboot.service
|
||||
After=data.mount shturman-firstboot.service shturman-machineid.service dbus.service
|
||||
PartOf=shturman.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/shturman-settings
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
# защищаем critical set от OOM (a-base §8)
|
||||
OOMScoreAdjust=-600
|
||||
|
||||
[Install]
|
||||
WantedBy=shturman.target
|
||||
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Штурман Shell (первый Slint-кадр)
|
||||
Requires=data.mount shturman-firstboot.service
|
||||
After=shturman-power.service shturman-settings.service shturman-machineid.service
|
||||
PartOf=shturman.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/shturman-shell
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
OOMScoreAdjust=-600
|
||||
# Wayland-дисплей: provisioning/E2E поднимает weston headless (финализируется в части 2).
|
||||
Environment=WAYLAND_DISPLAY=wayland-1
|
||||
Environment=XDG_RUNTIME_DIR=/run/user/0
|
||||
|
||||
[Install]
|
||||
WantedBy=shturman.target
|
||||
@@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Штурман — v0 critical set (Stage 1: ядро + первый кадр)
|
||||
Requires=data.mount
|
||||
After=data.mount
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,4 @@
|
||||
# zram (A09): сжатый swap в RAM; swap-на-flash запрещён. Установка: /etc/systemd/zram-generator.conf
|
||||
[zram0]
|
||||
zram-size = min(ram / 2, 4096)
|
||||
compression-algorithm = zstd
|
||||
Reference in New Issue
Block a user