# P2HS background worker (arq) — copy to the server and install as: # # sudo cp p2hs-worker.service.example /etc/systemd/system/p2hs-worker.service # sudo nano /etc/systemd/system/p2hs-worker.service # set User, paths # sudo systemctl daemon-reload # sudo systemctl enable --now p2hs-worker # sudo systemctl status p2hs-worker # # Logs: journalctl -u p2hs-worker -f [Unit] Description=P2HS arq worker (project setup, codegen, previews, billing emails) After=network-online.target Wants=network-online.target # Optional: order after Redis/Postgres if they are systemd services on this host # After=redis-server.service postgresql.service [Service] Type=simple User=p2hs Group=p2hs WorkingDirectory=/opt/p2hs/P2HS-BE EnvironmentFile=-/opt/p2hs/P2HS-BE/.env # Use the venv’s arq so PYTHONPATH and deps match the API ExecStart=/opt/p2hs/P2HS-BE/.venv/bin/arq src.workers.main.WorkerSettings Restart=on-failure RestartSec=5 # codegen job_timeout is 600s in WorkerSettings; allow headroom TimeoutStopSec=120 # Hardening (optional; relax if something breaks) NoNewPrivileges=true PrivateTmp=true [Install] WantedBy=multi-user.target