# DEPLOYMENT LOCATION: /etc/systemd/system/copyparty.service
# Deploy with: sudo cp config/systemd/copyparty.service /etc/systemd/system/
# Enable with: sudo systemctl daemon-reload && sudo systemctl enable --now copyparty

[Unit]
Description=copyparty file server
After=network.target

[Service]
Type=simple
SyslogIdentifier=copyparty
Environment=PYTHONUNBUFFERED=x
ExecReload=/bin/kill -s USR1 $MAINPID
Restart=always
RestartSec=5

# Run as hoborg user with existing configuration
User=hoborg
Group=hoborg
WorkingDirectory=/home/hoborg
Environment=XDG_CONFIG_HOME=/home/hoborg/.config

# Use copyparty with config file
ExecStart=/usr/bin/copyparty -c /home/hoborg/.config/copyparty/copyparty.conf

# Some basic hardening
MemoryMax=25%
ProtectClock=true
ProtectControlGroups=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true

# Allow access to home directories
ProtectHome=false

[Install]
WantedBy=multi-user.target