Dev backend reloads on worker edits too: fastapi dev with --reload-dir over backend and worker, worker in develop.watch
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
+4
-3
@@ -66,9 +66,10 @@ Standalone (`cd app && make dev`) publishes the full set:
|
|||||||
|
|
||||||
## Hot reload, and what it misses
|
## Hot reload, and what it misses
|
||||||
|
|
||||||
`compose.dev.yml` bind-mounts `backend/fluksio` into the api container and runs uvicorn with
|
`compose.dev.yml` bind-mounts `backend/fluksio` and `worker/fluksio_worker` into the api
|
||||||
`--reload`, so a backend edit is live. The `develop.watch` block next to it syncs the same
|
container and runs uvicorn with `--reload` over both, so a backend edit is live and a worker
|
||||||
directory, but only under `docker compose watch`, which no target runs — the detached
|
edit restarts the engine along with its local workers. The `develop.watch` block next to it
|
||||||
|
syncs the same directories, but only under `docker compose watch`, which no target runs — the detached
|
||||||
`up -d` flow never triggers it. The mount is what does the work, so an api container created
|
`up -d` flow never triggers it. The mount is what does the work, so an api container created
|
||||||
before the mount existed keeps serving the source baked into its image and has to be
|
before the mount existed keeps serving the source baked into its image and has to be
|
||||||
recreated once.
|
recreated once.
|
||||||
|
|||||||
+13
-2
@@ -92,10 +92,18 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ..
|
context: ..
|
||||||
dockerfile: backend/Dockerfile
|
dockerfile: backend/Dockerfile
|
||||||
|
# `fastapi dev`, because `run` takes no `--reload-dir`. Watching the worker
|
||||||
|
# too makes a worker edit restart the engine, which respawns the local
|
||||||
|
# worker pool with the new code.
|
||||||
command:
|
command:
|
||||||
- fastapi
|
- fastapi
|
||||||
- run
|
- dev
|
||||||
- --reload
|
- --host
|
||||||
|
- 0.0.0.0
|
||||||
|
- --reload-dir
|
||||||
|
- /app/backend
|
||||||
|
- --reload-dir
|
||||||
|
- /app/worker
|
||||||
- "fluksio/main.py"
|
- "fluksio/main.py"
|
||||||
develop:
|
develop:
|
||||||
watch:
|
watch:
|
||||||
@@ -107,6 +115,9 @@ services:
|
|||||||
- .venv
|
- .venv
|
||||||
- path: ../backend/pyproject.toml
|
- path: ../backend/pyproject.toml
|
||||||
action: rebuild
|
action: rebuild
|
||||||
|
- path: ../worker/fluksio_worker
|
||||||
|
action: sync
|
||||||
|
target: /app/worker/fluksio_worker
|
||||||
volumes:
|
volumes:
|
||||||
# What makes --reload above mean anything in the detached flow (`make dev`,
|
# What makes --reload above mean anything in the detached flow (`make dev`,
|
||||||
# `make dev-local`): it starts the stack with `up -d`, which never runs the
|
# `make dev-local`): it starts the stack with `up -d`, which never runs the
|
||||||
|
|||||||
Reference in New Issue
Block a user