What this prompt does
This prompt makes the AI a senior DevOps engineer that writes a complete, working docker-compose.yml for a local dev stack with built-in observability, returning the full file rather than a sketch. You set the [app_service] image or build command, the [app_port], the [database], and the [tracing_backend]. It returns a compose file running your app alongside Postgres, Redis, Mailhog, Prometheus, Grafana, and the chosen tracing backend, with an env-file reference for secrets and connection strings, healthchecks and depends_on using condition service_healthy, persistent named volumes for the database and Grafana, a Prometheus scrape config and pre-provisioned Grafana datasource, and a short first-run guide.
The structure works because it wires healthchecks and ordered startup with depends_on so the app doesn't race the database on cold start, which is the failure that makes a fresh stack flaky on the first run. [app_service] and [app_port] slot your application into the stack and expose it on the right port. [database] pins the database image and version so connection strings and behaviour match production. [tracing_backend] chooses between tracing tools so the pre-provisioned datasource and the first-run trace instructions point at the right service. The result mirrors production locally, including traces and metrics, so bugs surface on your laptop instead of in production.
When to use it
- You want local dev to mirror production, including traces.
- You want a new developer productive with one command.
- Your app keeps racing the database on cold start.
- You want metrics and tracing wired in without manual Grafana setup.
- You need Mailhog to catch outbound email locally.
- You want persistent volumes so local data survives restarts.
Example output
You get a complete docker-compose.yml defining your app plus Postgres, Redis, Mailhog, Prometheus, Grafana, and your chosen tracing backend, with healthchecks, ordered startup via depends_on with condition service_healthy, persistent named volumes for the database and Grafana, an env-file reference for secrets and connection strings, a Prometheus scrape config, and a pre-provisioned Grafana datasource. Alongside it are the supporting config files and a short first-run guide listing bring-up order, service URLs, and how to view traces, so a new developer gets a working stack in one command.
Pro tips
- Set
[app_service]to your real image or build-and-command so the app slots straight in. - Match
[app_port]to what your app listens on so the exposed port is correct. - Pin
[database]to the exact version you run in production for parity. - Choose
[tracing_backend]deliberately; it sets the datasource and trace-viewing steps. - Trust the healthchecks; they are what stop the app racing the database on cold start.
- Keep the named volumes so your local database and dashboards persist across restarts.