Every Waddle project has three Compose files in its root. Together they describe one stack that runs identically in local development and on remote servers. The split exists only to capture the few places where local and remote genuinely must differ.
| File | Applies to | How it is loaded |
|---|---|---|
docker-compose.yml |
Local and remote | The base file. Always loaded. |
docker-compose.override.yml |
Local development only | Auto-merged by Docker Compose. |
docker-compose.prod.yml |
Remotes only (prod, stage, dev) | Merged explicitly on the remote. |
“prod” is just the conventional name: docker-compose.prod.yml applies to every remote
environment (production, stage, dev), not only production.
How Compose merges them
Docker Compose can read several files and deep-merge them into one effective configuration. Later
files override and extend earlier ones (lists like networks: are appended, scalar values are
replaced).
- Locally, running
docker compose upautomatically picks updocker-compose.ymlanddocker-compose.override.yml(Compose loads a file named exactlydocker-compose.override.ymlwith no extra flags).docker-compose.prod.ymlis ignored because it is never named. - On a remote, Waddle points Compose at both files by setting
COMPOSE_FILE=docker-compose.yml:docker-compose.prod.ymlin the remote’s.env, so a plaindocker compose upthere picks up the base plus the prod override. The local override file is never referenced there.
So the base file is the shared truth; each environment layers on only its own differences.
Differences are kept to a minimum: the intent is true replication, regardless of where a project is running. MailCatcher is the clearest example: it’s a handy tool in local development but a major security risk on a production site.
What each file contributes
docker-compose.yml, the shared base
Defines every long-running service the project needs (only those that are actually enabled are
rendered): php, php-cron, web (Nginx), db (MariaDB), opensearch, redis, node,
node-cron. For each it sets the image/build, the volume mounts, the entrypoint and command, the
stop signal, and the restart policy. This file alone is a complete, runnable description of the
stack; the two override files only adjust it.
By default every service shares one Docker network, to keep subnet usage low. A project can
optionally isolate its leaf services (web, db, redis, opensearch, mail) onto their own
networks instead, with the PHP/Node tier bridging them.
docker-compose.override.yml, local development extras
Everything here is specific to running on a developer’s own machine:
- Routing for the proxy. The
webcontainer publishes its Nginx ports on a random port on127.0.0.1and carriescom.waddlehub.router.*labels naming its domain and which ports serve HTTP and TLS, so Waddle’s built-in proxy can routehttps://<project>.localhostto it. - User mapping. Local Docker usually runs as root, so containers are pinned to the developer’s
own UID/GID (
user: "${WADDLE_UID}:${WADDLE_GID}") to keep file ownership sane on mounted source. - The shared directory is mounted into each service.
- MailCatcher. The local
mailservice is MailCatcher, a fake SMTP server that traps outgoing mail in a web UI so nothing actually leaves the machine.
docker-compose.prod.yml, remote-only differences
Everything here is specific to a real server:
- Host port binding. The
webcontainer publishes its ports directly to the host (ports:) and is grantedNET_BIND_SERVICEso it can bind 80/443 without running as root. There is no proxy on remotes. - SMTP relay. The remote
mailservice is a real SMTP relay (replacing MailCatcher) that forwards mail to an external provider.
The guiding principle
A developer’s local stack and the deployed stack are the same stack. The base file holds everything they share; the overrides hold only the handful of things that genuinely cannot be the same: how traffic reaches the web server (local proxy vs. host ports), and whether mail is caught for inspection or relayed for real.