Give the dev stack a broker, a time-series database, and live backend source
The mqtt and influx node types had nothing to talk to locally; mosquitto and influxdb fill that in, on the compose network only — no host port, since 1883 usually belongs to a real broker on the machine. The same file's --reload only ever reloaded the source baked into the image: develop.watch needs `docker compose watch`, and the dev stack starts detached. A bind mount is what the standard flow actually reads. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H7LwYgJfpkbLCTeiAf8U4A
This commit is contained in:
@@ -48,10 +48,44 @@ services:
|
||||
redis:
|
||||
restart: "no"
|
||||
|
||||
# A broker and a time-series database of the stack's own, so the mqtt and
|
||||
# influx node types are testable without external hardware. Point a node at
|
||||
# broker_host `mosquitto` or url `http://influxdb:8086`.
|
||||
#
|
||||
# Neither publishes a host port on purpose: nothing outside the stack needs
|
||||
# them, and 1883 in particular tends to be taken by the real broker on a
|
||||
# machine that runs this alongside anything else.
|
||||
mosquitto:
|
||||
image: eclipse-mosquitto:2
|
||||
restart: "no"
|
||||
# The config the image ships for exactly this: listener on 1883, anonymous
|
||||
# clients allowed. Its default config accepts neither.
|
||||
command: mosquitto -c /mosquitto-no-auth.conf
|
||||
|
||||
influxdb:
|
||||
image: influxdb:2.7
|
||||
restart: "no"
|
||||
# Dev credentials, and no volume: the container comes up initialised and a
|
||||
# `down -v` is all it takes to start over.
|
||||
environment:
|
||||
DOCKER_INFLUXDB_INIT_MODE: setup
|
||||
DOCKER_INFLUXDB_INIT_USERNAME: fluksio
|
||||
DOCKER_INFLUXDB_INIT_PASSWORD: fluksio-dev-password
|
||||
DOCKER_INFLUXDB_INIT_ORG: fluksio
|
||||
DOCKER_INFLUXDB_INIT_BUCKET: fluksio
|
||||
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: fluksio-dev-token
|
||||
|
||||
backend:
|
||||
restart: "no"
|
||||
ports:
|
||||
- "8000:8000"
|
||||
# Not a startup requirement — listed so the two come up with the stack,
|
||||
# which starts its services by name (`make dev-local`).
|
||||
depends_on:
|
||||
mosquitto:
|
||||
condition: service_started
|
||||
influxdb:
|
||||
condition: service_started
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: backend/Dockerfile
|
||||
@@ -72,6 +106,11 @@ services:
|
||||
action: rebuild
|
||||
volumes:
|
||||
- ../backend/htmlcov:/app/backend/htmlcov
|
||||
# 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
|
||||
# sync above — only `docker compose watch` does. Without the mount the
|
||||
# container serves the source baked into the image until it is rebuilt.
|
||||
- ../backend/app:/app/backend/app
|
||||
environment:
|
||||
SMTP_HOST: "mailcatcher"
|
||||
SMTP_PORT: "1025"
|
||||
|
||||
Reference in New Issue
Block a user