Harden server logging and production boot experience
CI / test (push) Has been cancelled

Replace ad-hoc console output with a structured logger (pretty/JSON,
levels, redaction, optional file rotation), a clean startup banner with
Docker/feature probes, graceful shutdown signals, and slow-RPC warnings.
This commit is contained in:
2026-07-10 23:59:13 -04:00
parent d87e6fe486
commit fa99bd8c6e
7 changed files with 482 additions and 143 deletions
+21
View File
@@ -67,6 +67,27 @@ Vault file: `peardock-vault.json` (mode 600). Override path with `PEARDOCK_VAULT
| `PEARDOCK_UNRESTRICTED_CLI=1` | Broader `docker` CLI for **admin** |
| `PEARDOCK_BROWSE_OPEN=1` | Legacy open host FS browse (discouraged) |
## Logging
| Env | Effect |
|-----|--------|
| `LOG_LEVEL` | `error` · `warn` · `info` (default in production) · `debug` (default in dev) |
| `LOG_FORMAT` | `pretty` (TTY default) · `json` (default when non-TTY / good for journald) |
| `ENABLE_FILE_LOGGING=1` | Append JSON lines under `LOG_DIR` (default `./logs`) with size rotation |
| `LOG_DIR` | Directory for file logs |
| `NO_COLOR=1` | Disable ANSI colors in pretty mode |
| `LOG_STACK=1` | Include error stacks in structured fields |
Examples:
```bash
# systemd / journald
LOG_FORMAT=json LOG_LEVEL=info npm run server
# local development
LOG_LEVEL=debug npm run server
```
## Compose stacks
`deployStack` accepts: