[Unit] Description=AWG2 Harness multi-orchestrator After=network-online.target docker.service Wants=network-online.target Requires=docker.service # Restart backoff below can span ~5 minutes, so the failure window has to be wider than # the old 60s or the limit would trip during a single legitimate backoff sequence. StartLimitIntervalSec=15min StartLimitBurst=10 [Service] # Type=exec, not simple: startup is only considered successful once the binary has been # executed, so a missing or non-executable /usr/sbin/awg2-harness fails the unit instead # of being reported as started. Type=exec User=root # ensure-swap is not run here. The daemon performs it as the first step of its own startup # sequence, where it shares one error contract, one lock and one log stream. Running it # twice per start only duplicated the work and split the failure path across two units. ExecStart=/usr/sbin/awg2-harness --config /etc/awg2-harness/config.toml daemon # systemd creates and owns these, so the common case needs no directory handling in the # binary. The runtime checks stay regardless: the CLI subcommands run outside this unit. RuntimeDirectory=awg2-harness RuntimeDirectoryMode=0755 RuntimeDirectoryPreserve=yes StateDirectory=awg2-harness StateDirectoryMode=0700 # on-failure, not always: a clean exit is deliberate and must not be restarted. Restart=on-failure # Stepped backoff 10 -> 20 -> 40 -> 80 -> 160s. A tight restart loop against a dependency # that is still coming up (Docker, the container, the network) only burns the start limit # before the dependency has a chance to recover. RestartSec=10s RestartSteps=4 RestartMaxDelaySec=160s StandardOutput=journal StandardError=journal [Install] WantedBy=multi-user.target