# User systemd service for the dvorakmortonxd.dev dev server. # # Install (no root needed, runs as the current user): # # mkdir -p ~/.config/systemd/user # cp deploy/dvorakmortonxd-dev.service ~/.config/systemd/user/ # systemctl --user daemon-reload # systemctl --user enable --now dvorakmortonxd-dev.service # loginctl enable-linger "$USER" # once: start at boot without logging in # # Manage: # systemctl --user status dvorakmortonxd-dev # systemctl --user restart dvorakmortonxd-dev # systemctl --user stop dvorakmortonxd-dev # journalctl --user -u dvorakmortonxd-dev -f # # It shares .next/dev/lock with a manual `npm run dev`, so stop the service # before starting one by hand. [Unit] Description=dvorakmortonxd.dev dev server (custom Next.js dev wrapper) Documentation=file:///home/martin/dvorakmortonxd.dev/README.md After=network.target [Service] Type=simple WorkingDirectory=/home/martin/dvorakmortonxd.dev # Bind all interfaces so the Cloudflare tunnel host can reach :3000. Pin # HOSTNAME explicitly: the dev server reads process.env.HOSTNAME and would # otherwise try to bind to whatever systemd/the shell exported. Environment=HOSTNAME=0.0.0.0 Environment=PORT=3000 # A reboot can leave a stale dev lock behind; clear it before starting. ExecStartPre=/bin/rm -f /home/martin/dvorakmortonxd.dev/.next/dev/lock ExecStart=/bin/node /home/martin/dvorakmortonxd.dev/scripts/dev-server.mjs Restart=always RestartSec=3 # Give Next.js a moment to shut down cleanly. TimeoutStopSec=15 StandardOutput=journal StandardError=journal [Install] WantedBy=default.target