Skip to content

fix(db/docker): bootstrap db.json on first run & set DATA_DIR in Docker#447

Open
steel-code-agent wants to merge 3 commits intodecolua:masterfrom
SteelMorgan:fix/db-first-run-and-docker
Open

fix(db/docker): bootstrap db.json on first run & set DATA_DIR in Docker#447
steel-code-agent wants to merge 3 commits intodecolua:masterfrom
SteelMorgan:fix/db-first-run-and-docker

Conversation

@steel-code-agent
Copy link
Copy Markdown

Summary

Two fixes for first-run / Docker deployment issues:

  • fix(docker): set DATA_DIR=/app/data in Dockerfile so the app uses the prepared directory instead of defaulting to ~/.9router
  • fix(db): create empty db.json with default schema on first run, preventing proper-lockfile ENOENT crash

Related Issues

Test plan

  • Delete db.json, start the app — file is recreated with default schema, no crash
  • Docker build & run from scratch — app starts cleanly with /app/data/db.json

🤖 Generated with Claude Code

steel-code-agent and others added 3 commits March 29, 2026 18:35
…ctory (#5)

Without this env var the app defaults to ~/.9router/ which doesn't
exist inside the container, causing ENOENT on first launch.

Co-authored-by: Владимир Акимов <steelmorgan33@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… ENOENT (#6)

proper-lockfile calls lstat() on the file before acquiring the lock.
If db.json doesn't exist yet (fresh install / Docker), lstat fails
with ENOENT before lowdb gets a chance to create it on first write.

Co-authored-by: Владимир Акимов <steelmorgan33@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Error: Lock file is already being held with v0.3.64 Handle missing ~/.9router/db.json on first run

2 participants