added more detailed debug logging

This commit is contained in:
2026-02-14 17:33:33 +01:00
parent 85aa518208
commit 9d7a36a143
5 changed files with 272 additions and 14 deletions
+27 -3
View File
@@ -7,7 +7,7 @@
>
> Ask Claude Code: "Please update CONTEXT.md with what we did today"
Last updated: 2026-02-15 (session 2)
Last updated: 2026-02-14 (session 3)
---
@@ -28,7 +28,29 @@ Last updated: 2026-02-15 (session 2)
- **Running on:** demo-felhom (N100 mini PC) at 192.168.0.162:8080
- **All Phase 1 features working:** deploy, start/stop/restart/update, logs, health-aware states, auth
### What was just completed (2026-02-15 session 2)
### What was just completed (2026-02-14 session 3)
- **Enhanced debug logging** across all stack operations in `internal/stacks/`:
- **Operation timing**: All stack ops (start, stop, restart, update, deploy) now log elapsed time
- Success: `[INFO] Stack immich started successfully (took 45.2s)`
- Failure: `[ERROR] Stack immich start failed after 3.1s: exit code 1`
- **`composeExecCustomEnv` improvements**:
- Logs env var **keys** at debug level (never values — secrets stay safe)
- Logs exit code, truncated stdout/stderr (max 500 chars) on failure
- Logs command completion time on success
- **Post-start container state check** (StartStack, RestartStack, UpdateStack, DeployStack):
- Async goroutine: sleeps 3s, runs `docker compose ps -a`, logs each container's state
- Critical for detecting crash-loops that `docker compose up -d` wouldn't surface
- Non-blocking — never fails the operation, just logs a warning if check fails
- **Image pull detection** (DeployStack, UpdateStack at debug level):
- Parses `docker-compose.yml` for `image:` lines
- Runs `docker image inspect` per image to check local availability
- Skips images with `${VAR}` interpolation (can't resolve at check time)
- **GetLogs improvement**: Logs byte count of returned logs (distinguishes empty vs failure)
- **ScanStacks improvement**: `[INFO] Scanned stacks: 10 found (3 deployed, 7 available)`
- **New helpers added to manager.go**: `isDebug()`, `truncateStr()`, `logPostStartStatus()`, `checkLocalImages()`
- All verbose checks gated on `cfg.Logging.Level == "debug"`; timing and container states always logged at INFO
### Previously completed (2026-02-15 session 2)
- **Phase 4: Git Sync + App Catalog Audit** — major milestone
- **Git sync module** (`internal/sync/sync.go`):
- Clones/pulls app-catalog-felhom.eu repo to local cache on startup
@@ -164,4 +186,6 @@ Last updated: 2026-02-15 (session 2)
- Paperless-ngx needs `PAPERLESS_OCR_LANGUAGES` (plural) to install language packs, `PAPERLESS_OCR_LANGUAGE` (singular) to select
- After deploying a stack, update the in-memory Deployed flag immediately — RefreshStatus() only reads docker ps
- Cloudflare Tunnel handles *.demo-felhom.eu → Traefik handles Host()-based routing to containers
- BIOS "AC Power Recovery" must be enabled on N100 for auto-restart after power outage
- BIOS "AC Power Recovery" must be enabled on N100 for auto-restart after power outage
- `docker compose up -d` returns exit 0 even when containers immediately crash-loop — need post-start status check to detect this
- When logging env vars for debugging, only log keys (not values) to avoid leaking secrets in log files