feat(Scripts): Add health and console commands to service manager and corresponding tests (#22814)

This commit is contained in:
Yehonal
2025-09-06 15:10:42 +02:00
committed by GitHub
parent d3a6c09b31
commit 119af32649
4 changed files with 477 additions and 3 deletions

View File

@@ -305,6 +305,31 @@ Services support two restart policies:
./service-manager.sh delete auth
```
#### Health and Console Commands
Use these commands to programmatically check service health and interact with the console (used by CI workflows):
```bash
# Check if service is currently running (exit 0 if running)
./service-manager.sh is-running world
# Print current uptime in seconds (fails if not running)
./service-manager.sh uptime-seconds world
# Wait until uptime >= 10s (optional timeout 240s)
./service-manager.sh wait-uptime world 10 240
# Send a console command (uses pm2 send or tmux/screen)
./service-manager.sh send world "server info"
# Show provider, configs and run-engine settings
./service-manager.sh show-config world
```
Notes:
- For `send`, PM2 provider uses `pm2 send` with the process ID; systemd provider requires a session manager (tmux/screen). If no attachable session is configured, the command fails.
- `wait-uptime` fails with a non-zero exit code if the service does not reach the requested uptime within the timeout window.
#### Service Configuration
```bash
# Update service settings
@@ -624,4 +649,3 @@ sudo npm install -g pm2
```