Four credentials, a template, and one revert

How the wireless query exporter gets its database passwords, and the day I moved them the wrong way and moved them back.

DevOps

What was actually built

The exporter needs four credentials — a user and a password for each of two Postgres replicas (one management database, one billing). None sits in the repository and none is baked into the image. The mechanism that keeps them out is templating:

databases:
  wireless_manager:
    dsn: postgresql://{{ WIRELESS_USER }}:{{ WIRELESS_PASSWORD }}@{{ WIRELESS_HOST }}:{{ WIRELESS_PORT }}/{{ WIRELESS_DB }}
    keep-connected: true

envtpl renders that at container start, from the environment. The deploy metadata then splits the names in two (static, secret):

deploy:
  secrets_from: env
  env:
    static:
      WIRELESS_PORT: 5432
      WIRELESS_DB: wireless_manager
    secret:
      - WIRELESS_USER
      - WIRELESS_PASSWORD
      - WIRELESS_BILLING_USER
      - WIRELESS_BILLING_PASSWORD

Port and database name are static and committed (5432, wireless_manager), because they are facts about the topology and leak nothing. The four secret entries carry no values at all; the names are the whole payload. That list is a declaration of what the platform must inject, and the platform reads the values from Vault.

What I did and did not operate

The Vault is the platform team's. I never deployed it, sized it or ran it. My part was putting four credentials into the squad's path (core-wireless-squad) and wiring the service to consume them. In the build block that amounts to one flag:

build:
  use_vault_ha: true

That is a flag, never a cluster. Claiming an HA deployment on the strength of a boolean would be a lie. The distinction matters more than it sounds — operating somebody else's secret store is real work that leaves almost no trace in a repository (no commits, no files, nothing to point at), and overstating it is the quickest way to make the true part unbelievable.

The order is visible in the history. Secrets went into Vault first; only then did the second cluster go back into the deploy target (one commit, two lines). Until the path existed, a pod scheduled there had nothing to read.

The revert

secrets_from: env was the first thing that worked. Then I changed it:

-  secrets_from: env
+  secrets_from: file

That same commit deleted the explicit secret: list (eight lines across two files), on the reasoning that file mode discovers what it needs. Both halves were wrong, and they were wrong together; either alone would have been survivable. With the list gone, nothing remained to tell the platform which four names to fetch.

Reverted the same afternoon:

-  secrets_from: file
+  secrets_from: env

Three commits, net change zero, and the lesson is about the shape of the change (two variables, one step). The mode and the list of names are one decision, so moving both at once leaves nothing to bisect. Flipping the mode and keeping the list would have made the failure name itself.

Local development

query_exporter.env holds working values, committed, in plain text:

WIRELESS_USER=wireless_manager
WIRELESS_PASSWORD=password
WIRELESS_HOST=127.0.0.1
WIRELESS_PORT=5432

That file is deliberate. docker-compose up has to produce a running exporter with no Vault, no token and no network. A developer who cannot start the service locally will invent a worse way to get credentials. The values are loopback and the literal word password — they are only valid against a database on the same machine, which is the point.

What it cost

Eight commits in one day (2 September 2025), three of which cancel out. What survived is small: four names declared secret in deploy metadata, two DSNs templated from the environment, static topology committed in the clear, and a dev env file that works offline.

A colleague tightened this later, mapping each variable to an explicit Vault path and key (username, password, replica_host), which took the database hostnames out of the repository too. That work is his, nearly a year after mine. Mine stopped at the boundary — the credentials are out of the image and out of git, and the thing that holds them is a system I use, never one I run.