54 lines
1.4 KiB
Desktop File
54 lines
1.4 KiB
Desktop File
# Gadget Drone Worker — Systemd Template Service Unit
|
|
# ============================================================================
|
|
# This is a TEMPLATE unit. Create instances per workspace:
|
|
# /etc/systemd/system/gadget-drone@my-workspace.service
|
|
#
|
|
# The %I placeholder is replaced with the instance name.
|
|
# The drone's working directory is set to /home/gadget/drones/%I
|
|
#
|
|
# Enable and start:
|
|
# sudo systemctl enable gadget-drone@my-workspace
|
|
# sudo systemctl start gadget-drone@my-workspace
|
|
#
|
|
# View logs:
|
|
# journalctl -u gadget-drone@my-workspace -f
|
|
# ============================================================================
|
|
|
|
[Unit]
|
|
Description=Gadget Drone Worker — %I
|
|
Documentation=https://github.com/dtp-technologies/gadget-code
|
|
After=network.target gadget-code-web.service
|
|
Wants=gadget-code-web.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=gadget
|
|
Group=gadget
|
|
|
|
# Environment variables for secrets
|
|
EnvironmentFile=/etc/gadget/gadget-drone.env
|
|
|
|
# Each drone instance runs in its own workspace directory
|
|
WorkingDirectory=/home/gadget/drones/%I
|
|
ExecStart=/usr/local/bin/gadget-drone
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
# Security hardening
|
|
NoNewPrivileges=true
|
|
ProtectSystem=strict
|
|
ProtectHome=read-only
|
|
ReadWritePaths=/home/gadget/drones/%I
|
|
PrivateTmp=true
|
|
|
|
# Resource limits
|
|
LimitNOFILE=65536
|
|
|
|
# Logging
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=gadget-drone@%I
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|