Papers

Personal-local Barkpark (barkpark up)

Wave 5 of the convergence project: run the whole stack with one command, no manual Postgres, no hand-rolled secrets. Everything Barkpark-private lives under $BARKPARK_HOME (default ~/.barkpark).

One command

bin/barkpark up

That does, in order:

  1. Secrets (Barkpark.Release.Secrets) — first run generates SECRET_KEY_BASE, PREVIEW_JWT_SECRET, and BARKPARK_CLOAK_KEY into ~/.barkpark/.env and chmod 0600s it. Re-runs only top up missing keys — existing values are never overwritten and never printed.
  2. Managed Postgres (bin/barkpark-pg start) — a Barkpark-private Postgres on port 5433, bound to 127.0.0.1 only, with its data dir at ~/.barkpark/pgdata. First run initdbs it; later runs detect and reuse the existing data dir. It never touches a system/dev Postgres on 5432.
  3. Migratemix ecto.migrate against the managed instance.
  4. Bootmix phx.server in MIX_ENV=prod (so config/runtime.exs reads the managed DATABASE_URL and the generated secrets), then prints the URL.

barkpark up is safe to re-run: an already-running Postgres and server are detected and left alone.

CommandEffect
barkpark upensure secrets → start PG → migrate → boot → print URL
barkpark reloadrestart the server so config changes take effect (PG stays up)
barkpark stopstop the server and the managed Postgres
barkpark statusreport Postgres + server state
barkpark psql …psql shell on the managed Postgres

Locating Postgres tools

barkpark-pg finds initdb/pg_ctl/psql in this priority order:

  1. $BARKPARK_PG_BIN (explicit override),
  2. Postgres.app bundled versions (newest),
  3. Homebrew postgresql@NN kegs (newest),
  4. whatever is on PATH.

The Postgres major.minor that created the data dir is pinned in ~/.barkpark/PG_VERSION_PINNED. Starting against a different major version fails fast with a clear message rather than a cryptic pg_ctl error, because Postgres cannot open a data dir across major versions.

CONFIG-RELOAD FOOTGUN (read this)

Barkpark reads its secrets and tokens from ~/.barkpark/.env at boot only. Neither mix phx.server nor a mix release hot-reloads config/*.exs or re-reads the env file while running. So when you change a value in ~/.barkpark/.env — most commonly PAPERFLOW_INGEST_TOKEN — the running server keeps the old value until it is restarted.

That is why barkpark reload exists. It is a full stop + start of the server process (Postgres keeps running), which re-sources ~/.barkpark/.env and re-runs config/runtime.exs:

$EDITOR ~/.barkpark/.env      # change PAPERFLOW_INGEST_TOKEN
bin/barkpark reload           # new token now in effect

Editing the env file without reload is a silent no-op against the running server — the single most common Wave-5 footgun, and the reason this command is not just up run twice.

Overrides

Env varDefaultMeaning
BARKPARK_HOME~/.barkparkroot for data dir, env file, logs, pidfile
BARKPARK_PG_PORT5433managed Postgres port
BARKPARK_PG_BINautodetectforce a specific Postgres bin/
PORT4000HTTP port the server listens on
PHX_HOSTlocalhosthost for Endpoint URL + check_origin
BARKPARK_MIX_ENVprodthe env up/reload boot under