Week 047 — Containerization

Moving from macbaby.local to something real is harder than writing the app.

Week of October 6, 2025

Progress

The week was production setup. The approach: three containers (PHP, MySQL, phpMyAdmin) across two DigitalOcean droplets in production and one in development. Docker provides the consistent environment; the containers can be moved or replicated without reconfiguring the underlying machine.

Getting to a working state took most of the week. The app came up inside containers by Wednesday, with phpMyAdmin accessible and the database running. The remaining blocker was SSL — the Apache configuration in the container needed a certificate, but the certificate needs to match the machine's hostname, which varies across droplets. Generating a per-machine certificate and passing it into the container at startup is the approach; the implementation was still in progress at week's end.

A code bug surfaced during the containerization work that turned out to be pre-existing. The item save path was incorrectly calling getLostItemWithId() in cases where it shouldn't be — specifically, when the item isn't lost. Confirmed it reproduced on macbaby.local too, so not a container artifact.

A second bug, also pre-existing: saving a user profile for the first time without filling in the address section was silently failing at the database level. The address creation code requires a user ID, address ID, and country code. When no address was filled in, there was no country code. The fix: detect the missing address record and default the country code to the phone's country code. This is fragile — it assumes phone and address country codes are the same — but it's documented and it unblocks the user.

The Hard Part

The environment is the bug. Moving to containers exposed assumptions baked into the local setup — paths, certificates, configuration — that worked on macbaby.local because they'd been configured once and forgotten. There's no clean way to find all of them except to run the app in the new environment and see what breaks.

Next Week

Korea. Back in two weeks.