979 B
979 B
Polymech Server Operations
Hot Reloading via API
To update the server code without requiring root access or SSH:
- Deploy Code: Sync the new
dist/folder to the server (e.g., usingscripts/deploy.shorrclone). - Trigger Restart: Send a POST request to the restart endpoint with an admin token.
curl -X POST https://api.polymech.info/api/admin/system/restart \
-H "Authorization: Bearer <ADMIN_TOKEN>"
How it works
- The endpoint
/api/admin/system/restartis protected by admin authentication. - When called, it waits 1 second (to flush the response) and then calls
process.exit(0). - The systemd service is configured with
Restart=always(oron-failure), so it automatically restarts the node process. - The new process loads the updated code from the disk.
Systemd Configuration
Ensure your pm-pics.service file includes:
[Service]
Restart=always
# or
Restart=on-failure