[Unit] Description=proxy-scraper Discord bot Documentation=https://github.com/maximilianfeix/proxy-scraper/tree/main/bot After=network-online.target Wants=network-online.target [Service] Type=simple User=proxybot Group=proxybot # the release deploy/install.sh switched to last; the one before is /opt/proxybot/previous WorkingDirectory=/opt/proxybot/current # DISCORD_TOKEN, written by the deploy workflow (root only, mode 600) EnvironmentFile=/etc/proxybot.env Environment=PROXYBOT_STATE=/var/lib/proxybot/state.json Environment=PYTHONUNBUFFERED=1 # the bot writes its PID here once every bot logged in; deploy/install.sh waits for it before keeping a release Environment=PROXYBOT_READY_FILE=/run/proxybot/ready ExecStart=/opt/proxybot/current/venv/bin/python -m proxybot Restart=always RestartSec=10 # exit 2 = a platform refused the token: restarting would only repeat failed logins until someone fixes it RestartPreventExitStatus=2 # the bot only needs the network, its own state directory and /run/proxybot (emptied whenever it stops) StateDirectory=proxybot RuntimeDirectory=proxybot NoNewPrivileges=yes ProtectSystem=strict ProtectHome=yes PrivateTmp=yes PrivateDevices=yes ProtectKernelTunables=yes ProtectKernelModules=yes ProtectControlGroups=yes RestrictSUIDSGID=yes LockPersonality=yes RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX [Install] WantedBy=multi-user.target