CLI reference

The flux CLI is the operator interface for provisioning, migrations, lifecycle, backups, and private database access.

What you will learn

  • How to discover commands locally
  • Common verbs and their intent
  • Relationship to dashboard operations

The idea

Exact flags evolve—flux --help and subcommand help are authoritative for your installed version. This page orients you; it does not duplicate every flag (that belongs in --help and release notes).

Common commands

CommandPurpose
flux loginVerify API token / base URL
flux initLink or create a project from repo-root flux.json (Foundry placeholder hash)
flux createProvision a project
flux listShow projects and Service URLs
flux pushApply a .sql file or ordered migrations/ directory—--mode raw|versioned|repeatable, --force (repeatable), --plan / --dry-run preview directory pushes; pass --project / --hash (or flux.json)
flux migrations listShow flux.flux_migrations ledger (remote state, not local files). flux migrationsflux migrate (engine conversion)
flux project credentialsv1 dedicated → structured Postgres block (user, password, host, port, connection URL) plus anon/service JWT keys. v2_shared → gateway JWT secret and a short note. Use --field postgres.password (v1) for paste-friendly password-only output
flux db passwordv1 dedicated → print only the Postgres password. v2_shared → explains temporary tunnel credentials (never pooled admin secrets)
flux db tunnelOpen local SSH tunnel; print GUI connection settings. v1 → password via flux db password. v2 → creates temporary scoped credentials when opening the tunnel
flux db shellpsql through the tunnel; --command 'SELECT 1' for non-interactive queries
flux db dumpv2_shared schema-scoped pg_dump via tunnel; use --schema-only with readonly temp roles when RLS blocks data
flux db restorev1 dedicated pg_restore via tunnel (restore-verified backup gate). v2_shared refused for production pooled schemas
flux db access-plan / flux db gui-configRedacted mode-aware metadata and copy-friendly GUI fields
flux dumpLegacy project export (see flags locally; distinct from flux db dump)
flux migrateOrchestrate v2_sharedv1_dedicated via the control plane (see Pooled → dedicated migrate)
flux logsTail project logs when wired
flux backup createBoth engines — control plane streams pg_dump -Fc. v1: full project DB. v2: tenant API schema (--schema=t_<short>_api --no-owner --no-acl). See Backups workflow
flux backup listRecent backups newest-first with trust labels (Restorable / Created, not restore-verified / Restore verification failed / etc.). Pass --verbose for catalog timestamps, artifact paths, and underlying tier names
flux backup verifyRuns pg_restore in a disposable Postgres container on the control plane. The only step that promotes a backup to Restorable. Requires docker-cli in the flux-web image (self-hosted operators)
flux backup downloadWrites the custom-format archive to -o <path> (or shell redirect). Refuses binary output to a TTY

Private database access: Private database access guide — SSH tunnels, Beekeeper/DBeaver setup, password handoff.

Operators (v2_shared): If directory flux push fails on a legacy global migration ledger, run bin/migrate-pooled-ledger.sh on the Flux host — see Migrations workflow and the root README.

Identifiers

Codex / internal docs describe hashing:

  • Resource pattern: flux-{hash}-{slug} (7-char hex hash segment)
  • Slug is user-facing; hash is assigned at provision time

The same Codex contract JSON is available from the dashboard at GET /api/cli/v1/codex (useful for assistants and tooling).

How it works

Install: Installation.

Foundry / app repo workflow

When the repo already has flux.json with "hash": "REPLACE_AFTER_FLUX_INIT":

bash
flux loginflux initpnpm flux:schema:syncflux push sql/migrations/ --plan

flux init writes the control-plane slug, hash, and optional apiUrl / mode / apiSchema into flux.json. It does not write JWT or gateway secrets—use flux project credentials or the dashboard for those.

Example

bash
flux --helpflux push --helpflux push db/migrations/0001_moods.sql --project percept --hash b915ec8flux db tunnel yeastcoast --hash ffca33fflux db password yeastcoast --hash ffca33fflux project credentials percept --hash b915ec8 --field postgres.passwordflux backup download -p percept --hash b915ec8 --latest -o ./percept.dump

Use your own slug and hash from flux list (example values above).

Next steps