diff --git a/docker/compose.dev.yml b/docker/compose.dev.yml index 4e01dba..7370c6e 100644 --- a/docker/compose.dev.yml +++ b/docker/compose.dev.yml @@ -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"