In early June SupplyMars moved into containers, with a pipeline that tests and deploys every push to main. The containers ran the app and not much else. Over the next six weeks I added the services around it, one container at a time.
Redis
Sessions had been files on the server, and the cache was the filesystem too. From mid-June both are in Redis. Sessions use the PHP Redis extension's own session handler, and the app cache uses Symfony's Redis adapter, through SncRedisBundle. Redis is its own container in every environment, so development, CI and production all run the same way.
nginx for production
The production nginx config gained what a public site needs: HTTP/2, modern TLS only, HSTS and the usual security headers, compression, and a year's caching for the versioned files under /assets/, which change name whenever their content changes.
The crontab that ran the business
SupplyMars is simulation-first: console commands play the customers and the suppliers, so the business runs on its own (ADR 003). In late June that got a container of its own, built from a cron stage of the same Dockerfile, and then its crontab. That crontab was the business's timetable:
| Every | Job |
|---|---|
| 5 minutes | Up to two random orders are placed, by new or existing customers |
| 15 minutes | Suppliers accept up to 20 purchase orders; up to 20 supplier products' stock is updated |
| 30 minutes | Up to 20 orders are built into purchase orders |
| Hour | Up to 100 items ship, and up to 100 are delivered |
| Twice an hour | Today's product and order sales are recalculated |
| Night | Yesterday's sales are calculated in full, and the summaries rebuilt |
Twelve jobs in all, each writing to one log file that was emptied every Sunday. In development the container runs a cron test line only, so a laptop doesn't fill up with simulated orders.
RabbitMQ
In early July Messenger's async transport moved from the database to RabbitMQ, with a broker container on each environment. ADR 013, written when I later reversed this, records why it was added: throughput, and room for what the queue might carry later. What it carried then was outgoing email.
Tools around it
- A dev-tools compose file starts the database, Redis, Mailpit and phpMyAdmin for working on the app locally, without the rest of the stack.
- phpMyAdmin for production runs on my machine, not the server, and reaches the production database through an SSH tunnel. Every page it shows carries a red "PRODUCTION DATABASE" banner.
- A first k6 load test of the home page and the assets it loads: a baseline to build on, run from the Makefile.
Update, October 2026: Redis stayed, but the queue went back to the database (ADR 013), the crontab became a Symfony Scheduler schedule (ADR 015), and nginx and PHP-FPM gave way to FrankenPHP in worker mode (ADR 016); Five weeks, 119 pull requests tells why.
References