# The Noderunners Download Bot: download worker. # # A worker needs outbound access to the core and to the sites it downloads # from. It needs no inbound port and no secrets other than its own token. # # install -m 0755 bin/worker /usr/local/bin/dlbot-worker # useradd --system --home-dir /var/lib/dlbot-worker --create-home dlbot # install -d -m 0750 -o dlbot -g dlbot /etc/dlbot # printf 'CORE_URL=https://bot.example.com\nWORKER_TOKEN=dlw_...\nWORKER_TEMP_DIR=/var/lib/dlbot-worker/tmp\n' \ # > /etc/dlbot/worker.env && chmod 0640 /etc/dlbot/worker.env && chown dlbot:dlbot /etc/dlbot/worker.env # systemctl enable --now dlbot-worker # # yt-dlp updates itself, so install it somewhere the service user can # write, for example /var/lib/dlbot-worker/bin/yt-dlp, and set YTDLP_PATH. # To run several workers on one machine, copy this unit and give each its # own token and its own WORKER_TEMP_DIR. [Unit] Description=The Noderunners Download Bot (worker) Documentation=https://github.com/noderunners/dlbot After=network-online.target Wants=network-online.target [Service] Type=simple User=dlbot Group=dlbot WorkingDirectory=/var/lib/dlbot-worker EnvironmentFile=/etc/dlbot/worker.env ExecStart=/usr/local/bin/dlbot-worker Restart=on-failure RestartSec=5 # On SIGTERM the worker stops its downloads and hands the jobs back. TimeoutStopSec=30 KillSignal=SIGTERM NoNewPrivileges=true ProtectSystem=strict ProtectHome=true PrivateTmp=true PrivateDevices=true ProtectKernelTunables=true ProtectKernelModules=true ProtectControlGroups=true RestrictSUIDSGID=true LockPersonality=true ReadWritePaths=/var/lib/dlbot-worker UMask=0027 [Install] WantedBy=multi-user.target