STATUS: CONNECTING
LATENCY: --

From Development to Production with Podman


The Atlas architecture overview ends with a short section on deployment: one host, rootless Podman containers, images built from a release tag. That section is a snapshot. This post is the path. It follows one change to Tapper Hub, the server behind Atlas, from my laptop to the machine that serves it.

The usual name for that path is development, staging, production. I should be honest about the middle word: I do not have a staging environment. I have a development stack, a release tag, and one production host, with a set of gates in the deploy that do most of what staging would do. I will cover what exists first and the staging I have planned at the end. For the general pattern with all four stages in place, shown on a much smaller application, see One Containerfile, Four Stages.

The Shape of It

Podman is in every step, but it plays a different role in each. In development it runs a compose stack. In production it builds the image and runs it as a systemd service.

  flowchart LR
    subgraph dev["Development (laptop)"]
        direction TB
        compose["podman compose<br/>PostgreSQL · backend · Traefik"]
    end

    tag["Release<br/>annotated tag vX.Y.Z"]

    subgraph staging["Staging (planned)"]
        direction TB
        pre["pre-release<br/>against production data"]
    end

    subgraph prod["Production (one host)"]
        direction TB
        build["podman build<br/>from the tagged commit"]
        unit["Quadlet unit<br/>rootless, per-service user"]
        build --> unit
    end

    compose --> tag --> build
    tag -. "not built yet" .-> pre
    pre -.-> build

No image ever leaves a machine. The tag is the thing that moves, and each side builds from source.

Development: A Compose Stack That Looks Like Production

A working session starts with one command.

task up         # certificate, PostgreSQL, migrations, backend, seed data
task log        # follow the backend
task db:reset   # throw the database away and start clean

task up wraps podman compose. It starts three things: PostgreSQL built from the same packages the production host installs, the Go backend, and Traefik in front of both. The backend service is the interesting one.

# compose.yml (trimmed)
backend:
  build:
    context: .
    dockerfile: Containerfile.dev
  env_file: .env
  environment:
    TAPPER_HUB_DEV: "1"
  depends_on:
    postgres:
      condition: service_healthy
  volumes:
    - ./:/src
    - go-modcache:/go/pkg/mod
  command: ["air", "-c", ".air.toml"]

The development image holds only the Go toolchain and air. The source is bind-mounted, so air rebuilds the binary inside the container whenever a Go file changes. Templates and static files are read straight from disk, so those show up on refresh without a rebuild.

Three choices keep this stack close to production.

The same proxy sits in front. Traefik terminates TLS in development just as it does on the host. The certificate is a real wildcard for a development subdomain whose public DNS record points at 127.0.0.1, so a local instance answers at something like https://hub-1-me.dev.example.com with a certificate every client trusts. That matters because some of the clients I test with refuse self-signed certificates outright.

The binary has the same name. The development image puts air’s output directory first on PATH, so podman compose exec backend tapper-hub admin seed is the same command I would run against the production image.

Migrations are explicit. The server never migrates on startup. It checks that the database is ready and exits if it is not. task up runs tapper-hub migrate up before it starts the backend, and the production deploy runs the same command at a point it chooses. A schema change is therefore always a deliberate step, in both places. Database Migrations explains why I hold to that.

Data is the one place where development deliberately differs. Instead of one seed, I keep a handful of named fixtures, each a database prepared for a particular kind of manual testing.

task fixture:list     # show the available scenarios
task fixture:minimal  # a nearly empty hub
task fixture:graph    # enough linked content to exercise the graph views
task fixture:full     # everything at once

Switching scenarios takes one command, so I can reseed, click through a feature, and reseed again without rebuilding state by hand.

What Podman Changes in Development

Most compose files run under Podman without edits. The exceptions took real time to find, so here they are.

  • File events do not cross the VM boundary on macOS. Podman runs containers in a Linux VM, and edits made on the host do not arrive in the container as inotify events. A watcher that relies on them never fires. air is set to poll, and the task that rewrites Traefik’s configuration restarts Traefik instead of trusting its file watch.
  • podman-compose is not Docker Compose. It has no --wait, so the task polls pg_isready itself. Its down -v keeps named volumes, so task db:reset removes the data volume with podman volume rm.
  • Image names must be fully qualified. Podman does not search Docker Hub for a bare golang:1.26-alpine unless it is configured to. Every FROM line says docker.io/library/....
  • Rootless containers see host-owned files. Git inside the container treats the bind-mounted repository as having dubious ownership and exits, which breaks the version stamping in go build. The development build passes -buildvcs=false.

None of these is a reason to avoid Podman. Each one is a single line once you know it.

Release: A Tag, Not an Image

A release is an annotated vX.Y.Z tag on main. A manually triggered GitHub workflow computes the next version from the commit history with git-cliff, regenerates the changelog, commits it, and pushes the commit and the tag together. A second workflow validates the tag and publishes binaries.

It does not publish a container image. It used to. The main reason I stopped is storage: GitHub only gives an account so much room for packages, and every release added another image. Eventually I ran out, and I could not publish a release at all.

Running into that limit made me look at what the registry was costing otherwise: a private registry to authenticate against, a pull token stored on the host, and a multi-architecture publish pipeline, all to move an image to exactly one machine. The source is already in Git and the host already has Podman.

Production: Build on the Host, Run as a Quadlet

The production host is configured with Ansible, and a deploy is one task from that repository.

task tapper-hub:update:check        # dry run: resolve the release, show the diff
task tapper-hub:update              # deploy the latest stable tag
task tapper-hub:update REF=v0.32.0  # or a specific one

The role resolves the ref to an immutable commit on my machine. It accepts annotated version tags and full commit hashes, and nothing else. It then ships a git archive of that commit to the host, runs podman build there, and tags the result with the commit hash. The image is built once and loaded into the rootless image store of each service user, so every instance runs the same image ID.

Each service runs under its own system user with its own subordinate ID range and lingering enabled, so its containers start at boot without anyone logged in. The service itself is a Quadlet file: a short declaration that systemd turns into a real unit.

# ~/.config/containers/systemd/hub.container (trimmed)
[Unit]
Wants=postgresql.service
After=postgresql.service

[Container]
Image=<image id of the build>
Pull=never
Network=host
Volume=/var/lib/hub/data:/data:Z
Environment=BASE_URL=https://hub.example.com
Secret=hub-database-url,type=env,target=DATABASE_URL
Exec=serve --addr 127.0.0.1:<port>

[Service]
Restart=always
RestartSec=5

[Install]
WantedBy=default.target

Two lines carry the design. Pull=never says there is no remote copy to look for, so a missing image fails loudly at start. The absence of AutoUpdate says the same thing from the other side: the image names one commit, and only Ansible moves it.

Secrets are encrypted in the infrastructure repository with sops. The role decrypts them on my machine and stores them on the host as Podman secrets in the service user’s storage. No .env file is written there. Everything else on the host, including the Quadlet files and the proxy routes, is regenerated from Git.

What Stands In for Staging

A staging environment exists to catch a bad release before users do. Without one, the deploy has to be careful in its own right. The order of operations is the whole design.

  sequenceDiagram
    participant Me as Me
    participant Role as Ansible role
    participant Host as Host
    participant NAS as NAS

    Me->>Role: update:check (dry run)
    Me->>Role: update
    Role->>Host: build image, load it, check secrets
    Role->>Role: candidate must descend from the running commit
    Role->>Host: stop the instance
    Host->>NAS: pg_dump, image, unit file, checksums verified
    Role->>Host: migrate up
    Role->>Host: write the Quadlet, start, wait for the port
    Note over Role,Host: on failure, stop and hold the instance

Everything that can fail without touching the running service happens first. The service only stops once a new image is ready and a recovery point can be written.

  1. Fail before stopping anything. The build, the secret checks, and the image load all come first. If any of them fails, the old version is still serving.
  2. Refuse to go backwards. The role checks that the candidate commit descends from the one that is running. A downgrade needs an explicit override.
  3. Take a verified recovery point. For each instance whose image changed, the role stops the service, dumps its database, saves the outgoing image and unit file, verifies checksums, copies everything to the NAS, and verifies again. If the NAS is unreachable, the deploy stops before the service does.
  4. Migrate, then start. Migrations run from the new image while nothing is serving, so a migration that reshapes existing tables cannot break a running binary.
  5. Hold on failure. If a step after the gate fails, the role stops the affected instances and keeps them stopped. Quadlet units are generated, so they cannot be disabled. The hold is a systemd drop-in that makes the unit’s start conditional on a file being absent, which survives a reboot.

Going back is a restore, not an automatic rollback. task tapper-hub:restore loads the saved image and database from a recovery point. Data is never rolled back unless I ask for it.

The check after the start is thin. The role waits for the port to accept connections and does not make an HTTP request. That is a gap.

The Staging I Have Not Built

A real staging stage here would be a pre-release tag deployed to a separate instance that runs against production data, exercised before the stable tag is cut. It would catch what the gates cannot: a migration that succeeds but is slow on real data, or a page that only breaks with real content.

The larger gain is somewhere else. Staging would let me work through a whole workflow against real data before a release, the way I will actually use it afterwards. Fixtures only hold the scenarios I thought to write down. Real data holds the ones I did not, and that is where a design flaw shows itself. Finding it in a pre-release is much cheaper than finding it after the stable tag is cut.

Some of the pieces exist. The deploy already accepts pre-release tags, and the nightly dumps are a source of realistic data. What is missing is the instance, the step that refreshes its data, and the habit of using it.

I have not built it because I have not needed it enough to spend the time. I am the only operator, the service runs on one host, and a bad release costs a restore from a recovery point taken minutes earlier. Staging is planned, and it is a nice-to-have.

One naming wrinkle is worth mentioning for anyone who reads the infrastructure repository after this post. It has inventories called staging and production, and both point at the same host. They are tiers, not stages: one holds the applications and the other holds ingress and observability.

A Smaller Example: This Site

This site takes the same path with less ceremony. task dev starts a compose stack with Hugo, a Pagefind search index, a small Go API under air, and Traefik routing between them.

Traefik routes by hostname here too, but without a certificate. While I wrote this post, I was reading it at http://portfolio.podman.localhost/blog/podman-dev-to-production/, with the API, the search index, and the Traefik dashboard on sibling names under podman.localhost. Browsers resolve any name under .localhost to the loopback address, so those links need no DNS entry and no hosts file. Tapper Hub needs real HTTPS in development because its clients insist on it. A static site does not, so it gets the simpler setup.

In production there are two images, built rootless on the host from a commit of this repository: a Caddy image that holds the built site and its search index, and a static Go binary for the API. Two Quadlet files run them.

There are no release tags, no migrations, and no backups, because there is no state to lose. A deploy is task jlrickert-site:update REF=main, and the role removes superseded images when it finishes. The pattern scales down as well as it scales up.

Lessons So Far

  1. Make development the same shape as production. The same proxy, the same binary name, and the same explicit migration command mean the deploy has already been rehearsed many times before it runs.
  2. With one host, build where you run. A tag in Git is a smaller thing to move than an image, and it removes a registry, a credential, and a pipeline.
  3. Order the deploy so that failure stops nothing. Whatever can go wrong before the service stops should go wrong before the service stops.
  4. Never migrate without a recovery point you have verified. A backup that has not been checked is a hope, and a deploy is the worst moment to find that out.

A staging environment would add confidence, and I expect to build one when a release finally surprises me. Until then, a careful deploy on one host has been enough.


Copyright 2026 Jared Rickert. All rights reserved. ·