chess-io.service.example 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # systemd unit for the chess-io node app — /etc/systemd/system/chess-io.service
  2. # ============================================================================
  3. #
  4. # Runs the app as a long-lived service behind Apache (see apache-chess.conf.example).
  5. # Adjust User/Group and WorkingDirectory to match where the repo is checked out
  6. # on the server, then:
  7. #
  8. # sudo cp deploy/chess-io.service.example /etc/systemd/system/chess-io.service
  9. # sudo systemctl daemon-reload
  10. # sudo systemctl enable --now chess-io
  11. # systemctl status chess-io
  12. # journalctl -u chess-io -f # logs (boot/config + game counts)
  13. #
  14. # On deploy of new code: git pull && npm ci && sudo systemctl restart chess-io
  15. [Unit]
  16. Description=chess-io (real-time chess, node + socket.io)
  17. After=network.target
  18. [Service]
  19. Type=simple
  20. User=www-data
  21. Group=www-data
  22. WorkingDirectory=/var/www/chess-io
  23. ExecStart=/usr/bin/node server.js
  24. Restart=on-failure
  25. RestartSec=2
  26. # Config. Mirrors .env.example. DAW_ORIGIN is intentionally absent — it is a
  27. # local-dev-only shim for the shared chrome and must NOT be set in production.
  28. Environment=NODE_ENV=production
  29. Environment=PORT=8181
  30. Environment=BASE_PATH=/chess
  31. Environment=TRUST_PROXY=1
  32. [Install]
  33. WantedBy=multi-user.target