Skip to content

feat: persist logs across deploys, prune dangling images#50

Merged
aliasunder merged 7 commits into
mainfrom
feat/persistent-logs-and-image-prune
May 19, 2026
Merged

feat: persist logs across deploys, prune dangling images#50
aliasunder merged 7 commits into
mainfrom
feat/persistent-logs-and-image-prune

Conversation

@aliasunder
Copy link
Copy Markdown
Owner

Summary

  • Persistent log files: Logger file sink extension writes date-stamped log files (vault-mcp-YYYY-MM-DD.log) to /data/logs on the existing persistent volume. Logs now survive container recreation during deploys. 30-day retention with automatic pruning on startup (LOG_RETENTION_DAYS configurable).
  • Docker image pruning: docker image prune -f added to both deploy paths (CI workflow + local dev script). Reclaimed ~9.3 GB of dangling images on Lightsail from accumulated deploys (25 stale vault-mcp images).
  • Luxon convention: Added Luxon DateTime over native Date to AGENTS.md code style. Migrated all Date usage in logger.ts to Luxon.

Test plan

  • 489 tests pass (9 new logger tests: file sink write, directory creation, append mode, date rollover via Settings.now, startup pruning, retention window, custom retention, non-matching file safety)
  • Lint clean, build clean
  • Lightsail instance pruned — disk dropped from 17G (29%) to 7.7G (14%)
  • After merge + deploy: verify /data/logs/vault-mcp-YYYY-MM-DD.log exists on the instance and persists across a subsequent deploy
  • Verify docker image prune -f runs in CI deploy logs

🤖 Generated with Claude Code

aliasunder and others added 7 commits May 19, 2026 02:12
Each deploy recreates the vault-mcp container, destroying the previous
container's log stream. Add a file sink extension to the logger that
writes date-stamped log files (vault-mcp-YYYY-MM-DD.log) to /data/logs
on the existing persistent volume. Files are pruned after 30 days
(configurable via LOG_RETENTION_DAYS). Also add `docker image prune -f`
to both deploy paths to prevent dangling images from accumulating
(was consuming ~10 GB on the Lightsail instance).

- Logger file sink uses the existing extensions mechanism — child loggers
  inherit it automatically
- Luxon DateTime replaces all native Date usage in logger.ts
- Add Luxon convention to AGENTS.md code style section
- 9 new tests for file sink, date rollover, and retention pruning

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename `raw` → `envValue`, `parsed` → `retentionDays`,
`match` → `logFileMatch`, `ext` → `extension` per naming convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
LOG_DIR is hardcoded in docker-compose.yml, not user-configurable via
.env. Remove the misleading "Default: unset" comment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace all `new Date()` arithmetic with Luxon — `DateTime.now().toISODate()`,
`.minus({ days: N })`, `.toISO()`. Consistent with the convention.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aliasunder aliasunder merged commit 661cf2d into main May 19, 2026
5 checks passed
@aliasunder aliasunder deleted the feat/persistent-logs-and-image-prune branch May 19, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant