24 lines
2.6 KiB
Markdown
24 lines
2.6 KiB
Markdown
# Remote service controls
|
|
|
|
`tools/remote backend start|stop|restart|status|enable|disable` controls the existing `werkjournal-backend.service` on the configured `BACKEND_SSH` host. The managed paths and port are the same as deployment. It does not write a new unit, switch releases or perform a backup/restore.
|
|
|
|
`status` forwards the systemd status and exit code (including nonzero status for an inactive service). `log` forwards journalctl output without a pager, initially limited to the last 100 lines. Examples:
|
|
|
|
```sh
|
|
remote backend status
|
|
remote backend log --lines 30
|
|
remote backend log --since '1 hour ago'
|
|
remote backend log --follow
|
|
remote backend restart
|
|
```
|
|
|
|
Log arguments remain separate arguments to journalctl and are shell-quoted at the SSH boundary; no `eval` is used. There is one SSH connection per invocation. Read-only status/log commands remain available during deployment and do not acquire the deployment lock.
|
|
|
|
All mutations acquire the same nonblocking `.deploy.lock` as deployment, backup and recovery. They refuse an outstanding deployment journal and validate the established unit/environment layout. Start/restart verify the current release's file checksums and require its manifest to match `deployed.json`, so a staged candidate cannot be activated by restarting. Restart uses the checked stop procedure before starting; both start and restart require application/Flow readiness. Failed readiness is reported as failure.
|
|
|
|
Service commands leave the existing maintenance flag unchanged. In particular, restarting during operator maintenance does not publish the site. A manual stop stops the backend only; use the deployment/maintenance workflow for public maintenance pages. `enable` and `disable` change automatic service startup, without starting or stopping the process. Extra arguments are accepted only for `log`.
|
|
|
|
Validation, 2026-09-09: all 33 operations tests passed, including seven new service-control tests covering actual flock contention, pending-deployment refusal, manifest mismatch, preserved maintenance, readiness failure, read-only exit codes and shell-safe argument round trips. Bash syntax and whitespace checks passed. The new status command was executed against `mih04-werkjournal@mih04.hostsharing.net` and returned the active/enabled service. A real `log --lines 1` invocation also succeeded. Mutating service actions were exercised through a controlled service implementation, without restarting the production application for this test.
|
|
|
|
Unit setup, release-info and the SSH shortcut are now documented in `remote-utilities.md`; the remote-command implementation node is complete.
|