Add hot-reload docker-compose.dev.yml
Dev stack with live reload: Postgres + backend (hypercorn --reload, src mounted) + Vite dev server (mounted, proxies /api to the api service). vite proxy target is now env-configurable (VITE_API_TARGET, defaults localhost:5000 for host dev). README documents both compose files (dev hot-reload vs prod image). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
This commit is contained in:
@@ -39,7 +39,14 @@ npm install
|
||||
npm run dev # http://localhost:5173
|
||||
```
|
||||
|
||||
Or run the whole stack in Docker:
|
||||
Or run it in Docker. **Hot-reload dev stack** (edit code, changes reload live) —
|
||||
Postgres + backend + Vite dev server, app at http://localhost:5173:
|
||||
|
||||
```sh
|
||||
docker compose -f docker-compose.dev.yml up
|
||||
```
|
||||
|
||||
Or the **full production image** (SPA baked in) at http://localhost:5000:
|
||||
|
||||
```sh
|
||||
docker compose up --build
|
||||
@@ -47,10 +54,12 @@ docker compose up --build
|
||||
|
||||
## Milestones
|
||||
|
||||
- **M0 — Foundation & Identity** *(in progress)*: Quart+Vue+Postgres skeleton,
|
||||
native auth, sharing-ACL spine, Fabled-Git CI.
|
||||
- M1 — Capture Core: note model + masonry board (quick-add, colors, pin,
|
||||
edit-in-place, archive, trash).
|
||||
- **M0 — Foundation & Identity** ✅: Quart+Vue+Postgres skeleton, native auth,
|
||||
sharing-ACL spine, Fabled-Git CI.
|
||||
- **M1 — Capture Core** ✅: note model + masonry board (quick-add, colors, pin,
|
||||
edit-in-place, archive, trash+restore).
|
||||
- **M1.5 — Roles & DB-backed Settings** ✅: first user is admin, admin Settings UI,
|
||||
`DATABASE_URL` is the only required env.
|
||||
- M2 — Organize: labels/tags, search, checklists, attachments.
|
||||
- M3 — Second-brain seeds: `[[wiki-links]]`, backlinks, graph view, reminders.
|
||||
- M4 — Launch hardening: responsive/PWA, settings UI, polish.
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# Hot-reload DEV stack: Postgres + backend (hypercorn --reload) + Vite dev server.
|
||||
# Edit code on the host and changes reload live. Per family rule 12 the agent does
|
||||
# NOT start this — run it yourself:
|
||||
#
|
||||
# docker compose -f docker-compose.dev.yml up
|
||||
#
|
||||
# Then open http://localhost:5173 (the Vite dev server proxies /api to the backend).
|
||||
# (docker-compose.yml, by contrast, builds + runs the production image on :5000.)
|
||||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_USER: thoughtsync
|
||||
POSTGRES_PASSWORD: thoughtsync
|
||||
POSTGRES_DB: thoughtsync
|
||||
volumes:
|
||||
- thoughtsync-dev-db:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U thoughtsync"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
||||
api:
|
||||
image: python:3.12-slim
|
||||
working_dir: /app
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
THOUGHTSYNC_DATABASE_URL: postgresql+asyncpg://thoughtsync:thoughtsync@db:5432/thoughtsync
|
||||
THOUGHTSYNC_DATA_DIR: /data
|
||||
PYTHONPATH: /app/src
|
||||
volumes:
|
||||
- ./pyproject.toml:/app/pyproject.toml
|
||||
- ./alembic.ini:/app/alembic.ini
|
||||
- ./alembic:/app/alembic
|
||||
- ./src:/app/src
|
||||
- thoughtsync-dev-data:/data
|
||||
ports:
|
||||
- "5000:5000"
|
||||
# Install deps, run migrations, then serve with live reload on the mounted src.
|
||||
command: >
|
||||
sh -c "pip install --quiet -e . &&
|
||||
alembic upgrade head &&
|
||||
hypercorn 'thoughtsync.app:create_app()' --bind 0.0.0.0:5000 --reload"
|
||||
|
||||
web:
|
||||
image: node:22-alpine
|
||||
working_dir: /app
|
||||
depends_on:
|
||||
- api
|
||||
environment:
|
||||
# Vite proxies /api to the backend service (see frontend/vite.config.ts).
|
||||
VITE_API_TARGET: http://api:5000
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- /app/node_modules
|
||||
ports:
|
||||
- "5173:5173"
|
||||
command: sh -c "npm install && npm run dev -- --host 0.0.0.0"
|
||||
|
||||
volumes:
|
||||
thoughtsync-dev-db:
|
||||
thoughtsync-dev-data:
|
||||
@@ -10,8 +10,9 @@ export default defineConfig({
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
// Dev: proxy API + health to the Quart backend on :5000.
|
||||
"/api": "http://localhost:5000",
|
||||
// Proxy /api to the Quart backend. Defaults to localhost:5000 for host dev;
|
||||
// docker-compose.dev.yml sets VITE_API_TARGET=http://api:5000.
|
||||
"/api": process.env.VITE_API_TARGET || "http://localhost:5000",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user