carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1# One RESTART-REQUEST pass (`carlos restart`, issue #113): cycle the units of
2# every app whose restart generation has moved since this box last acted, and
3# nothing else. Started only by carlos-restart.path, which fires when the agent
4# touches /data/restart-requested; it has no [Install] section because nothing
5# else should ever want it.
6#
7# Deliberately NOT carlos-adopt.service: that unit also runs release.Pass, the
8# capability converge and the canary-TTL nag, so pointing a per-request trigger
9# at it would let one tenant's `carlos restart` cut over ANOTHER app's pending
10# release within seconds, and would nag on every request instead of hourly —
11# the same split carlos-config-sync.service and carlos-stage.service already
12# make. Same root + hardening shape as those two, which is what `systemctl
13# try-restart` requires.
14#
15# It needs neither CARLOS_RELEASE_PUBKEY nor CARLOS_SECRETS_KEY: a restart
16# verifies no signature and renders no config. The EnvironmentFile is still
17# read for CARLOS_DEPLOYMENT_BUCKET/_DIR, which is where the request itself is.
18[Unit]
19Description=carlos instance restart (on agent request)
20After=network-online.target
21Wants=network-online.target
22# A path unit re-triggers as often as members ask; the default start rate limit
23# would latch this unit into start-limit-hit after a burst and then ignore every
24# later trigger until an operator reset it. ([Unit], not [Service] — systemd
25# moved these two keys in v230.)
26StartLimitIntervalSec=0
27
28[Service]
29Type=oneshot
30# CARLOS_DEPLOYMENT_BUCKET/_DIR lives here.
31EnvironmentFile=-/etc/carlos/host.env
32ExecStart=/opt/carlos/carlos adopt -restart-only
33
34# --- hardening ---
35# Runs as ROOT deliberately, exactly like carlos-adopt.service: this pass
36# restarts carlos-app@ tenants and operator-named units via systemctl.
37# NoNewPrivileges and the syscall filter are omitted for the systemctl child;
38# the rest applies.
39ProtectHome=yes
40PrivateTmp=yes
41PrivateDevices=yes
42ProtectClock=yes
43ProtectHostname=yes
44ProtectKernelTunables=yes
45ProtectKernelModules=yes
46ProtectKernelLogs=yes
47RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
48RestrictNamespaces=yes
49RestrictRealtime=yes
50LockPersonality=yes
51MemoryDenyWriteExecute=yes
52MemoryMax=256M
53TasksMax=64
54