Full-stack docker-compose: app + emulator + observability¶
A "production-shaped" compose stack:
bqemulator(the emulator, exposing Prometheus metrics).app— a tiny Python service that reads frombqemulator.prometheus— scrapes the emulator's/metricsendpoint.grafana— pre-provisioned with a Prometheus datasource and a starter dashboard.
This is the canonical local-development setup for teams adopting
bqemulator who want one docker compose up to give them the
complete dev environment.
Layout¶
docker-compose.yml
app/Dockerfile
app/server.py
prometheus/prometheus.yml
grafana/provisioning/datasources/prometheus.yml
grafana/provisioning/dashboards/dashboards.yml
grafana/provisioning/dashboards/bqemulator.json
seed.py — seeds dataset + table on host
smoke-test.sh — asserts each service is healthy and serving
Run¶
make test:
docker compose up -d --build.- Waits for
bqemulator,app,prometheus,grafanato be healthy. - Runs
seed.pyagainst the emulator. - Hits
app:8080/customersand asserts a 3-row response. - Hits
prometheus:9090/api/v1/query?query=upand asserts the emulator is up. - Hits
grafana:3000/api/healthand assertsdatabase: ok. docker compose down -v.
What to look for¶
- The emulator publishes Prometheus metrics on
/metrics(seedocs/guides/observability.md). - Grafana is pre-provisioned via the
provisioning/directory — no manual UI clicks needed. - The app container is intentionally tiny; the point is the composition, not the app code.