# olf CLI reference

> The olf commands you use to create, deploy, operate and validate an OpenLakeForge project, grouped by task. olf <command> --help prints every option of a…

Source: https://openlakeforge.dev/docs/reference/cli/

The `olf` commands you use to create, deploy, operate and validate an
OpenLakeForge project, grouped by task. `olf <command> --help` prints every
option of a command.

`olf` is installed with the `openlakeforge` Python package. It provisions its
own pinned Terraform, Helm, kubectl and kind under `OLF_HOME`
(`~/.openlakeforge` by default) and uses the AWS and Azure SDKs, so none of
those tools or cloud CLIs need to be installed. Run one `olf` command at a
time: concurrent invocations are not supported. A local, an AWS and an Azure
deployment can exist side by side, each with its own state and kubeconfig
under `OLF_HOME/state/<provider>/`.

## Where commands live

Commands that need cluster or cloud permissions are under `olf infra`. Commands
that need none, such as `olf init`, `olf check` and `olf project validate`, stay
at the top level. `olf --help` lists the top-level groups and `olf infra --help`
the infrastructure ones. The earlier top-level paths of the infra commands
(`olf deploy`, `olf project deploy`) still work as hidden aliases. Each prints one
line on stderr naming its new path and then runs unchanged, so scripts that parse
stdout keep working. `olf query` is an exception: it is a platform command of
its own, a person's queries, while `olf infra query` runs as the stage's
workload user. `olf report import|export` are the other: they move one report
as you through the platform API, while `olf infra report import|export` move
every bundle as the stage's Superset admin. See
[ADR 0020](https://openlakeforge.dev/docs/adr/0020-infrastructure-common-and-platform-cli-surfaces/).

## Options shared by lifecycle commands

`olf infra deploy`, `destroy`, `status`, `forward`, `doctor` and `plan` take:

| Option | Default | Meaning |
| --- | --- | --- |
| `--provider` | the profile's `spec.provider.type` | `local`, `aws` or `azure`; must match the profile when both are given. Without an `openlakeforge.yaml`, `local` |
| `--phase` | `all` | One phase; see each command |
| `--stage` | `dev` | `dev`, `uat` or `prod` |
| `--project-root` | current directory | The project holding `openlakeforge.yaml` |
| `--cluster-name` | `openlakeforge-local` | Local kind cluster name |
| `--kubeconfig-path` | under `OLF_HOME/state/<provider>/` | Where `olf` keeps the cluster's kubeconfig |
| `--var-file` | none | A Terraform variables file for the platform apply |

`--profile slim|full` is a deprecated shorthand for a single-DEV profile; use
`spec.preset` in `openlakeforge.yaml` instead. A stack deployed with it is
validated with the same flag: `olf infra e2e run --env local --profile slim`.

## Create a project

| Command | Does |
| --- | --- |
| `olf init` | Write `openlakeforge.yaml` and `lakehouse_code/` with the demo products. Options: `--stages dev,prod`, `--preset full`, `--name`, `--empty`, `--profile-only`. |
| `olf source new <source> --resource <r>` | Scaffold a Bronze source: `source.yaml`, a dlt loader and a placeholder CSV per resource. `--kind api\|sql` writes an incremental connector instead (`--cursor`, `--primary-key`). |
| `olf domain new <domain> --input <source>/<resource>` | Scaffold a domain and its Floe contract, one Silver table per `--input`. |
| `olf product new <domain>/<product> --gold-table <mart>` | Scaffold the product's folder of the Gold dbt project and its Dagster module. Inputs: `--silver-input <table>` or `--input <source>/<resource>`; `--with-report` adds a Superset draft. |

All `new` commands validate the result before writing and accept
`--display-name`.

## Deploy and operate

| Command | Does |
| --- | --- |
| `olf infra deploy` | Deploy all phases, or one with `--phase foundation`, `prefetch` (local), `platform` or `artifacts`. |
| `olf infra destroy` | Tear down the platform, then the foundation; `--phase platform` or `foundation` for one. `--force` destroys the foundation with platform resources left. |
| `olf infra status` | Service URLs, then pods, services and PVCs per namespace. `--json` for JSON. |
| `olf infra forward` | Port-forward every service to `localhost` until Ctrl-C. |
| `olf infra doctor` | Check the host, tools, project and cloud authentication without changing anything. |
| `olf infra restore --from <dir>` | Local provider only. Restores a backup onto a platform already deployed without the project (`olf infra platform apply`, which also recreates a destroyed cluster; `olf infra deploy --phase platform` when the cluster still exists) from the same release and `openlakeforge.yaml`; it refuses a backup whose release, profile, stages or checksums differ. Pauses the Dagster daemons and refuses while a run is in flight, suspends the stages' CronJobs, then scales Dagster, Superset, OpenMetadata, Polaris, Trino, Dex and the platform API to 0, replaces the backed-up Secrets, drops and reloads every database, makes each bucket equal to the backup's (objects written after it are deleted, then the listing is checked against the inventory by key and size), scales back up (shared services, then stages, then the daemons) and resumes the CronJobs, then reconciles the platform (`olf infra deploy --phase platform`) and reactivates, per enabled stage, the project revision the restored `ACTIVE.json` names, building nothing from the current checkout (a stage with no pointer is left alone; if a revision's image no longer exists, for example one built with `olf infra project image --no-push`, the restore fails naming the stage, revision and image). When the backup holds `local-ca`, restore also deletes the `publish-local-ca-*` Job and the Secret of every Certificate that ClusterIssuer `local-ca` issued before the reconcile, so the apply republishes the `olf-local-ca` ConfigMaps and cert-manager signs the Certificates again; after the revisions are back it waits for them and restarts the workloads that mount the ConfigMap or those Secrets. The Secrets bundle passphrase comes from `OLF_BACKUP_PASSPHRASE` or a prompt. If a step fails the workloads stay at 0: rerun the same command. |
| `olf infra source bind <source> --stage dev -f openlakeforge.yaml` | Bind the source's declared runtime keys; `--set KEY=VALUE`, `--secret-from-env KEY=VAR`, or `--secret-from-file KEY=PATH`. `--partial` keeps existing declared keys; `--dry-run` prints key names without writing. |
| `olf infra source bindings --stage dev -f openlakeforge.yaml` | Report bound, missing and extra keys for every source. Reads Secret key names only; exits 1 for missing or unreadable bindings. |
| `olf infra source unbind <source> --stage dev -f openlakeforge.yaml` | Delete the source's ConfigMap and Secret in the selected stage. |
| `olf infra plan` | Show the Terraform plan of the foundation or platform. |
| `olf infra product run <product>` | Launch a product's pipeline in a stage and wait for it (`--stage`, `-f`). `--full-refresh bronze\|gold` asks that run only for a full refresh; see [Full refresh](https://openlakeforge.dev/docs/reference/descriptors/#full-refresh). |
| `olf infra maintenance run --layer silver\|gold` | Launch the stage's Iceberg maintenance job and wait for it (`--stage`, `--dry-run`, `--json`, `-f`); prints per-table snapshots and orphans. See [Silver table maintenance](https://github.com/OpenLakeForge/openlakeforge/blob/v0.6.0-alpha.3/docs/architecture/floe-validation.md#silver-table-maintenance). |
| `olf infra query "<sql>"` | Run SQL against a stage's catalog (`--stage`, `--format table\|csv\|json`, `--file`). Local and Azure only. |
| `olf infra backup --output <dir>` | Back up a local deployment into a new directory (`-f <profile>`, `--project-root`): a `pg_dump` of each database (`polaris` first), a copy of every stage bucket and the ops bucket with a key-and-size inventory, the data-bound Secrets (including the platform API's Superset service-user passwords) and, with `tls: local-ca`, `local-ca` sealed in `secrets.enc`, then `manifest.json` and `SHA256SUMS`. It stops every stage's Dagster daemon for the length of the backup, refuses to start while a run is in flight, and always starts the daemon again. The passphrase for `secrets.enc` comes from `OLF_BACKUP_PASSPHRASE` or a prompt, never an argument; without it the Secrets cannot be restored. The directory holds all the data, so store it as you would the cluster. |
| `olf infra access trust` | Export the local CA and print the commands to trust it. Needed only for `tls: local-ca`; plain HTTP routes have nothing to trust, and with `tls: external` it refuses because your own edge holds the certificate. |
| `olf infra github connect` | Create the GitHub App for sign-in and store its credentials. |
| `olf infra auth login\|status\|logout --provider aws\|azure` | Authenticate to a cloud through its SDK. |
| `olf infra diagnostics collect <dir>` | Write host and cluster evidence for a bug report (`--namespace`, `--kube-context`). |

## Validate

| Command | Checks |
| --- | --- |
| `olf profile validate --project .` | `openlakeforge.yaml` |
| `olf profile resolve --project . --json` | Prints the resolved stages and capabilities |
| `olf check contracts` | `governance.yml`, every `source.yaml`, and the Floe project's namespaces |
| `olf project migrate [--dry-run]` | Rewrites `openlakeforge.yaml` from `v1alpha1` to `v1beta1` (`spec.access.issuer` becomes `tls`), `governance.yml` from `v1beta1` to `v1beta2` and each `source.yaml` from `v1alpha3` to `v1beta1`; `--dry-run` prints the diff and changes nothing. See [Migrate from v0.5 alpha](https://openlakeforge.dev/docs/guides/migrate-from-v0-5-alpha/) |
| `olf project graph --project .` | Prints the Source → Domain → Product → Dashboard lineage as Mermaid text |
| `olf check dbt` | The Gold dbt project parses and compiles, each product's models sit in its `<product>_gold` and read only its own domain's Silver, and every source sits in its domain's schema. Incremental models are parsed (refs, sources, Jinja) but not compiled: `is_incremental()` needs a warehouse connection, so their rendered SQL is not checked |
| `olf check resources` | Every `container` and `init_container` in `infra/terraform/modules` sets `requests` (cpu and memory) and a memory limit; an expression such as `var.x` is accepted unchecked. Helm chart containers are sized through the values files and are not covered |
| `olf check disruption` | A Terraform module that sets `replicas`, `replicaCount` or `workers` to anything but 0 or 1, or a Helm values file with `replicaCount`/`replicas` above 1, defines a PodDisruptionBudget. Single-replica workloads are exempt by design: a budget on one pod blocks node drains |
| `olf check security` | Every entry in `.trivyignore.yaml` has an owner and an unexpired date within 90 days; not part of `olf check all` |
| `olf report validate [<dashboard>]` | Superset bundles are promotable; needs no cluster or cloud credentials |
| `olf infra e2e run --env local\|aws\|azure` | The deployed platform end to end. `--suite smoke` runs the preflight checks only; `--stage` and `-f <profile>` select what to check. |
| `olf infra e2e durability capture --output <file>` | Reads one local stage (`--stage`, `-f <profile>`) without launching a pipeline and writes a JSON baseline: Gold and Silver row counts and current Iceberg snapshot ids through Trino, Dagster run ids, Superset dashboard uuids, OpenMetadata entity names and one search hit count, the `ACTIVE.json` activation pointer, and every object in the stage's Bronze, Silver and Gold buckets and the ops bucket as key and size. Superset and OpenMetadata are skipped, and recorded empty, for a stage that does not run analytics or governance (Slim). It refuses to write a file that holds the value of a Secret `olf infra e2e run` scans for. |
| `olf infra e2e durability verify --baseline <file>` | Reads the same state again and lists every loss: a missing table, run, dashboard, entity or object, fewer rows, a changed snapshot id or object size, a changed activation pointer, or an empty search. It exits non-zero if there is any; new runs and objects are not differences. Run it after an upgrade or restore with the `--stage` the baseline was captured with. |
| `olf infra e2e secret-scan --path <file or dir>` | Fails if a platform Secret's value appears in Terraform state, ConfigMaps, the diagnostics bundle or a pod log (what `olf infra e2e run` checks), or in a file under any `--path` (repeatable; `--exclude <name>` skips a file name such as `secrets.enc`; `--also-env <NAME>` adds an environment variable's value). It launches no pipeline, reads files as bytes so binary dumps are covered, and names the file and the Secret, never the value. The restore drill runs it over the backup and the drill logs. |
| `olf infra e2e stage-drill crawl\|namespaces\|principals` | Checks, between the deploys of the stage drill (`stage_drill` in `local-full-e2e.yml`, dispatch only), what each stage holds. Name stages with `--present <stage>` and `--absent <stage>` (repeatable; `--stage` and `-f <profile>` select the deployment to read). `crawl` is the Trino crawl's `polaris-om-creds` copy and its CronJob and Jobs: a stage with governance on must hold the Secret and the CronJob, one with it off none of the three kinds. `namespaces` is the stage namespace. `principals` is `olf-<stage>-processing`, `deployer-<stage>` and `trino-catalog-<stage>` in Polaris, listed as root; a stage removed with `--allow-stage-removal` must have none. Reports every violation, never a Secret value. |
| `olf infra e2e registry-pull` | Proves a local stage's user-code pods pull the project image through its `spec.project.image.pull_secret_ref` Secret. It reads the image from the stage's active revision, checks that every workload running it and the `dagster` ServiceAccount list the Secret, and fails for an image that answers an anonymous pull (`--allow-public` to run anyway). Unless `--static-only`, it removes the image from every kind node with no host Docker credentials, restarts the code locations, launches one run and reschedules the code locations off one node, requiring a `Successfully pulled` event from a pod on each node each time. It launches a run, so it is not for a stage mid-restore. `--stage` and `-f <profile>` select the stage. |

## Stages and revisions

| Command | Does |
| --- | --- |
| `olf infra platform apply -f openlakeforge.yaml` | Create the cluster, shared services and every enabled stage, without your code. |
| `olf infra project image -f openlakeforge.yaml` | Build and push the project-code image; prints a digest-pinned reference. On `local` it pushes to `spec.project.image.repository`, else `PROJECT_CODE_IMAGE_REPOSITORY`; edited code with neither is refused rather than pushed over the public example. For the unmodified public example it prints the release-pinned reference and builds nothing. |
| `olf infra project build --project . --image <ref>` | Build and publish an immutable revision; prints its id. |
| `olf infra project deploy -f openlakeforge.yaml --stage <s> --revision <id>` | Activate a revision in a stage without rebuilding. |
| `olf infra project status -f openlakeforge.yaml` | The revision active in each stage. |
| `olf infra project revision inspect\|verify --revision <id>` | Read or verify a published revision. |
| `olf infra report export --stage dev` | Export Superset dashboards into their bundles. |
| `olf infra report import` | Import the bundles into a stage's Superset. |

## Sign in from the CLI

`olf login`, `olf whoami` and `olf logout` keep a Dex or external-issuer session
for the deployment in `openlakeforge.yaml`. They need no kubeconfig and read no
Secret.

| Command | Does |
| --- | --- |
| `olf login` | Authorization Code with PKCE in your browser. `--no-browser` prints the URL instead. |
| `olf whoami` | Instance, issuer, username, email, groups and ID token expiry. Refreshes an expired ID token. |
| `olf logout` | Deletes the stored session. |

Each takes `--profile-file` (`-f`, default `openlakeforge.yaml`). The issuer is
`https://auth.<base_domain>` with `identity.issuer: github`, or `issuer_url`
with `external`. The client id is `identity.client_ids['olf-cli']`, else
`olf-cli`. With access `tls: none` the Dex issuer is `http://`.

A profile with `spec.access` and no `spec.identity` has authentication off:
`olf login` and `olf whoami` say that sign-in is disabled and exit 0, `olf
logout` does nothing, and platform commands run without login. A profile
without `spec.access` publishes no routes, so these commands fail and point to
`olf infra`.

The session is `$OLF_HOME/sessions/<base_domain>.json`, mode 0600, and holds
the ID, access and refresh tokens. Run `olf login` again when `olf` reports the
session expired.

A local deployment serves the issuer with its own CA, which Python does not
read from the system store. Export it, then point `olf` at it:

```bash
olf infra access trust --output ./olf-local-ca.crt
export REQUESTS_CA_BUNDLE="$PWD/olf-local-ca.crt"   # SSL_CERT_FILE also works
olf login
```

## Query as yourself

`olf query` runs SQL against a stage's data as the signed-in person, through
the stage's Trino at `https://trino-<stage>.<base_domain>/v1`. It needs `spec.identity.issuer:
github` and `olf login` first. What you may read or write on each stage and
layer is your role's `data_access` row in `release/identity-roles.yaml`, which
Polaris enforces ([ADR 0019](https://openlakeforge.dev/docs/adr/0019-data-plane-authorization-deferral/)).
When Polaris or the object store refuses a query, `olf query` says why.

```bash
olf query --stage prod "SELECT count(*) FROM order_revenue_gold.mart_order_revenue_by_day"
```

| Option | Default | Meaning |
| --- | --- | --- |
| `--stage` | `dev` | `dev`, `uat` or `prod`: the stage's catalog, `lakehouse_<stage>`, is the session default, so SQL names `<schema>.<table>` |
| `--format` | `table` | `table`, `csv` or `json` (one object per row) |
| `--file` | — | Read the SQL from a file instead of the argument |
| `--profile-file`, `-f` | `openlakeforge.yaml` | Deployment Profile of the deployment |

`olf infra query` runs the same SQL as the stage's workload user through
`kubectl exec`, for operators: it needs cluster access, not a sign-in.

## Read the platform

These commands read the platform as the signed-in person, through the platform
API at `https://<base_domain>/api`
([ADR 0021](https://openlakeforge.dev/docs/adr/0021-platform-api/)). They need `olf login` first, no
kubeconfig, and no infra credential: the API decides what your role may read, and
what it may launch.

| Command | Reads | Lowest role |
| --- | --- | --- |
| `olf jobs list` | The stage's pipeline jobs | `data-engineer` |
| `olf runs list` | The stage's most recent runs, newest first; `--job` for one job, `--limit` 1 to 100 (default 20) | `data-engineer` |
| `olf runs show <run-id>` | One run's status, times and tags | `data-engineer` |
| `olf runs launch <job>` | Launches the job as you, on `dev` only; the API stores an audit record first and launches nothing if it cannot | `data-engineer` |
| `olf logs` | The stage's archived pod log lines for a day (`--date`, default today in UTC) or one `--hour`; `--pod`, `--container`, `--limit` 1 to 5000 (default 500) | `data-engineer` |
| `olf domain list` | Governance domains, as OpenMetadata shows them to you | `viewer`, then your OpenMetadata roles |
| `olf product list` | Data products and their domains, as OpenMetadata shows them to you | `viewer`, then your OpenMetadata roles |
| `olf report import <dir>` | Imports one report directory into the stage's Superset, on `dev` only, overwriting the assets it carries. Only `metadata.yaml`, `datasets/`, `charts/` and `dashboards/` are sent, at most 500 files, 2 MiB each and 10 MiB in all; datasets use the stage's existing connections, and every schema they read must already be granted by the artifacts phase | `data-engineer` |
| `olf report export <dashboard> <dir>` | Exports one dashboard, by uuid or slug, into a report directory, stage-neutral; its managed assets are replaced | `data-engineer` |

Each but `report export` takes `--json` to print the API's JSON instead of a table, and
`--profile-file` (`-f`). `jobs`, `runs`, `logs` and `report` take `--stage` (default `dev`). When
the API refuses, the command says why: an expired or rejected session asks you
to run `olf login`, and a role below the operation's floor names the role it
needs.

## Installation and toolchain

| Command | Does |
| --- | --- |
| `olf version` | The installed version. |
| `olf toolchain list\|install\|path\|clean` | Inspect, download or remove the managed Terraform, Helm, kubectl and kind. |
| `olf distribution path\|verify` | The platform payload the package ships, such as the Terraform roots. |

## Environment variables

| Variable | Default | Meaning |
| --- | --- | --- |
| `OLF_HOME` | `~/.openlakeforge` | Toolchain, platform payload, state, kubeconfigs and sign-in sessions |
| `REQUESTS_CA_BUNDLE`, `SSL_CERT_FILE` | unset | CA file `olf login` verifies the issuer against |
| `OLF_TOOLCHAIN_MODE` | `managed` | `host` uses Terraform, Helm, kubectl and kind from `PATH` |
| `OLF_PORT_FORWARD` | unset | `1` makes `olf` port-forward instead of using the local ingress |
| `PROJECT_CODE_IMAGE_REPOSITORY`, `PROJECT_CODE_IMAGE_TAG` | `ghcr.io/openlakeforge/openlakeforge/project-code`, `local` | Where `olf infra project image` pushes on the local provider when the profile has no `spec.project.image.repository` |
| `AWS_*`, `AZURE_*` | | Cloud settings; see [Deploy to AWS](https://openlakeforge.dev/docs/guides/cloud/deploy-to-aws/) and [Deploy to Azure](https://openlakeforge.dev/docs/guides/cloud/deploy-to-azure/) |

## Contributor commands

A source checkout runs the same commands through
`uv run --project tools/olf --locked olf`. Commands that only make sense there,
such as `olf check all`, `olf infra smoke run` and `olf release`, are described in
[AGENTS.md](https://github.com/OpenLakeForge/openlakeforge/blob/v0.6.0-alpha.3/AGENTS.md) and [tools/olf/README.md](https://github.com/OpenLakeForge/openlakeforge/blob/v0.6.0-alpha.3/tools/olf/README.md).

---

<small>Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/reference/cli.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/reference/cli.md).</small>
