[Unit] Description=SmartBotic Runner Service Documentation=https://github.com/smartbotic/smartbotic # Ordering only, deliberately not a Requires. The runner is built to survive # the webserver being absent - it retries node sync on reconnect_interval_ms # and re-registers on its heartbeat - so a hard requirement bought nothing even # when both ran on one host. It actively breaks a split deployment: with the # webserver on another machine the unit does not exist locally, and the runner # then refuses to start at all with "Unit smartbotic-webserver.service not # found". After= on a missing unit is simply ignored, which is what we want. After=network.target smartbotic-webserver.service # Without PartOf, "systemctl restart smartbotic.target" starts nothing and # stops nothing: a target is only a grouping, and restart/stop do not reach # its members through Wants alone. That silently leaves an old binary running # after a rebuild, with systemctl still reporting the target as active. PartOf=smartbotic.target [Service] Type=simple WorkingDirectory=/data/smartbotic # Add delay to ensure webserver is fully started before runner tries to register ExecStartPre=/bin/sleep 3 ExecStart=/data/smartbotic/build/smartbotic-runner Restart=on-failure RestartSec=5 StandardOutput=journal StandardError=journal # Environment Environment=LOG_LEVEL=info Environment=RUNNER_ID=runner-1 Environment=NODES_PATH=/data/smartbotic/nodes # Resource limits LimitNOFILE=65536 [Install] WantedBy=default.target