From ef9d9824bb9531a693c66b8c7058f4905929973d Mon Sep 17 00:00:00 2001 From: stroblme Date: Wed, 14 Oct 2026 23:34:07 +0200 Subject: [PATCH] Dev backend reloads on worker edits too: fastapi dev with --reload-dir over backend and worker, worker in develop.watch --- development.md | 7 ++++--- docker/compose.dev.yml | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/development.md b/development.md index 01348e7..3bd3abc 100644 --- a/development.md +++ b/development.md @@ -66,9 +66,10 @@ Standalone (`cd app && make dev`) publishes the full set: ## Hot reload, and what it misses -`compose.dev.yml` bind-mounts `backend/fluksio` into the api container and runs uvicorn with -`--reload`, so a backend edit is live. The `develop.watch` block next to it syncs the same -directory, but only under `docker compose watch`, which no target runs — the detached +`compose.dev.yml` bind-mounts `backend/fluksio` and `worker/fluksio_worker` into the api +container and runs uvicorn with `--reload` over both, so a backend edit is live and a worker +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 before the mount existed keeps serving the source baked into its image and has to be recreated once. diff --git a/docker/compose.dev.yml b/docker/compose.dev.yml index e9fa1e7..0388de1 100644 --- a/docker/compose.dev.yml +++ b/docker/compose.dev.yml @@ -92,10 +92,18 @@ services: build: context: .. 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: - fastapi - - run - - --reload + - dev + - --host + - 0.0.0.0 + - --reload-dir + - /app/backend + - --reload-dir + - /app/worker - "fluksio/main.py" develop: watch: @@ -107,6 +115,9 @@ services: - .venv - path: ../backend/pyproject.toml action: rebuild + - path: ../worker/fluksio_worker + action: sync + target: /app/worker/fluksio_worker volumes: # 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