Habib Ali Machpud
← Writing

Engineering opinion

Build the production path before the product

What a static page and a small health API revealed about ingress, images, identity, and recovery.

Ask Habib’s first release is a static page and a small health API. It does not contain search, a database, or a chat interface. It does exercise the real deployment path: a public HTTPS request crosses Cloudflare, an outbound tunnel, and Caddy before reaching the Go API.

That small release exposed decisions that would otherwise have arrived alongside the first feature. Which architecture should the images target? Where do private image credentials live? What proves that the public API response came from the expected origin? How does a failed update return to the previous version?

Test the artifact that production will run

Local builds and container smoke tests use Podman. The development machine and the VPS use different CPU architectures, so a successful local image run is only part of the evidence.

The release workflow also builds and runs the images on native Linux AMD64. It checks the page, its assets, the proxy route, health responses, request IDs, container users, and graceful API shutdown. Publishing reuses those tested image artifacts. Production pulls immutable image references and performs no build.

The resulting release record ties a source revision to the deployed images. This makes it possible to distinguish a code problem from deploying the wrong artifact, and gives rollback a concrete target.

Prove the route, not just the process

A running container is useful evidence, but it does not establish that a user can reach the application. Verification first checks the internal web-to-API route, then the public site and health response over verified HTTPS.

The API generates a request ID for each request and returns it in a response header. Matching a public response ID with the API’s structured log connects the external request to an observed origin response. The health response is not cached, so it can test the live route.

The owner also opened the page in a browser. That confirms a different part of the experience from an HTTP client, though it is not a substitute for later mobile, keyboard, and accessibility checks.

Make exposure an explicit property

The production containers do not publish application services to the host. Docker publishing creates a host mapping and changes network reachability, so it is reviewed separately from the host firewall. Docker’s publishing documentation describes that boundary.

The application and connector use separate private networks. The connector cannot directly join the API’s application network. Operational verification checks the Compose definition, actual container bindings, and host listeners; an external scan adds a view from another machine. None of these observations should silently stand in for the others.

Verify visitor identity without keeping raw addresses

The API’s socket peer is its proxy, not the browser. Accepting an arbitrary forwarded header would let an untrusted caller supply an identity for later rate limiting.

The implemented path checks the exact connector peer at Caddy and the exact Caddy peer at the API. It rejects malformed and duplicate identity headers and normalizes IPv4-mapped IPv6 addresses. Integration tests exercise both trust boundaries with synthetic visitor addresses.

A temporary health-response diagnostic allowed a private comparison with Cloudflare’s view of the same requester. It had an expiry, was disabled after verification, and did not write the address into application logs. Normal logs record whether a trusted identity was available. Caddy’s runtime error logs also omit request data, including when its backend is unavailable.

The public forged-header probe was rejected before it reached the API. That observation does not identify the rejecting intermediary. The local and native AMD64 integration tests provide the separate evidence for the application’s peer checks.

Keep recovery concrete

The first deployment retained its configuration and pinned images. The next rollout changed private network addressing, so it required a brief restart of the application project. The rollout pulled and validated the new images before interrupting the old deployment and kept an explicit path back to it.

This establishes an application rollback procedure, not a universal recovery guarantee. A future database will need a tested backup and restore process, and schema changes will need their own compatibility rules.

What the skeleton leaves for the next phase

The production path works, but deployments are still manually approved and operated. The next step is to put that same path behind a restricted automation identity, serialize production changes, and run public smoke checks after each update. The page can then grow into a useful portfolio before AI features are added.

The early release made infrastructure behavior observable while the application was small. That evidence now provides a baseline against which later changes can be tested.

Related decisions: start on one VPS and use Cloudflare Tunnel.