feat:add Docker support and auto ngrok url replace on restart#18
feat:add Docker support and auto ngrok url replace on restart#18kaihere14 wants to merge 4 commits into
Conversation
Greptile SummaryThis PR adds Docker/Docker Compose support for local development, makes ngrok non-critical so its failure no longer kills the whole dev session, and trims Convex skill descriptions. The process-management improvement in Confidence Score: 4/5Safe to merge for macOS users; Linux developers will hit the UID/bind-mount write failure and the fresh-clone restart loop documented in previous review threads that remain unresolved. Two P1-level issues flagged in prior review rounds (UID 1001 ownership mismatch on Linux, docker-compose.yml — UID mismatch and restart policy; scripts/dev.mjs — clean ngrok exit not surfaced to the user. Important Files Changed
Sequence DiagramsequenceDiagram
participant D as Docker / Host
participant M as dev.mjs (orchestrator)
participant S as server (tsx watch)
participant C as convex dev
participant V as vite (debug)
participant N as ngrok
D->>M: npm run dev
M->>S: spawn (critical)
M->>C: spawn (critical)
M->>V: spawn (critical)
M->>N: spawn (non-critical)
par Core services ready
S-->>M: ready (listening on :3456)
C-->>M: ready (Convex functions ready)
V-->>M: ready (Local: http...)
and Tunnel ready
N-->>M: ngrok URL via :4040 API
end
M->>M: showBanner(ngrokUrl)
alt Critical child exits non-zero
S-->>M: exit(code != 0)
M->>S: shutdown all children
M->>C: kill
M->>V: kill
M->>N: kill
else ngrok exits (any code)
N-->>M: exit(code)
M->>M: log warning, keep running
note over S,V: Local dev continues uninterrupted
end
Reviews (2): Last reviewed commit: "refactor: set Vite dev server host to tr..." | Re-trigger Greptile |
| - "3456:3456" | ||
| - "5173:5173" | ||
| volumes: | ||
| - .:/app |
There was a problem hiding this comment.
Bind-mount ownership mismatch breaks writes on Linux hosts
The .:/app bind mount exposes all source files owned by the host user (e.g. UID 1000). The container runs as boop (UID 1001), so any write attempted during dev — Vite's .vite cache, Convex's convex/_generated/ type files, *.tsbuildinfo — will fail with EACCES on Linux. macOS users won't hit this because Docker Desktop virtualises the FS, but CI and Linux developers will.
The common fix is to propagate the caller's UID/GID into the compose service:
user: "${UID:-1001}:${GID:-1001}"Or set UID and GID explicitly in a .env (beside docker-compose.yml) and document the requirement. The useradd -u 1001 in the Dockerfile would also need to match whatever UID is chosen, or the container can drop the fixed UID and rely entirely on the compose override.
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends ca-certificates curl git gnupg \ | ||
| && curl -fsSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc | tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \ | ||
| && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | tee /etc/apt/sources.list.d/ngrok.list \ |
There was a problem hiding this comment.
ngrok APT repo uses
buster dist on a bookworm base image
node:22-bookworm-slim is Debian 12. Pinning the ngrok APT source to buster (Debian 10) is what ngrok's own docs prescribe (they only publish one dist), but it can cause apt-get update to emit warnings on stricter APT configurations and may silently break if ngrok ever publishes a bookworm entry that conflicts. Adding a comment explaining why buster is intentional would prevent future confusion.
| image: boop-agent:local | ||
| command: npm run dev | ||
| init: true | ||
| restart: unless-stopped |
There was a problem hiding this comment.
restart: unless-stopped loops on first-time setup failure
scripts/dev.mjs exits with code 1 when convex/_generated/api.js doesn't exist yet (standard on a fresh clone). With restart: unless-stopped, the container will restart endlessly until the types are generated, which can't happen inside this same container without npx convex dev --once being run first. Consider using restart: "no" for the initial experience, or documenting a docker-compose run boop npx convex dev --once prerequisite step.
This pull request introduces Docker and Docker Compose support for local development, improves the developer experience with better process management, and streamlines the skill descriptions for the Convex agent skills. The most important changes are grouped below:
Dockerization and Local Development:
Dockerfileto build and run the project in a containerized environment, including non-root user setup, dependencies, and ports exposure.docker-compose.ymlfile to orchestrate the local development environment, including volume mounts, environment variables, health checks, and persistent data directories..dockerignorefile to exclude unnecessary files and directories from Docker build context, improving build performance and security.host: "0.0.0.0") for container compatibility.Process Management and Developer Experience:
scripts/dev.mjsto distinguish between critical and non-critical child processes, ensuring only essential services trigger a shutdown on failure, and added better handling and messaging forngrokprocess exits. [1] [2] [3]Convex Agent Skills Documentation:
.mdfiles to be more concise and focused, making it easier to understand when to use each skill. [1] [2] [3] [4] [5] [6]skills-lock.jsonto reflect the documentation changes.