# OpenLakeForge
> OpenLakeForge is an open-source lakehouse platform defined as code: infrastructure, data contracts, SQL models, pipelines, dashboards and CI live in one Git repository, deployed by the `olf` CLI on local Kubernetes (kind) today, with AWS and Azure in preview. The stack is Apache Iceberg, Apache Polaris, Trino, dlt, Floe, dbt, Dagster, Superset and OpenMetadata.
The complete documentation of release `v0.6.0-alpha.3`.
---
# OpenLakeForge documentation
> OpenLakeForge is an open-source lakehouse you run entirely in your own infrastructure, small enough for one data team to operate. These pages show how to…
Source: https://openlakeforge.dev/docs/
OpenLakeForge is an open-source lakehouse you run entirely in your own
infrastructure, small enough for one data team to operate.
These pages show how to install it, build data products on it, and deploy it
to AWS or Azure.
New to OpenLakeForge? Read the [Introduction](https://openlakeforge.dev/docs/get-started/introduction/),
run the [Quickstart](https://openlakeforge.dev/docs/get-started/quickstart/), then follow the
[Tutorial](https://openlakeforge.dev/docs/tutorial/01-tour-the-platform/) from lesson 1.
| I want to | Go to |
| --- | --- |
| Know what OpenLakeForge is and whether it fits | [Introduction](https://openlakeforge.dev/docs/get-started/introduction/) |
| Run it on my machine | [Quickstart](https://openlakeforge.dev/docs/get-started/quickstart/) |
| Learn the vocabulary | [Concepts](https://openlakeforge.dev/docs/get-started/concepts/) |
| Build my first data product | [Tutorial](https://openlakeforge.dev/docs/tutorial/01-tour-the-platform/) |
| Add sources, domains and products | [Build and manage data products](https://openlakeforge.dev/docs/guides/data-products/) |
| Load an API or a database incrementally | [Load an external source incrementally](https://openlakeforge.dev/docs/guides/incremental-sources/) |
| Configure a local install | [Install and configure a local deployment](https://openlakeforge.dev/docs/guides/local-installation/) |
| Deploy to a cloud | [AWS](https://openlakeforge.dev/docs/guides/cloud/deploy-to-aws/) or [Azure](https://openlakeforge.dev/docs/guides/cloud/deploy-to-azure/) |
| Control who can sign in | [Connect GitHub](https://openlakeforge.dev/docs/guides/identity/connect-github/) |
| Promote from DEV to PROD in CI | [CI/CD and environment promotion](https://openlakeforge.dev/docs/guides/promote-dev-to-prod/) |
| Fix a failing deployment | [Troubleshooting](https://openlakeforge.dev/docs/guides/troubleshooting/) |
| Look up a command or field | [CLI](https://openlakeforge.dev/docs/reference/cli/), [Deployment Profile](https://openlakeforge.dev/docs/reference/deployment-profile/), [Descriptors](https://openlakeforge.dev/docs/reference/descriptors/), [Runtime API](https://openlakeforge.dev/docs/reference/runtime-api/) |
| Understand how it works | [Architecture](https://openlakeforge.dev/docs/architecture/overview/) |
To change OpenLakeForge itself, start with the contributor guide,
[AGENTS.md](https://github.com/OpenLakeForge/openlakeforge/blob/v0.6.0-alpha.3/AGENTS.md). Maintainer material such as the
[architecture decision records](https://openlakeforge.dev/docs/adr/) stays in the repository.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/README.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/README.md).
---
# Introduction
> OpenLakeForge is an open-source lakehouse you run entirely in your own infrastructure, small enough for one data team to operate. This page says what it…
Source: https://openlakeforge.dev/docs/get-started/introduction/
OpenLakeForge is an open-source lakehouse you run entirely in your own
infrastructure, small enough for one data team to operate. This page says what
it assembles, who it is for, and what you take on when you run it.
## What it is
OpenLakeForge packages ingestion, validation, table storage, a catalog, a
query engine, transformations and orchestration into one platform on
Kubernetes. Terraform and Helm come with it, and the `olf` CLI drives them, so
you do not install or wire any of those tools yourself.
| Layer | What happens | Technology |
| --- | --- | --- |
| Bronze | Source files land as CSV in object storage | dlt |
| Silver | Technical contracts validate them into Iceberg tables | Floe |
| Gold | Business marts are modelled in SQL and run in the query engine | dbt-trino on Trino |
Dagster orchestrates every run. Around that path sit the shared services:
| Capability | Local | AWS |
| --- | --- | --- |
| Table format | Apache Iceberg | Apache Iceberg |
| Catalog | Apache Polaris | AWS Glue |
| Object storage | SeaweedFS | Amazon S3 |
| Service state | PostgreSQL | Amazon RDS |
| Governance and lineage | OpenMetadata _(optional)_ | OpenMetadata _(optional)_ |
| Dashboards | Superset _(optional)_ | Superset _(optional)_ |
Infrastructure sits behind provider-neutral contracts, so the same project
runs on a laptop, AWS or Azure. See
[Architecture](https://openlakeforge.dev/docs/architecture/overview/#providers).
## Who it is for
Data teams that have to own their data platform and want a complete one
without building it first:
- **Teams whose data must stay in their own infrastructure.** Data
sovereignty, data residency or sector rules (public sector, health,
finance) rule out a SaaS warehouse; every component runs in your cluster,
storage and cloud account.
- **Data teams that already run Kubernetes** and want an open,
predictable-cost alternative to a proprietary warehouse.
- **Consultancies and integrators** that deliver the same platform to several
clients: one pinned, tested release they can reproduce per client.
In each case the team running it is small: the platform comes assembled, so
it does not need a dedicated platform engineer to start.
Everything is code in one repository: the Deployment Profile
(`openlakeforge.yaml`) says where the platform runs, and `lakehouse_code/`
holds your sources, contracts, dbt models, Dagster jobs and dashboards.
## Is it a good fit?
| Good fit | Not yet |
| --- | --- |
| Data that must stay on your own Kubernetes, storage and cloud account | Streaming workloads: v1 is batch-first |
| A data team on Kubernetes that wants an open alternative to a proprietary warehouse | Production-critical use: the project is alpha |
| An integrator deploying the same platform for several clients | Teams that want a fully managed SaaS |
| A small team that wants a batch lakehouse without building the platform first | A small team with no Kubernetes and no residency constraint: a managed warehouse is simpler |
## What you operate
OpenLakeForge is software you run, not a service. Once you deploy it, these
are yours:
| Responsibility | What OpenLakeForge gives you |
| --- | --- |
| The cluster and its capacity | `olf infra deploy` creates a local kind cluster, an EKS cluster or an AKS cluster |
| Access and sign-in | Plain HTTP on `*.olf.localhost` locally; GitHub sign-in when you add `spec.identity` ([Connect GitHub](https://openlakeforge.dev/docs/guides/identity/connect-github/)) |
| Who may use which service | Canonical roles mapped to GitHub teams; membership changes happen in GitHub |
| Upgrades | Pinned component versions per release ([Compatibility matrix](https://openlakeforge.dev/docs/reference/compatibility-matrix/)) |
| Diagnosis | `olf infra status`, `olf infra diagnostics collect`, `olf infra e2e run` |
| Backup and restore | `olf infra backup` and `olf infra restore` on the local provider ([Back up and restore](https://openlakeforge.dev/docs/guides/backup-and-restore/)) |
Monitoring and backups of the cloud providers are on the roadmap, not in the
alpha: see the [milestones](https://github.com/OpenLakeForge/openlakeforge/milestones).
## Next
- [Quickstart](https://openlakeforge.dev/docs/get-started/quickstart/): a local platform with three example data
products, in one deploy.
- [Concepts](https://openlakeforge.dev/docs/get-started/concepts/): the vocabulary the rest of the docs use.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/get-started/introduction.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/get-started/introduction.md).
---
# Quickstart
> Deploy OpenLakeForge on your machine, run an example data product from Bronze to Gold, and check the result. You need Docker and about the time of one first…
Source: https://openlakeforge.dev/docs/get-started/quickstart/
Deploy OpenLakeForge on your machine, run an example data product from
Bronze to Gold, and check the result. You need Docker and about the time of
one first deploy, which takes several minutes while images download.
The local platform runs in a [kind](https://kind.sigs.k8s.io/) cluster on your
Docker engine. It does not touch your own `~/.kube/config`.
## Before you start
| You need | Check |
| --- | --- |
| A running Docker engine | `docker ps` succeeds |
| [uv](https://docs.astral.sh/uv/) | `uv --version` |
| Ports 80 and 443 free on `127.0.0.1` | Nothing else serves `http://localhost` |
| 4 CPUs and 16 GB of memory available to Docker | `docker info` shows `CPUs` and `Total Memory` |
| Free disk for Docker's images and volumes | 100 GB covers the Full preset with two stages ([details](https://openlakeforge.dev/docs/guides/local-installation/#hardware)) |
| On WSL2 only: one time source | `systemctl is-active systemd-timesyncd` is not `active` ([why and how](https://openlakeforge.dev/docs/guides/local-installation/#on-wsl2)) |
Terraform, Helm, kubectl and kind are not prerequisites: `olf` provisions
pinned copies under `~/.openlakeforge`.
## 1. Install `olf` and create a project
```bash
uv tool install "openlakeforge==0.6.0a3" --python 3.12
mkdir my-lakehouse && cd my-lakehouse
olf init
```
`olf init` writes two things you own:
```text
my-lakehouse/
├── openlakeforge.yaml # Deployment Profile: provider, stages, preset, access
└── lakehouse_code/ # sources, contracts, dbt projects, Dagster jobs
```
The profile is a single DEV stage, the Slim preset, plain HTTP and no
sign-in. `lakehouse_code/` holds three example data products:
`sales/order_revenue`, `sales/customer_health` and
`supply_chain/inventory_reliability`.
## 2. Deploy
```bash
olf infra deploy
```
`olf infra deploy` creates the kind cluster, deploys the platform services, builds
the project-code image from `lakehouse_code/`, and registers the data products
with Dagster.
## 3. Open the portal
```bash
olf infra status
```
Its `URLs` section lists every service. Open the portal:
```text
http://olf.localhost
```
It links to each service the profile enables. Browsers resolve every
`*.localhost` name to your machine, so no hosts-file entry is needed. There is
no sign-in: authentication stays off until you add `spec.identity`.
:::note
A profile without `spec.identity` publishes nothing beyond your machine:
locally, only on `*.localhost`. With the Full preset and sign-in off, Superset opens as Admin
and OpenMetadata keeps its `admin@open-metadata.org` login, with the password
in Secret `openmetadata-admin`, as `olf infra status` notes. To serve HTTPS, see
[Serve HTTPS](https://openlakeforge.dev/docs/guides/local-installation/#serve-https); to sign in with
GitHub, see [Connect GitHub](https://openlakeforge.dev/docs/guides/identity/connect-github/).
:::
## 4. Run a data product
Open Dagster from the portal, or directly:
```text
http://dagster-dev.olf.localhost
```
Open **Jobs**, select `order_revenue_pipeline` and launch it. The run loads the
CRM CSV files into Bronze with dlt, validates them into Silver Iceberg tables
with Floe, and builds four Gold marts with dbt-trino, such as
`mart_order_revenue_by_day`. The asset graph shows each step as it
materializes.
## 5. Check it worked
```bash
olf infra e2e run --env local --suite full
```
The suite launches every example product's job and checks that each Silver
and Gold table exists, then queries every Gold mart through Trino and expects
rows. It ends without an error when the platform works end to end.
To see the Gold rows yourself, query them through Trino:
```bash
olf infra query "SELECT * FROM order_revenue_gold.mart_order_revenue_by_day LIMIT 10"
```
## Tear down
```bash
olf infra destroy
```
## Next
- [Tutorial: Discover OpenLakeForge](https://openlakeforge.dev/docs/tutorial/01-tour-the-platform/):
tour the platform, then add a source, a contract and a Gold model of your
own.
- [Concepts](https://openlakeforge.dev/docs/get-started/concepts/): presets, stages, project revisions and roles.
- [Install and configure a local deployment](https://openlakeforge.dev/docs/guides/local-installation/):
pip installs, presets, HTTPS and teardown.
- Deploy for real: [AWS](https://openlakeforge.dev/docs/guides/cloud/deploy-to-aws/) or
[Azure](https://openlakeforge.dev/docs/guides/cloud/deploy-to-azure/).
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/get-started/quickstart.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/get-started/quickstart.md).
---
# Concepts
> The words the rest of the documentation uses, one paragraph each, with a link to the page that goes deeper.
Source: https://openlakeforge.dev/docs/get-started/concepts/
The words the rest of the documentation uses, one paragraph each, with a link
to the page that goes deeper.
## Medallion layers
Data moves through three layers, each owned by one tool. **Bronze** holds
source files as CSV in object storage, loaded by dlt. **Silver** holds the
same entities as Iceberg tables, validated by Floe contracts. **Gold** holds
business marts that dbt-trino builds in SQL. Dagster orchestrates the path.
See [Architecture](https://openlakeforge.dev/docs/architecture/overview/#bronze-silver-and-gold).
## Sources, domains and data products
A **source** is one system you ingest from, declared in
`lakehouse_code/bronze//source.yaml`. A **domain** groups the Silver
tables a business area owns. A **data product** belongs to a domain, reads
Silver tables and publishes Gold tables; each product gets one Dagster job,
`_pipeline`. `olf source new`, `olf domain new` and `olf product new`
scaffold them. See [Ingest a source](https://openlakeforge.dev/docs/tutorial/02-ingest-a-source/).
## Descriptors
`lakehouse_code/governance.yml` declares domains and products, and each
`source.yaml` declares a source's resources. Descriptors name logical things
only, never Polaris, Glue, S3 or SeaweedFS: OpenLakeForge derives catalog
namespaces and storage paths from them. See the
[descriptor reference](https://openlakeforge.dev/docs/reference/descriptors/).
## Deployment Profile
`openlakeforge.yaml` says where the platform runs: the provider (`local`,
`aws`, `azure`), the preset, the enabled stages, access (`spec.access`) and
sign-in (`spec.identity`). `olf profile validate` checks it. See
[Deployment Profile reference](https://openlakeforge.dev/docs/reference/deployment-profile/).
## Presets
**Slim**, the default, deploys ingestion, validation, Iceberg, the catalog,
Trino, dbt and Dagster. **Full** adds OpenMetadata for governance and lineage,
and Superset for dashboards. Set `spec.preset: full` and deploy again; the data
path does not change.
## Stages
A profile enables `dev`, an optional `uat`, and `prod`. All stages share one
cluster and the platform services in `olf-system`. Each stage has its own
`olf-` namespace with its own Dagster (and Superset with Full), its own
buckets and its own `lakehouse_` catalog. No data is copied between
stages. See [Architecture](https://openlakeforge.dev/docs/architecture/overview/#deployment-model).
## Project revisions
`olf infra project build` freezes the project into an immutable **project
revision**: descriptors, contracts, dbt, Dagster code and the project-code
image digest. A revision is activated in DEV, validated, then activated
unchanged in PROD; PROD never rebuilds. See
[CI/CD and environment promotion](https://openlakeforge.dev/docs/guides/promote-dev-to-prod/).
## Deploy phases
`olf infra deploy` runs three phases in order. **Foundation** creates the cluster and
registry; **platform** deploys the shared services; **artifacts** deploys
everything derived from `lakehouse_code/`. A code change only reruns
artifacts. See [Architecture](https://openlakeforge.dev/docs/architecture/overview/#deployment-model).
## Provider contracts
Platform components talk to infrastructure through provider-neutral
contracts, so local, AWS and Azure expose the same capabilities with
different implementations, such as Polaris or Glue as the catalog. See
[Architecture](https://openlakeforge.dev/docs/architecture/overview/#providers).
## Roles
With sign-in on, each person holds one of four canonical roles:
`platform-admin`, `data-engineer`, `analyst` or `viewer`. The profile maps each
role to GitHub teams, and the role decides which services a person can open
and what they can do inside them; an `analyst` reaches Superset but not
Dagster. See [Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/).
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/get-started/concepts.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/get-started/concepts.md).
---
# Tour the platform
> This lesson opens the portal and Dagster on a running local deployment, launches one of the demo data products, and shows what each step produced. It is the…
Source: https://openlakeforge.dev/docs/tutorial/01-tour-the-platform/
This lesson opens the portal and Dagster on a running local deployment,
launches one of the demo data products, and shows what each step produced. It
is the first of the tutorial lessons that build one project, one capability at
a time.
**You will** open the portal, read the Dagster asset graph and run a data
product from Bronze to Gold, in about 15 minutes.
**Start from** the project you deployed in the
[Quickstart](https://openlakeforge.dev/docs/get-started/quickstart/) (steps 1 and 2), on the default
**Slim** preset with its three demo data products. Lesson 6 switches the same
deployment to Full in place, without losing anything you built. Run every
`olf` command in this tutorial from that project directory.
## 1. Open the portal
```text
http://olf.localhost
```
The portal links to every service the profile enables. `olf infra status --provider
local` lists the same addresses in its `URLs` section. Browsers resolve every
`*.localhost` name to your machine, so no hosts-file entry is needed, and
there is no sign-in yet.
## 2. Open Dagster
Select Dagster in the portal, or go to it directly:
```text
http://dagster-dev.olf.localhost
```
Dagster orchestrates every pipeline in OpenLakeForge. From its UI you can
inspect the asset graph, launch a job, inspect each materialization and read
the execution logs.
## 3. Read the asset graph
Open **Assets** and its lineage graph. Each data product is a chain of three
layers, and the asset key tells you which:
| Layer | Built by | Asset key | Example |
| --- | --- | --- | --- |
| Bronze | dlt | `/` | `crm/accounts` |
| Silver | Floe | `/
` | `sales/accounts` |
| Gold | dbt | `/` | `customer_health/mart_customer_health_score` |
The demo project has two sources (`crm`, `erp`), two domains (`sales`,
`supply_chain`) and three products (`order_revenue`, `customer_health`,
`inventory_reliability`). Follow the arrows from `crm/accounts` to a Gold mart
to see one product end to end.
## 4. Launch a product job
Every product gets one job named `_pipeline`. Open **Jobs**, select
`customer_health_pipeline`, open its **Launchpad** and select **Launch Run**.
The run loads the CSV files into Bronze, validates them into Silver Iceberg
tables, and builds the Gold marts with dbt. The graph updates as each asset
materializes.
## 5. Inspect the materializations
When the run succeeds, select the Bronze asset `crm/accounts` and open its
latest materialization. dlt records the number of `rows` loaded, the
`bronze_uri` it wrote to in object storage and the `source_file` it read. The
run page lists the logs of every step.
## Check it worked
```bash
olf infra e2e run --env local --suite full
```
The suite launches every demo product's job, checks that each Silver and Gold
table exists, and queries every Gold mart through Trino for rows. It ends
with:
```text
Local OpenLakeForge full e2e validation passed.
```
## What you learned
- The portal links every service; Dagster is where you run and inspect
pipelines.
- A data product is a Bronze, Silver and Gold chain with one
`_pipeline` job.
- `olf infra e2e run` checks every deployed data product end to end; you will rerun
it after each change to a product.
## Next
[Ingest a source](https://openlakeforge.dev/docs/tutorial/02-ingest-a-source/): add a source of your own.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/01-tour-the-platform.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/01-tour-the-platform.md).
---
# Ingest a source
> This lesson adds a new source to the project with olf source new, gives it data, and explains the dlt loader that lands that data in Bronze. The source is a…
Source: https://openlakeforge.dev/docs/tutorial/02-ingest-a-source/
This lesson adds a new source to the project with `olf source new`, gives it
data, and explains the dlt loader that lands that data in Bronze. The source
is a marketing platform that exports campaign performance as CSV.
**You will** scaffold a Bronze source and give it real data, in about 10
minutes.
**Start from** the project of [lesson 1](https://openlakeforge.dev/docs/tutorial/01-tour-the-platform/): deployed,
with the three demo data products. Run every command from the project
directory.
:::note
The lesson uses a CSV file because it is the fastest example, and a fixed
CSV gives the same result on every run, which is why the demo products use
them as test seeds. CSV is not a limit of the platform: dlt can extract from
APIs and databases, and Floe reads CSV, TSV, JSON, Parquet, ORC, Avro, XLSX,
XML and fixed-width files into Iceberg. Sources of those kinds are being
added in [#110](https://github.com/OpenLakeForge/openlakeforge/issues/110).
:::
## How the project is organized
Your code lives under `lakehouse_code/`, and each medallion layer has its own
owner (see
[ADR 0004](https://openlakeforge.dev/docs/adr/0004-medallion-layout-and-catalog-namespaces/)):
| Layer | Aligned to | Directory |
| --- | --- | --- |
| Bronze | A source | `lakehouse_code/bronze//` |
| Silver | A domain | `lakehouse_code/silver//` |
| Gold | A data product | `lakehouse_code/gold/models//` |
Across the next lessons you add the source `marketing_platform`, the domain
`marketing` and the product `campaign_performance`. OpenLakeForge derives
every platform name from those three: the Silver namespace `marketing_silver`, the Gold
namespace `campaign_performance_gold` and the Dagster job
`campaign_performance_pipeline`. You never create these by hand and you never
edit Terraform to register a product.
## 1. Scaffold the source
```bash
olf source new marketing_platform --resource campaigns
```
```text
Created source 'marketing_platform' with 1 resource(s): campaigns.
```
The command validates its result before it writes anything, and writes
nothing if validation fails. It creates:
```text
lakehouse_code/bronze/marketing_platform/
├── source.yaml
├── README.md
├── examples/
│ └── campaigns.csv
└── dlt/
├── __init__.py
└── marketing_platform.py
```
## 2. Read the source descriptor
`source.yaml` is the logical description of the source:
```yaml
apiVersion: openlakeforge.io/v1beta1
kind: Source
name: marketing_platform
displayName: "Marketing Platform"
description: "Marketing Platform source system."
status: planned
resources:
- name: campaigns
description: "Raw CSV campaigns."
```
It lists the resources the source exposes and never names Polaris, Glue, S3 or
any other provider: OpenLakeForge derives the physical names from it. Its
`name` must match its directory.
## 3. Add the data
The scaffold wrote a placeholder file with a single column. Replace it with
campaign data:
```bash
cat > lakehouse_code/bronze/marketing_platform/examples/campaigns.csv <<'CSV'
campaign_id,campaign_date,channel,spend,conversions
cmp_001,2026-08-01,search,120.50,18
cmp_002,2026-08-01,social,80.00,9
cmp_003,2026-08-02,search,150.00,24
cmp_004,2026-08-02,email,30.00,12
cmp_005,2026-08-03,social,95.50,11
CSV
```
Do this before the next lesson: the validation contract for Silver is
inferred from this file when you create the domain.
## 4. Read the loader
`dlt/marketing_platform.py` is the Bronze loader. It reads each resource's CSV
from `examples/` through dlt, writes it to the Bronze bucket under the
`marketing_platform` prefix, and returns the row count, the `bronze_uri` and
the `source_file` to Dagster, which shows them on the asset. Its core is one
call:
```python
return load_entities_to_bronze(
entities=entities,
raw_dir=raw_dir or _RAW_DIR,
bronze_prefix=_BRONZE_PREFIX,
)
```
Loading is keyed by source, so every product that needs
`marketing_platform.campaigns` calls this one loader. Nothing loads yet:
Dagster runs the loader as the first step of a product job, which you create
in lesson 4.
## Check it worked
```bash
olf check contracts
```
It validates `lakehouse_code/governance.yml` and every `source.yaml` against
the project schemas. It prints one `[PASS]` line per check, including:
```text
[PASS] descriptor_schema_conformance: 4 descriptor(s) validated
```
## What you learned
- `olf source new` scaffolds a source-owned Bronze package: a descriptor, a
dlt loader and example data.
- Descriptors stay provider-neutral; OpenLakeForge derives physical names.
- Bronze fills when a product job runs.
## Next
[Validate into Silver](https://openlakeforge.dev/docs/tutorial/03-validate-into-silver/): declare what a valid row
looks like.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/02-ingest-a-source.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/02-ingest-a-source.md).
---
# Validate into Silver
> This lesson creates the marketing domain with olf domain new, which writes the Floe contract that turns the Bronze CSV into a validated Silver Iceberg…
Source: https://openlakeforge.dev/docs/tutorial/03-validate-into-silver/
This lesson creates the `marketing` domain with `olf domain new`, which writes
the Floe contract that turns the Bronze CSV into a validated Silver Iceberg
table. It explains what the contract checks and where rows that fail it go.
**You will** create a domain and read its validation contract, in about 10
minutes.
**Start from** the project of [lesson 2](https://openlakeforge.dev/docs/tutorial/02-ingest-a-source/): the
`marketing_platform` source exists and `campaigns.csv` holds the five campaign
rows.
## 1. Create the domain
```bash
olf domain new marketing --input marketing_platform/campaigns
```
```text
Created domain 'marketing' with 1 Silver table(s): campaigns.
Domain 'marketing' has no products yet; run `olf product new marketing/` to add one.
```
A domain groups the Silver tables a business area owns. `--input
/` names a Bronze resource to validate into one of them. The
command adds the domain to `lakehouse_code/governance.yml` and creates a Floe
entity for the Silver table `campaigns`, read from `marketing_platform/campaigns`:
```text
lakehouse_code/silver/marketing/
├── __init__.py
├── README.md
├── domain.yml
└── contracts/
└── campaigns.yml
```
It also declares `marketing_platform` in `lakehouse_code/silver/sources.yml`,
the named Bronze sources every domain's entities read from.
## 2. Read the contract
The Floe contract of a domain is split in two. `domain.yml` holds what every
entity of the domain shares:
```yaml
name: "marketing"
entities: "contracts/*.yml"
defaults:
incremental_mode: "none"
sink:
write_mode: "overwrite"
accepted:
format: "iceberg"
path: "marketing/{{entity.name}}"
storage: "lakehouse_silver"
iceberg: { catalog: "iceberg_catalog", namespace: "marketing_silver" }
rejected: { format: "csv", path: "floe/rejected/marketing/{{entity.name}}", storage: "lakehouse_silver" }
policy: { severity: "reject" }
schema:
normalize_columns: { enabled: true, strategy: "snake_case" }
```
Each file in `contracts/` is one entity. `campaigns.yml` names its Bronze
input and the columns inferred from the CSV you wrote in lesson 2:
```yaml
name: "campaigns"
source: { ref: "marketing_platform", resource: "campaigns" }
schema:
primary_key: ["campaign_id"]
columns:
- { name: "campaign_id", type: "string", nullable: false }
- { name: "campaign_date", type: "date", nullable: false }
- { name: "channel", type: "string", nullable: false }
- { name: "spend", type: "number", nullable: false }
- { name: "conversions", type: "integer", nullable: false }
```
Four parts matter:
- **Source and cast mode.** `ref: "marketing_platform"` points at the source in
`sources.yml`, which reads the CSV dlt wrote to Bronze and casts each value
to its column type strictly.
- **Accepted sink.** Rows that satisfy the contract are written to the Iceberg
table `marketing_silver.campaigns`. The namespace is named after the
*domain*, not a product: every `marketing` product shares it.
- **Rejected sink.** With `severity: "reject"`, a row that breaks the contract
goes to the CSV quarantine path `floe/rejected/marketing/campaigns` in the
Silver bucket instead of into Silver. The run still succeeds: Floe reports
it as a run with rejected rows, which is not a technical failure.
- **Columns.** Every column is `nullable: false`, because the scaffold cannot
know which are optional. Loosen a column by hand when a value may be empty.
:::note
Nothing here names a bucket or a catalog endpoint. Dagster runs Floe, one
Kubernetes Job per domain, with a profile it renders for the stage it is
deployed to, so the same contract validates into DEV and PROD.
:::
## Check it worked
```bash
olf check contracts
```
It checks that each domain writes its own `_silver` namespace through
the logical catalog. Among its lines:
```text
[PASS] floe_contract_structure: 19 Floe domain and entity file(s) validated
```
## What you learned
- `olf domain new` declares the Silver namespace and writes its Floe contract
in one step -- domain defaults plus one file per entity -- inferring column
types from the example CSV. The next deploy creates the namespace in the
catalog.
- Rows that satisfy the contract reach `marketing_silver.campaigns`; rows that
do not are quarantined, not dropped and not mixed into Silver.
- Silver is owned by the domain; products consume it.
## Next
[Model Gold with dbt](https://openlakeforge.dev/docs/tutorial/04-model-gold-with-dbt/): build a business mart on top
of Silver.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/03-validate-into-silver.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/03-validate-into-silver.md).
---
# Model Gold with dbt
> This lesson creates the campaign_performance data product with olf product new, writes its dbt model and tests, and deploys it. Gold is the layer that holds…
Source: https://openlakeforge.dev/docs/tutorial/04-model-gold-with-dbt/
This lesson creates the `campaign_performance` data product with `olf product
new`, writes its dbt model and tests, and deploys it. Gold is the layer that
holds business marts, built in SQL by dbt-trino from the Silver tables.
**You will** build one Gold mart from the Silver `campaigns` table and deploy
it, in about 15 minutes.
**Start from** the project of [lesson 3](https://openlakeforge.dev/docs/tutorial/03-validate-into-silver/): the
`marketing` domain and its Floe contract exist.
## 1. Create the product
```bash
olf product new marketing/campaign_performance \
--silver-input campaigns \
--gold-table mart_campaign_performance
```
```text
Created product marketing/campaign_performance with 1 Gold table(s): mart_campaign_performance.
```
`--silver-input` names a Silver table of the domain that the product reads,
and `--gold-table` a mart it produces. The command adds the product to
`lakehouse_code/governance.yml` and creates:
```text
lakehouse_code/
├── gold/
│ ├── dbt_project.yml
│ ├── packages.yml
│ ├── macros/generate_schema_name.sql
│ └── models/
│ ├── _sources/
│ │ └── marketing.yml
│ └── campaign_performance/
│ ├── mart_campaign_performance.sql
│ └── schema.yml
└── pipelines/dagster/campaign_performance.py
```
## 2. Know the generated dbt project
Gold is one dbt project for every product, and `campaign_performance/` is
this product's folder in it. The first product creates the shared files;
the next ones add their folder and a line to `dbt_project.yml`. You do not
edit most of it:
- `dbt_project.yml` materializes every model as an Iceberg table that is
replaced on each run, in the catalog of the stage being deployed. Do not
hard-code Trino hosts or catalog settings in it: OpenLakeForge supplies one
dbt profile whose connection comes from each stage's environment. It also
puts each product's folder in a dbt group of the same name, whose models
other products cannot `ref()` unless they are marked public.
- `macros/generate_schema_name.sql` hands each model's schema to the shared
package, which names it after the product's folder.
- `packages.yml` pulls in the shared OpenLakeForge dbt package. It ships
with OpenLakeForge, not with your project, so the file names it through
`OPENLAKEFORGE_DBT_PACKAGES_DIR`, which `olf` and the project-code image
set.
- `models/_sources/marketing.yml` declares the `marketing` domain's Silver
tables as one dbt source, in the `marketing_silver` schema. Every product of
the domain reads them from there. dbt reads the table Floe owns and does not
build a second staging layer.
Ownership follows the layer: Bronze belongs to dlt, Silver to Floe, Gold to
dbt. The Gold namespace is owned by the product and named after its folder,
with no domain prefix: `campaign_performance_gold`.
## 3. Write the model
The scaffold generated a placeholder that selects everything from Silver.
Replace it with an aggregation by channel:
```bash
cat > lakehouse_code/gold/models/campaign_performance/mart_campaign_performance.sql <<'SQL'
with campaigns as (
select
campaign_id,
cast(campaign_date as date) as campaign_date,
channel,
cast(spend as double) as spend,
cast(conversions as bigint) as conversions
from {{ source('marketing', 'campaigns') }}
)
select
channel,
cast(count(*) as bigint) as campaign_count,
cast(sum(spend) as double) as total_spend,
cast(sum(conversions) as bigint) as total_conversions
from campaigns
group by channel
SQL
```
## 4. Document and test the model
Describe the mart and its columns, and add dbt tests. dbt runs them in the
same `dbt build` that creates the table, so a failing test fails the run.
Keep the `groups` entry the scaffold wrote: it declares the product's dbt
group.
```bash
cat > lakehouse_code/gold/models/campaign_performance/schema.yml <<'YAML'
version: 2
groups:
- name: campaign_performance
owner:
name: campaign_performance
models:
- name: mart_campaign_performance
description: Campaign spend and conversions aggregated by channel.
columns:
- name: channel
description: Marketing channel of the campaigns.
data_tests:
- unique
- not_null
- name: total_spend
description: Sum of campaign spend for the channel.
YAML
```
## 5. Deploy the product
The platform is already running, so deploy only the artifacts phase, which
covers everything derived from `lakehouse_code/`:
```bash
olf infra deploy --provider local --phase artifacts
```
It reconciles the catalog namespaces, builds the project-code image, loads it
into the cluster and restarts the Dagster code location. The namespaces `marketing_silver` and
`campaign_performance_gold` are created for you; no Terraform change is
needed.
## Check it worked
```bash
olf infra e2e run --env local --suite full
```
The suite discovers products from the project, so `campaign_performance` is
included without any registration. It launches every product's job, verifies
the Silver and Gold tables exist and requires rows in every Gold mart,
including `mart_campaign_performance`. It ends with:
```text
Local OpenLakeForge full e2e validation passed.
```
Then look at the rows themselves. `olf infra query` runs SQL against the DEV
stage's catalog, so a table is named `.
`:
```bash
olf infra query "SELECT * FROM campaign_performance_gold.mart_campaign_performance ORDER BY channel"
```
It prints one row per marketing channel, with its `campaign_count`,
`total_spend` and `total_conversions`. Add `--format csv` or `--format json`
for other output.
`olf infra query` runs as the stage's workload user, through your cluster
access. If your deployment signs people in with GitHub
(`spec.identity.issuer: github`), you can run the same query as yourself:
```bash
olf login
olf query "SELECT * FROM campaign_performance_gold.mart_campaign_performance ORDER BY channel"
```
Your role then decides what you read: an `analyst` reads this Gold mart but is
refused the Silver tables beneath it
([Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/#what-each-role-reads-and-writes)).
## What you learned
- `olf product new` creates a product-owned dbt project and a Dagster module
and registers the product in `governance.yml`.
- `olf infra query` reads any Silver or Gold table of a stage from your machine;
`olf query` runs SQL as yourself, limited to what your role reads.
- Gold is plain SQL over declared Silver sources; tests run as part of the
build.
- `olf infra deploy --phase artifacts` ships code changes without touching the
platform.
## Next
[Orchestrate and schedule](https://openlakeforge.dev/docs/tutorial/05-orchestrate-and-schedule/): run the product's
job from Dagster and see how scheduling works.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/04-model-gold-with-dbt.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/04-model-gold-with-dbt.md).
---
# Orchestrate and schedule
> This lesson runs the campaign_performance_pipeline job from Dagster, reruns it, and explains where the recurring schedule of a product comes from.
Source: https://openlakeforge.dev/docs/tutorial/05-orchestrate-and-schedule/
This lesson runs the `campaign_performance_pipeline` job from Dagster, reruns
it, and explains where the recurring schedule of a product comes from.
**You will** launch and rerun your product's job and read its schedule, in
about 10 minutes.
**Start from** the project of [lesson 4](https://openlakeforge.dev/docs/tutorial/04-model-gold-with-dbt/): the
`campaign_performance` product is deployed.
## 1. Read the product definition
Dagster code for a product lives in
`lakehouse_code/pipelines/dagster/campaign_performance.py`, which
`olf product new` generated:
```python
from __future__ import annotations
from openlakeforge_runtime.product_dagster import ProductDefinitionSpec, build_product_definitions
defs = build_product_definitions(ProductDefinitionSpec(domain="marketing", product="campaign_performance"))
```
`build_product_definitions` connects the three layers of the product: the
Bronze loader of `marketing_platform`, the Floe Silver table `campaigns` and
the dbt Gold mart. It reads them from the project: the dbt models are the Gold
assets, the dbt sources are the Silver inputs, and the Floe entity of each
source names its Bronze resource ([Runtime API](https://openlakeforge.dev/docs/reference/runtime-api/)). It also defines the job
`campaign_performance_pipeline`.
`lakehouse_code/definitions.py` finds every module in
`lakehouse_code/pipelines/dagster/` by itself, so you register nothing.
## 2. Launch the job
Open Dagster:
```text
http://dagster-dev.olf.localhost
```
Open **Jobs**, select `campaign_performance_pipeline`, open its **Launchpad**
and select **Launch Run**. The graph runs in order:
```text
marketing_platform/campaigns dlt writes campaigns.csv to Bronze
marketing/campaigns Floe validates it into marketing_silver.campaigns
campaign_performance/mart_campaign_performance
dbt builds and tests the Gold mart
```
Select the Bronze asset to see its `rows`, `bronze_uri` and `source_file`, as
in lesson 1.
## 3. Rerun
Open the finished run and use **Re-execute** to run the same job again. A rerun
is safe: Floe writes Silver with `write_mode: "overwrite"` and dbt replaces
the Gold table, so the tables reflect the current input rather than
accumulating duplicates.
## 4. Know where the schedule comes from
A product's job has no recurring trigger of its own in DEV. The shared
`build_product_definitions` adds a daily schedule named
`campaign_performance_daily` (`0 3 * * *`, UTC), but only in the PROD stage.
It is created stopped, and enabling it is a deliberate act in the Dagster UI.
DEV and UAT stay manual on purpose: the same immutable revision is deployed to
every stage, and a schedule there would be a production-shaped workload on a
development catalog. You add PROD in lesson 9, and the schedule appears in
that stage's Dagster.
## Check it worked
```bash
olf infra e2e run --env local --suite full
```
It launches every product's job, `campaign_performance_pipeline` included,
verifies the Silver and Gold tables, and requires rows in every Gold mart. It
ends with:
```text
Local OpenLakeForge full e2e validation passed.
```
## What you learned
- Each product has one `_pipeline` job that runs Bronze, Silver and
Gold in order.
- Rerunning a job is safe; Silver and Gold are overwritten.
- Recurring schedules belong to PROD, which you add in lesson 9.
## Next
[Publish a dashboard](https://openlakeforge.dev/docs/tutorial/06-publish-a-dashboard/): put Gold marts in front of
analysts in Superset.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/05-orchestrate-and-schedule.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/05-orchestrate-and-schedule.md).
---
# Publish a dashboard
> This lesson switches the project from Slim to the Full preset, which adds Superset, and treats a dashboard as code: you change a chart in the Superset UI…
Source: https://openlakeforge.dev/docs/tutorial/06-publish-a-dashboard/
This lesson switches the project from Slim to the Full preset, which adds
Superset, and treats a dashboard as code: you change a chart in the Superset UI
and export it back into `lakehouse_code/`, where it is versioned like any other
file.
**You will** turn on Superset, edit a demo dashboard and export it, in about
20 minutes.
**Start from** the project of [lesson 5](https://openlakeforge.dev/docs/tutorial/05-orchestrate-and-schedule/): the
`campaign_performance` product is deployed on the Slim preset, and the
end-to-end run of lesson 5 filled every Gold mart. The dashboards in this
lesson are the ones the demo project ships; `campaign_performance` has none
yet.
## 1. Switch to the Full preset
Set `preset: full` under `spec` in `openlakeforge.yaml`:
```yaml
spec:
provider:
type: local
preset: full
```
**Full** adds OpenMetadata (governance and lineage, lesson 7) and Superset
(dashboards) to the Slim data path. The data path itself does not change.
## 2. Deploy the change
```bash
olf infra deploy --provider local
```
`olf infra deploy` applies the change to the running deployment: Terraform adds
OpenMetadata and Superset and leaves the data path, your product and its
tables as they are. The deploy imports every dashboard under
`lakehouse_code/dashboards/superset/` into Superset in its artifacts phase.
## 3. Open Superset
```text
http://superset-dev.olf.localhost
```
With sign-in off, Superset opens already signed in as its local Admin.
Open **Dashboards**: the project ships `Sales Customer Health`, `Sales Order
Revenue` and `Supply Chain Inventory Reliability`, each reading the Gold marts
of its product through the `OpenLakeForge Trino` database.
## 4. Change a chart
Open `Sales Customer Health`, edit the chart `Health Score by Segment`, rename
it `Health Score by Segment (edited)` and save it.
## 5. Export the dashboard as code
Export the dashboard back into its bundle directory, which `olf infra report export`
does for the stage you authored in:
```bash
SUPERSET_REPORT_SOURCE_DIR=lakehouse_code/dashboards/superset/sales_customer_health \
olf infra report export --stage dev
```
`SUPERSET_REPORT_SOURCE_DIR` picks the bundle; without it the command exports
the first dashboard bundle it finds. The bundle's YAML files,
charts, datasets and the Trino database, are rewritten under that directory:
```bash
grep -rl "(edited)" lakehouse_code/dashboards/superset/sales_customer_health
```
The export keeps the bundle stage-neutral: it replaces DEV's live Trino
connection with a placeholder that each deploy rewrites, so the same bundle can
be promoted to PROD.
A directory is a promotable report once the export has written its
`metadata.yaml`. Its datasets name the Gold schema they read, which is how
OpenLakeForge knows the products the dashboard serves. One dashboard can
consume several products. The next `olf infra deploy` (or `olf infra
report import`) imports the bundle into Superset, and `olf infra project build`
packages it into a project revision.
## Check it worked
```bash
olf report validate
```
It checks every bundle for stable identities, resolvable references and no
stage-bound values, and prints:
```text
3 report bundle(s) are promotable.
```
## What you learned
- `spec.preset: full` plus `olf infra deploy` adds Superset and OpenMetadata in place;
the deploy imports every dashboard bundle in the project.
- Dashboards live in `lakehouse_code/dashboards/superset//` and are
found by their `metadata.yaml`; their datasets name the products they read.
- `olf infra report export` pulls UI edits into git; `olf infra report import` and `olf infra
deploy` push the bundle back.
## Next
Govern and trace lineage (lesson 7): see the same project's domains, data
products and lineage in OpenMetadata.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/06-publish-a-dashboard.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/06-publish-a-dashboard.md).
---
# Govern and trace lineage
> This lesson opens OpenMetadata, which the Full preset deploys, and follows the domains, data products and lineage that OpenLakeForge fills in from your project.
Source: https://openlakeforge.dev/docs/tutorial/07-govern-and-trace-lineage/
This lesson opens OpenMetadata, which the Full preset deploys, and follows the
domains, data products and lineage that OpenLakeForge fills in from your
project.
**You will** find your `marketing` domain and `campaign_performance` product
in OpenMetadata and trace a Gold table back to Bronze, in about 15 minutes.
**Start from** the project of [lesson 6](https://openlakeforge.dev/docs/tutorial/06-publish-a-dashboard/): the Full
preset is deployed and every product's job has run once (the end-to-end run of
[lesson 5](https://openlakeforge.dev/docs/tutorial/05-orchestrate-and-schedule/) did it).
## 1. Open OpenMetadata
```text
http://openmetadata.olf.localhost
```
Sign in as `admin@open-metadata.org`. The deployment generated the password
into Secret `openmetadata-admin`; read it with:
```bash
kubectl -n olf-system get secret openmetadata-admin -o jsonpath='{.data.admin-password}' | base64 -d
```
## 2. Find the domain and data product
You wrote no OpenMetadata configuration. The artifacts phase of `olf infra deploy`
reads `lakehouse_code/governance.yml` and creates:
| governance.yml | OpenMetadata |
| --- | --- |
| A domain such as `marketing` | A domain, shown as `Marketing` |
| A product such as `campaign_performance` | A data product named `campaign_performance`, shown as `Campaign Performance`, inside that domain |
In the left menu, open **Domains** and select `Marketing`. Its data product
`Campaign Performance` is listed, with the description from `governance.yml`.
To change either, edit that file and run `olf infra deploy --provider local --phase
artifacts`.
## 3. Find the tables
OpenMetadata crawls the Iceberg catalog through Trino, so every Silver and
Gold table is listed under the database of your stage, `lakehouse_dev`.
Search for `mart_campaign_performance`. Its full name is
`polaris.lakehouse_dev.campaign_performance_gold.mart_campaign_performance`.
## 4. Trace the lineage
Open the table and select its **Lineage** tab. Floe and dbt each emit
OpenLineage events to OpenMetadata every time the job runs, so the graph shows
the Silver table `marketing_silver.campaigns` feeding the Gold mart. Nothing
in your project turns this on.
:::note
Lineage appears after a job has run. If the tab is empty, launch
`campaign_performance_pipeline` in Dagster again and refresh.
:::
## Check it worked
```bash
olf infra e2e run --env local --suite full
```
With the Full preset the suite also checks OpenMetadata: it requires every
domain and data product from `governance.yml`, and the Gold lineage of the
stage. It ends with:
```text
Local OpenLakeForge full e2e validation passed.
```
## What you learned
- Governance metadata is derived from `governance.yml`: one OpenMetadata domain
per domain, one data product per product.
- Lineage comes from the runs themselves, through Floe and dbt, not from
configuration.
- Change names and descriptions in the descriptor and redeploy the artifacts.
## Next
[Sign in with GitHub](https://openlakeforge.dev/docs/tutorial/08-sign-in-with-github/): control who may open these
services.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/07-govern-and-trace-lineage.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/07-govern-and-trace-lineage.md).
---
# Sign in with GitHub
> This lesson turns sign-in on for the local deployment. People sign in with GitHub, and the GitHub team they belong to decides which services they can open.
Source: https://openlakeforge.dev/docs/tutorial/08-sign-in-with-github/
This lesson turns sign-in on for the local deployment. People sign in with
GitHub, and the GitHub team they belong to decides which services they can
open.
**You will** add `spec.identity` to the profile, create and install a GitHub
App during `olf infra deploy`, and sign in as an analyst, in about 25 minutes.
**Start from** the project of [lesson 7](https://openlakeforge.dev/docs/tutorial/07-govern-and-trace-lineage/): the
Full preset on a local deployment, so that Superset, Dagster and OpenMetadata
all run. You also need a GitHub organization where you can create teams and
install an app, and a GitHub account that is a member of it.
## How sign-in works
Without `spec.identity`, authentication is off and every service opens with
administrator rights. With it, a sign-in perimeter sits in front of every
service. The perimeter sends people to Dex, which asks GitHub who they are and
which of the mapped teams they belong to, and the highest role among those
teams is the role they get.
The four roles, highest first, are `platform-admin`, `data-engineer`,
`analyst` and `viewer`. The rights per service are in
[Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/). Owning the
GitHub organization grants nothing: only members of a mapped team can sign in.
## 1. Create the teams
In your GitHub organization, create four teams. The slugs below are the ones
this lesson uses; any slugs work if the profile names them:
| Team | Role |
| --- | --- |
| `olf-platform-admins` | `platform-admin` |
| `olf-data-engineers` | `data-engineer` |
| `olf-analysts` | `analyst` |
| `olf-viewers` | `viewer` |
Add your own account to `olf-platform-admins` for now.
## 2. Add `spec.identity`
Keep the profile from the earlier lessons and add the `identity` block under
`spec`. Replace `my-org` with the organization login exactly as GitHub shows
it, case included:
```yaml
spec:
access:
tls: none
identity:
issuer: github
github:
organization: my-org
teams:
platform-admin: [olf-platform-admins]
data-engineer: [olf-data-engineers]
analyst: [olf-analysts]
viewer: [olf-viewers]
oauth_app_secret_ref:
name: github-oauth-app
```
`oauth_app_secret_ref` names the Kubernetes Secret that will hold the GitHub
App's credentials. You do not create it: the next step does. A role you leave
out of `teams` is held by nobody. Every field is in the
[Deployment Profile reference](https://openlakeforge.dev/docs/reference/deployment-profile/#specidentity).
```bash
olf profile validate --project .
```
## 3. Deploy and connect GitHub
This lesson turns sign-in on for a fresh deployment. Start it clean:
```bash
olf infra destroy --provider local
olf infra deploy --provider local
```
Switching an existing authentication-off stack to GitHub sign-in in place is
not covered yet.
The GitHub step comes first, while you are still at the terminal:
1. `olf infra deploy` notices that the Secret `github-oauth-app` does not exist and
prints a URL to confirm a GitHub App. The browser opens on it; on WSL the
URL is opened through Windows when `explorer.exe` is available. Either way
the URL is printed, so you can open it yourself.
2. In the browser, select **Create GitHub App**. The app is created in your
organization, private to it, with read access to members and email
addresses.
3. GitHub sends the browser back to `olf`, which stores the app's credentials
in the Secret and sends the browser on to the app's install page.
4. On the install page, install the app on your organization.
`olf infra deploy` waits up to 15 minutes for step 2. After that it runs unattended
and no further input is needed. It only asks in an interactive terminal; in CI
it fails on a missing Secret instead, and `--no-github-connect` does the same
by choice. Credentials are never printed.
The deployment ends with the portal URL and the state of the app:
```text
GitHub App installed on my-org
```
If it prints `Install the GitHub App on my-org: ` instead, open the link
and install the app. Without the installation, nobody can sign in. To run the
GitHub step on its own later, see
[Connect GitHub](https://openlakeforge.dev/docs/guides/identity/connect-github/).
## 4. Sign in on the portal
Open a private browser window on the portal:
```text
http://olf.localhost
```
You are sent to GitHub, then back through Dex to the portal, with no password
prompt from OpenLakeForge: GitHub owns your password and two-factor
authentication. The portal lists the services. As `platform-admin` you can open
all of them, and the portal links to the organization's teams page in GitHub,
where membership is managed.
:::note
Open a fresh private window for each sign-in below. A browser that keeps a
session keeps the role it was signed in with until the session refreshes.
:::
## 5. What each role sees
Move your account between teams in GitHub (organization, Teams) and sign in
again to see each role. The portal, Dagster, Trino UI and Superset follow at
sign-in. OpenMetadata roles come from a role sync that runs every 5 minutes,
not from sign-in: wait for it, or run it now:
```bash
export KUBECONFIG="$HOME/.openlakeforge/state/local/kubeconfig.yaml"
"$(olf toolchain path kubectl)" -n olf-system create job --from=cronjob/openmetadata-role-sync role-sync-now
```
Use a new job name each time you run it.
| Role | Superset | Dagster | Trino UI | OpenMetadata |
| --- | --- | --- | --- | --- |
| `platform-admin` | `Admin` | opens | opens | `Admin` |
| `data-engineer` | `Alpha` | opens | opens | `write` |
| `analyst` | `Gamma` | denied | denied | `read` |
| `viewer` | read-only | denied | denied | `read` |
A service the role does not open answers with an "Access is role-restricted"
page and a link back to the portal.
## 6. Plain HTTP or HTTPS
The default profile serves plain HTTP on `*.olf.localhost` (`tls: none`).
It needs no certificate step, and it is allowed only on a `*.localhost`
domain, which is reachable from your machine alone. Sign-in works over it.
To serve HTTPS, name the platform's own CA as the issuer:
```yaml
spec:
access:
tls: local-ca
```
Run `olf infra deploy --provider local` again, then trust the CA in your browser:
```bash
olf infra access trust
```
It writes the CA certificate and prints the commands for your platform. Skip
it and the browser warns on every host.
Trino has no sign-in of its own: every caller sends its own token, and Polaris
decides what each query reads. The Trino UI opens as a fixed user behind the
perimeter, which admits data engineers and platform admins.
The GitHub App records the callback URL for the scheme it was created with.
After switching scheme, run `olf infra secrets rotate github-app` to register an app
with the new URL, and install it again.
## 7. Authentication off
A profile with no `spec.identity` runs with authentication off: every service
opens with administrator rights and nobody signs in. `olf` allows that only
where nothing is published beyond your machine: on a `*.localhost` domain
locally, and on AWS or Azure without `spec.access`. It is what `olf init`
writes, and what lessons 1 to 7 used.
:::caution
Once OpenMetadata has been deployed with sign-in on, removing
`spec.identity` does not bring back its `admin@open-metadata.org` login.
Destroy and recreate the deployment to go back.
:::
## 8. Try the access model
This procedure uses one GitHub account that plays every role by moving between
teams. Your account must be in `olf-platform-admins` only at the start. Use a
fresh private window for each sign-in.
1. **The admin adds an analyst.** In GitHub, move your account from
`olf-platform-admins` to `olf-analysts`. Note the time.
2. **The analyst signs in.** Open the portal (`http://olf.localhost`, or `https://olf.localhost` if you switched to HTTPS). You pass through
GitHub and Dex to the portal, with no password prompt, and the portal lists
the services.
3. **The analyst reaches Superset.** Open it from the portal. It opens signed
in, with no login form. Open a dashboard and check it renders.
4. **The analyst is denied Dagster.** Open Dagster from the portal. The page
answers 403 "Access is role-restricted", with a link back to the portal.
The Trino UI is denied the same way.
5. **A user outside the teams is denied.** Remove your account from every
OpenLakeForge team. If you own the organization, you stay an owner, and
that is the point. Sign in from a fresh window. The sign-in is refused, with
Dex's page explaining why, and no session exists.
6. **A removed member loses access.** Add your account back to
`olf-analysts` and sign in. Then remove it from the team without signing
out. At the first request at least 4 minutes after your sign-in or the last
refresh, the perimeter re-reads your teams and refuses you. Note the time
from removal to refusal; it stays within about 5 minutes.
7. **Automation is unaffected.** While you try the steps above,
`olf infra e2e run --env local` still passes, and the OpenMetadata ingestion and
dbt runs keep working. They use service credentials, not a person's
session.
When you finish, put your account back in `olf-platform-admins`.
## Sign out
Select **Sign out** in the portal header to end your session on every service
behind the perimeter. It clears the perimeter cookie and lands on a "signed
out" page. Superset keeps its own session: its Logout menu item does the same. GitHub's session
stays open, so signing in again usually does not prompt; Dex re-reads your teams
at each sign-in.
The easy alternative is a private window: closing it drops every cookie. A team
change also takes effect without signing out, within the 5-minute refresh
bound described in [Add, change or remove a
member](https://openlakeforge.dev/docs/guides/identity/manage-members/#how-fast-a-change-takes-effect).
## Check it worked
This lesson ends on a person's access, so check it in the browser. Signed in
as an analyst, Superset opens and renders a dashboard, and Dagster answers
"Access is role-restricted". Signed in with an account that is in no mapped
team, GitHub's sign-in is followed by Dex's refusal page, which links to the
[troubleshooting steps](https://openlakeforge.dev/docs/guides/identity/connect-github/#troubleshooting).
## What you learned
- `spec.identity` turns sign-in on; a GitHub team decides each person's role.
- `olf infra deploy` creates and stores the GitHub App for you, then you install it
on the organization.
- Membership is managed in GitHub, and a removed member is refused within
minutes, not at the next deploy.
- Plain HTTP is the default locally; `tls: local-ca` with `olf infra access trust`
gives HTTPS.
## Next
[Add PROD and promote a revision](https://openlakeforge.dev/docs/tutorial/09-add-prod-and-promote/). To manage
members, rotate secrets or recover when GitHub is unreachable, see the
[identity guides](https://openlakeforge.dev/docs/guides/identity/connect-github/).
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/08-sign-in-with-github.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/08-sign-in-with-github.md).
---
# Add PROD and promote a revision
> This lesson adds a PROD stage to the project, builds the project once into an immutable revision, activates that revision in DEV and then unchanged in PROD,…
Source: https://openlakeforge.dev/docs/tutorial/09-add-prod-and-promote/
This lesson adds a PROD stage to the project, builds the project once into an
immutable revision, activates that revision in DEV and then unchanged in PROD,
and shows the GitHub Actions that automate those steps.
**You will** run a project through DEV and PROD and see the PROD-only
schedule, in about 30 minutes.
**Start from** the project of [lesson 8](https://openlakeforge.dev/docs/tutorial/08-sign-in-with-github/): the Full
preset on a local deployment with GitHub sign-in on. You also need an account
on a container registry such as GHCR or Docker Hub.
## How stages work
A Deployment Profile can enable `dev`, an optional `uat` and `prod`. Every
stage runs in the same cluster, in its own `olf-` namespace with its own
Dagster (and Superset with the Full preset), its own buckets and its own
`lakehouse_` catalog. The platform services in `olf-system` are shared.
A change is built **once** into an immutable project revision: the project's
code plus one image pinned by digest. That revision is activated in DEV,
validated, and then activated unchanged in PROD. PROD never rebuilds, and no
data is copied between stages: each stage computes from its own Bronze.
## 1. Enable the PROD stage
Add `prod` under `spec.stages` in `openlakeforge.yaml`:
```yaml
spec:
stages:
dev:
enabled: true
prod:
enabled: true
```
Then create the namespaces, buckets and catalogs for every enabled stage:
```bash
olf infra platform apply -f openlakeforge.yaml
```
## 2. Choose a registry
A revision is identified by an image digest, and an image built straight into
kind has none. Local runs therefore push to a registry you control:
```bash
export PROJECT_CODE_IMAGE_REPOSITORY=ghcr.io//project-code
export PROJECT_CODE_IMAGE_TAG=dev
docker login ghcr.io # or docker.io
```
## 3. Build the revision once
```bash
IMAGE="$(olf infra project image -f openlakeforge.yaml | tee /dev/stderr | tail -n 1)"
```
It builds the project-code image, pushes it and loads it into kind, showing its
progress, and ends with a digest-pinned reference,
`@sha256:`. `tail -n 1` keeps only that last line in
`IMAGE`. Build the revision from it the same way:
```bash
REVISION="$(olf infra project build --project . --image "$IMAGE" | tee /dev/stderr | tail -n 1)"
echo "$REVISION"
```
It prints the revision id, `sha256:`. The revision freezes your
descriptors, Floe contracts, dbt projects, Dagster code, reports and the image
digest.
## 4. Activate it in DEV, then in PROD
Activate it in DEV and validate it there first:
```bash
olf infra project deploy -f openlakeforge.yaml --stage dev --revision "$REVISION"
olf infra e2e run --env local -f openlakeforge.yaml --stage dev --suite full
```
Only when DEV passes, activate the same revision in PROD:
```bash
olf infra project deploy -f openlakeforge.yaml --stage prod --revision "$REVISION"
```
Activation reconciles the stage's catalog namespaces, activates its Floe
revision, imports its reports and metadata, and rolls out its Dagster code
location. It never rebuilds source.
## 5. Find the schedule
Open the PROD Dagster, listed under `URLs` by `olf infra status --provider local`,
and open the **Automation** or **Schedules** page. The schedule
`campaign_performance_daily` (`0 3 * * *`, UTC) exists in PROD only, and it is
stopped: deploying a revision never starts it. Switch it on there when you want
recurring runs. DEV has no schedules.
## 6. Automate with the CI actions
OpenLakeForge ships two composite GitHub Actions. Each is a few `olf`
commands, so any CI can run the same ones:
| Action | Does |
| --- | --- |
| `OpenLakeForge/openlakeforge/.github/actions/build-revision` | `olf infra project image`, then `olf infra project build`; outputs `image` and `revision` |
| `OpenLakeForge/openlakeforge/.github/actions/deploy-stage` | `olf infra project deploy --stage --revision `, fails unless `olf infra project status` records exactly ``, and optionally runs `olf infra e2e run --suite full` |
Behaviour follows the stage and revision you pass, never the branch name. A
workflow runs `build-revision` once, then `deploy-stage` for DEV, then for PROD
behind a GitHub environment with required reviewers, so the PROD activation
waits for approval. The complete workflow, the runner it needs and how to
protect the `prod` environment are in
[CI/CD and environment promotion](https://openlakeforge.dev/docs/guides/promote-dev-to-prod/#automate-with-github-actions).
## Check it worked
```bash
olf infra e2e run --env local -f openlakeforge.yaml --stage prod --suite full
```
It validates PROD with the topology the profile recorded: it launches every
product's job in the PROD Dagster and requires rows in every Gold mart of the
`lakehouse_prod` catalog. It ends with:
```text
Local OpenLakeForge full e2e validation passed.
```
## What you learned
- Stages share a cluster but not data: each has its own namespace, buckets
and catalog.
- You build one revision and activate that same revision in every stage.
- Schedules exist only in PROD, and start stopped.
- The two CI actions are thin wrappers over `olf infra project image`, `build` and
`deploy`.
## Next
[Deploy to the cloud](https://openlakeforge.dev/docs/tutorial/10-deploy-to-the-cloud/): run the same project on AWS.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/09-add-prod-and-promote.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/09-add-prod-and-promote.md).
---
# Deploy to the cloud
> This lesson runs the same project on AWS: EKS for Kubernetes, ECR for images, S3 for storage, RDS PostgreSQL for service state and AWS Glue as the Iceberg…
Source: https://openlakeforge.dev/docs/tutorial/10-deploy-to-the-cloud/
This lesson runs the same project on AWS: EKS for Kubernetes, ECR for images,
S3 for storage, RDS PostgreSQL for service state and AWS Glue as the Iceberg
catalog.
**You will** deploy the project you built to your own AWS account and
validate it, in about 60 minutes plus the time AWS needs to create the
cluster.
**Start from** the project of [lesson 9](https://openlakeforge.dev/docs/tutorial/09-add-prod-and-promote/), and an
AWS account that meets the
[prerequisites of the AWS guide](https://openlakeforge.dev/docs/guides/cloud/deploy-to-aws/#prerequisites).
Your `lakehouse_code/` does not change: only the Deployment Profile does.
:::caution
This creates billable AWS resources and is not production-hardened. Run the
teardown step when you are done. The limits are listed in
[Deploy to AWS](https://openlakeforge.dev/docs/guides/cloud/deploy-to-aws/#limitations-and-costs).
:::
## 1. Point the profile at AWS
In `openlakeforge.yaml`, set the provider and the region, keep only the DEV
stage, and remove the `access:` and `identity:` blocks:
```yaml
spec:
provider:
type: aws
region: eu-west-1
stages:
dev:
enabled: true
```
The cloud deployment is validated with one stage, so the DEV-to-PROD promotion
of lesson 9 stays on your local platform. The cloud deployment publishes no
routes, so there is no sign-in: you reach its services with `olf infra forward`, and
an `access:` block would require `identity:`.
```bash
olf profile validate --project .
```
## 2. Authenticate
```bash
olf infra auth login --provider aws
```
It reuses your `default` AWS profile, or asks for your IAM Identity Center
start URL and region. The other sign-in options are in
[Deploy to AWS](https://openlakeforge.dev/docs/guides/cloud/deploy-to-aws/#1-authenticate). The cloud
pushes your image to its own ECR registry, so clear the registry settings of
lesson 9:
```bash
unset PROJECT_CODE_IMAGE_REPOSITORY PROJECT_CODE_IMAGE_TAG
```
## 3. Deploy
The same phases you used locally:
```bash
olf infra deploy --provider aws --phase foundation # VPC, EKS, ECR, IAM
olf infra deploy --provider aws --phase platform # S3, Glue, RDS, Trino, Dagster, Superset, OpenMetadata
olf infra deploy --provider aws --phase artifacts # build and push images, load your code
```
The cloud has no public endpoint. To open the services, port-forward them to
your machine, then stop with Ctrl-C; Dagster is at `http://localhost:3000`:
```bash
olf infra forward --provider aws
```
## Check it worked
Stop `olf infra forward` first: run one `olf` command at a time.
```bash
olf infra e2e run --env aws
```
It launches every product's job on EKS and verifies the Silver and Gold
tables, the dashboards and OpenMetadata. It ends with a line of the form
` OpenLakeForge e2e validation passed.`
## Tear down
```bash
olf infra destroy --provider aws
```
On Azure the steps are the same with `--provider azure`, plus a variables file
for the resource group and node size; see
[Deploy to Azure](https://openlakeforge.dev/docs/guides/cloud/deploy-to-azure/).
## What you learned
- The project does not change between local, AWS and Azure; the profile's
provider does.
- A cloud deploy is the same foundation, platform and artifacts phases.
- Cloud services are reached with `olf infra forward`, and `olf infra e2e run --env aws`
validates them.
## Next
- [Deploy to AWS](https://openlakeforge.dev/docs/guides/cloud/deploy-to-aws/): every option, the
limitations and the costs.
- [CI/CD and environment promotion](https://openlakeforge.dev/docs/guides/promote-dev-to-prod/): build
and deploy revisions from CI.
- [Architecture](https://openlakeforge.dev/docs/architecture/overview/): how the same project runs on
each provider.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/tutorial/10-deploy-to-the-cloud.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/tutorial/10-deploy-to-the-cloud.md).
---
# Install and configure a local deployment
> The options around a local OpenLakeForge deployment: how to install olf, create a project, choose a preset, reach the services over HTTP or HTTPS, and tear…
Source: https://openlakeforge.dev/docs/guides/local-installation/
The options around a local OpenLakeForge deployment: how to install `olf`,
create a project, choose a preset, reach the services over HTTP or HTTPS, and
tear everything down. For the shortest path, follow the
[Quickstart](https://openlakeforge.dev/docs/get-started/quickstart/) instead.
The local platform runs in a [kind](https://kind.sigs.k8s.io/) cluster on your
Docker engine. It does not touch your own `~/.kube/config`, and it is local
evaluation infrastructure: do not expose it beyond your workstation.
## Requirements
| You need | Check |
| --- | --- |
| A running Docker engine | `docker ps` succeeds |
| Python 3.12 or newer, or [uv](https://docs.astral.sh/uv/) | `python3.12 --version` or `uv --version` |
| Ports 80 and 443 free on `127.0.0.1` | Nothing else serves `http://localhost` |
Terraform, Helm, kubectl and kind are not prerequisites: `olf` downloads the
versions pinned in the release and keeps them under `~/.openlakeforge`.
### On WSL2
WSL2 already sets its clock from Windows. If `systemd-timesyncd` also runs, the
two fight and the clock steps back every half minute, which makes Polaris
reject tokens and Trino fail at random with `Not authorized`. Check, and stop
the second service once:
```bash
systemctl is-active systemd-timesyncd # "active" means it must be stopped
sudo systemctl disable --now systemd-timesyncd
```
`olf infra doctor` reports this as `WSL clock`, and a local deploy warns about
it. See [Trino fails at random with Not authorized on
WSL2](https://openlakeforge.dev/docs/guides/troubleshooting/#trino-fails-at-random-with-not-authorized-on-wsl2).
The step goes away once the platform moves to a Polaris release that tolerates
the skew (#941).
### Hardware
The resources Docker can use, not the whole machine:
| Deployment | CPU | Memory | Free disk |
| --- | --- | --- | --- |
| Slim, one stage (the Quickstart) | 4 | 16 GB | not yet measured; less than Full |
| Full, DEV and PROD | 4 | 16 GB | 100 GB |
These are the tested sizes; smaller machines are untested. The CI Slim smoke test and the nightly Full
DEV+PROD deployment both pass on a GitHub-hosted runner with 4 vCPUs and 16 GB
of memory. With Full and two stages running, the host used about 9 GB of
memory and Docker held about 100 GB: about 15 GB of images and about 84 GB in
the three kind nodes' volumes, which keep a copy of every image. On Docker
Desktop, raise its memory and disk limits to these values.
## Install `olf`
With uv, which fetches Python 3.12 if your machine has none:
```bash
uv tool install "openlakeforge==0.6.0a3" --python 3.12
```
Or with pip, in a virtual environment:
```bash
python3.12 -m venv ~/.venvs/olf
source ~/.venvs/olf/bin/activate
python3.12 -m pip install "openlakeforge==0.6.0a3"
```
With pip, activate the environment again in each new shell. Check the install
with `olf version`.
### Toolchain mode
`OLF_TOOLCHAIN_MODE` decides where `olf` finds Terraform, Helm, kubectl and
kind. Docker is always yours.
| Mode | Behaviour |
| --- | --- |
| `managed` (default) | Downloads and verifies the pinned versions under `~/.openlakeforge`. Never changes your `PATH`. |
| `host` | Uses the tools on your `PATH`, for a machine that cannot download them. |
`OLF_HOME` moves the toolchain, the platform payload and `olf`'s state away
from `~/.openlakeforge`. `olf toolchain list` shows what is installed and
`olf toolchain install` downloads everything in advance.
## Create a project
Run `olf init` in an empty directory:
```bash
mkdir my-lakehouse && cd my-lakehouse
olf init
```
It writes `openlakeforge.yaml`, the Deployment Profile, and `lakehouse_code/`
with three demo data products. The profile enables one DEV stage on the Slim
preset, with plain HTTP and no sign-in. `olf init` refuses to overwrite either.
| Option | Effect |
| --- | --- |
| `--stages dev,prod` | Enable other stages: `dev`, `dev,prod` or `dev,uat,prod`. |
| `--preset full` | Add Superset and OpenMetadata to the Slim data path. |
| `--name ` | Name the profile something other than the directory. |
| `--profile-only` | Write only `openlakeforge.yaml`, into an existing project. |
| `--empty` | Skip the demo products. |
An `--empty` project cannot deploy until it holds a source and a product.
Scaffold them first:
```bash
olf source new crm --resource accounts
olf product new sales/accounts_report --input crm/accounts --gold-table mart_accounts
```
## Deploy
```bash
olf infra deploy
```
The first deploy takes several minutes while images download. `olf infra deploy`
runs four phases in order; `--phase` runs one of them:
| Phase | What it does | Rerun it when |
| --- | --- | --- |
| `foundation` | Creates the kind cluster `openlakeforge-local` (one control plane, two workers) | The cluster was deleted |
| `prefetch` | Pulls the large runtime images into the kind nodes | An image pull failed or timed out |
| `platform` | Deploys the shared services and one namespace per stage with Terraform and Helm | You changed the preset or the stages |
| `artifacts` | Builds the project-code image from `lakehouse_code/` and deploys your data products | You changed code under `lakehouse_code/` |
Every phase reconciles what already exists, so running it again is safe.
## Choose Slim or Full
| Preset | Includes |
| --- | --- |
| `slim` (default) | dlt, Floe, Iceberg, Polaris, Trino, dbt and Dagster: the whole ingestion-to-Gold path |
| `full` | Slim plus OpenMetadata (governance, lineage) and Superset (dashboards) |
Set `preset: full` under `spec` in `openlakeforge.yaml` and run
`olf infra deploy` again. The change applies in place: nothing
already deployed is removed. Setting `preset: slim` removes the two services
the same way.
## Local defaults
| Setting | Default | Change it with |
| --- | --- | --- |
| Cluster | `openlakeforge-local` | `--cluster-name` |
| Kube context | `kind-openlakeforge-local` | follows the cluster name |
| Kubeconfig | `~/.openlakeforge/state/local/kubeconfig.yaml` | `--kubeconfig-path` |
| Shared services | namespace `olf-system` | |
| Stage services | namespace `olf-`, one per enabled stage | `spec.stages` in the profile |
| Stage selected by `olf` commands | `dev` | `--stage` |
In a source checkout of the repository, the kubeconfig is
`.tmp/kubeconfigs/local.yaml` instead.
## Access the services
```bash
olf infra status
```
The `URLs` section lists every service. With the default profile:
| Service | URL |
| --- | --- |
| Portal, linking every service | `http://olf.localhost` |
| Dagster, per stage | `http://dagster-dev.olf.localhost` |
| Trino, per stage | `http://trino-dev.olf.localhost` |
| Superset, per stage (Full) | `http://superset-dev.olf.localhost` |
| OpenMetadata (Full) | `http://openmetadata.olf.localhost` |
Browsers resolve every `*.localhost` name to your machine. Command-line tools
often do not; `olf` pins them itself, and for `curl` pass `--resolve`:
```bash
curl --resolve dagster-dev.olf.localhost:80:127.0.0.1 http://dagster-dev.olf.localhost/server_info
```
With sign-in off, Superset opens as its local Admin and OpenMetadata accepts
`admin@open-metadata.org` with the password in Secret `openmetadata-admin`:
```bash
kubectl -n olf-system get secret openmetadata-admin -o jsonpath='{.data.admin-password}' | base64 -d
```
Over plain HTTP, the Trino Web UI shows a
fixed user, `olf-web`, instead of a login form; per-person identity in the UI
needs HTTPS (#425). To require sign-in, see
[Connect GitHub](https://openlakeforge.dev/docs/guides/identity/connect-github/).
### Serve HTTPS
`spec.access.tls` defaults to `none`, which serves plain HTTP, and `olf init`
writes it out. To serve HTTPS from a local certificate authority (CA), set
`tls: local-ca` and deploy again:
```yaml
spec:
access:
tls: local-ca
```
`olf infra deploy` creates the CA once, in the cluster (it is there with plain HTTP
too, for the pods that call Trino over HTTPS). Your browser rejects the
routes until it trusts that CA. Export it and print the trust commands for
your system:
```bash
olf infra access trust
```
It writes `openlakeforge-local-ca.crt` and prints the commands for Linux,
macOS or WSL2; each needs your own privileges, so `olf` prints rather than runs
them. Firefox keeps its own store: Settings, Privacy & Security, View
Certificates, Authorities, Import. On WSL2 the CA must go into the Windows
store, because the browser runs on Windows.
### Reach Polaris and SeaweedFS
Polaris and SeaweedFS have no route. `olf infra forward` port-forwards every service
to fixed ports on `localhost` until you press Ctrl-C:
```bash
olf infra forward
```
| Port | Service |
| ---: | --- |
| 3000 | Dagster |
| 8080 | Trino |
| 8088 | Superset (Full) |
| 8181 | Polaris API |
| 8585 | OpenMetadata (Full) |
| 8888 | SeaweedFS Filer UI |
| 9000 | SeaweedFS S3 API |
| 9333 | SeaweedFS Master UI |
`OLF_PORT_FORWARD=1` makes `olf`'s own commands, such as `olf infra e2e run`,
port-forward instead of using the ingress, for example while you debug it.
## Try a portal preview image
To test a portal change before it is released, deploy a preview image published
by the portal repository's CI for a pull request. The portal is deployed only
when the profile has `spec.access`. The image replaces the pinned portal image
until you deploy again without it.
1. Take the preview image's digest from the portal pull request.
2. Write `portal-preview.tfvars` in the project root, with `` the pull
request number and `` the 64 hex digits after `sha256:`:
```hcl
portal_image = "ghcr.io/openlakeforge/openlakeforge-portal:pr-@sha256:"
```
3. Deploy with the file:
```bash
olf infra deploy --var-file portal-preview.tfvars
```
4. To go back to the pinned image, deploy without the file:
```bash
olf infra deploy
```
The reference must be pinned by digest, or Terraform refuses the plan. `olf`
does not prefetch this image: the kind nodes pull it from the registry.
## Tear down
```bash
olf infra destroy
```
It destroys the platform services, then the kind cluster. The cluster holds
all state, so this deletes your Bronze, Silver and Gold data and Dagster's run
history. `openlakeforge.yaml` and `lakehouse_code/` are not touched, and the
next `olf infra deploy` rebuilds the same platform from them. With HTTPS, a rebuilt
cluster has a new CA: run `olf infra access trust` again.
| To remove | Run |
| --- | --- |
| Only the platform, keeping the cluster | `olf infra destroy --phase platform` |
| Only the cluster, after the platform | `olf infra destroy --phase foundation` |
| The managed toolchain under `~/.openlakeforge` | `olf toolchain clean --all` |
`--phase foundation` refuses to run while platform namespaces exist; `--force`
overrides that and loses them. After `--phase platform`, bring the platform
back with `olf infra deploy --phase platform`, then
`--phase artifacts`.
## Contributor checkout
To work on OpenLakeForge itself, clone the repository and run the same
commands through uv from its root:
```bash
git clone https://github.com/OpenLakeForge/openlakeforge.git
cd openlakeforge
uv run --project tools/olf --locked olf infra deploy
```
The contributor workflow and its gates are in
[AGENTS.md](https://github.com/OpenLakeForge/openlakeforge/blob/v0.6.0-alpha.3/AGENTS.md).
## Check it worked
```bash
olf infra e2e run --env local --suite full
```
It launches every product's job and checks the Silver and Gold tables through
Trino; on Full it also checks Superset and OpenMetadata. It ends with
`Local OpenLakeForge full e2e validation passed.`
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/local-installation.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/local-installation.md).
---
# Build and manage data products
> How to add sources, domains, data products, resources and Gold models to a project, how their names line up, and how to check and deploy a change. For a…
Source: https://openlakeforge.dev/docs/guides/data-products/
How to add sources, domains, data products, resources and Gold models to a
project, how their names line up, and how to check and deploy a change. For a
guided first walkthrough of the same steps, follow the
[tutorial](https://openlakeforge.dev/docs/tutorial/02-ingest-a-source/).
Run every command from the project directory, on a deployed local platform.
The examples use the source `marketing_platform`, the domain `marketing` and
the product `campaign_performance`.
## How a project is laid out
Ownership follows the medallion layer:
| Layer | Owned by | Directory | Built by |
| --- | --- | --- | --- |
| Bronze | A source | `lakehouse_code/bronze//` | dlt |
| Silver | A domain | `lakehouse_code/silver//` | Floe |
| Gold | A data product | `lakehouse_code/gold/models//` | dbt-trino |
| Dashboards | A dashboard | `lakehouse_code/dashboards/superset//` | Superset |
`lakehouse_code/governance.yml` names the domains and, nested under each, its
products; each source has a `source.yaml`, and each dashboard is a bundle directory. OpenLakeForge
derives every platform name from these, so you never create catalog namespaces
or edit Terraform to register a product:
| Derived name | Example | Shared by |
| --- | --- | --- |
| Silver namespace `_silver` | `marketing_silver` | Every product of the domain |
| Gold namespace `_gold` | `campaign_performance_gold` | The product only |
| Dagster job `_pipeline` | `campaign_performance_pipeline` | The product only |
Every identifier matches `^[a-z][a-z0-9_]*$`, so `campaign_performance`, not
`campaign-performance`. A product id is unique across the whole lakehouse.
Field-by-field rules are in the [descriptor reference](https://openlakeforge.dev/docs/reference/descriptors/).
## Add a source
```bash
olf source new marketing_platform --resource campaigns
```
Repeat `--resource` for each table-like input. The command writes
`bronze/marketing_platform/` with a `source.yaml`, a dlt loader under `dlt/`
and one placeholder CSV per resource under `examples/`. It validates its result
first and writes nothing if validation fails.
Replace each placeholder CSV with your real columns **before** you create a
domain or product that reads it: the Silver contract's columns are inferred
from that file at creation time.
:::note
The scaffold loads CSV files from `examples/`, which gives the same result
on every run. For an API or a database, `--kind api` or `--kind sql` writes
an incremental dlt connector instead; see [Load an external source
incrementally](https://openlakeforge.dev/docs/guides/incremental-sources/).
:::
## Add a domain
```bash
olf domain new marketing --input marketing_platform/campaigns
```
A domain owns a set of Silver tables. Each `--input /`
becomes a Silver table of the same name, validated by its own entity file,
`silver/marketing/contracts/.yml`. The domain's
`silver/marketing/domain.yml` sets the Iceberg namespace, the rejected-rows
path and the policy for all of them. An entity declares column types and a primary key;
every column starts as `nullable: false`, so loosen a column by hand when a
value may be empty. [Floe validation](https://github.com/OpenLakeForge/openlakeforge/blob/v0.6.0-alpha.3/docs/architecture/floe-validation.md)
describes the layout.
`olf product new` also creates the domain when its `--input` names a domain
that does not exist yet, so this step is optional.
## Add a data product
```bash
olf product new marketing/campaign_performance \
--silver-input campaigns \
--gold-table mart_campaign_performance
```
| Option | Use |
| --- | --- |
| `--silver-input
` | A Silver table the domain already has. Repeatable. |
| `--input /` | A Bronze resource to add to the domain's Silver and read. Creates the domain if needed. Repeatable. |
| `--gold-table ` | A Gold mart the product produces. Repeatable, at least one. |
| `--with-report` | Also scaffold a draft Superset report; see [Dashboards as code](https://openlakeforge.dev/docs/guides/dashboards-as-code/). |
It creates the product's folder `gold/models/campaign_performance/` in the
Gold dbt project and a Dagster module `pipelines/dagster/campaign_performance.py`,
and registers the product in `governance.yml`. It also adds the product's
`+group` block to `gold/dbt_project.yml` and declares any Silver table the
domain's `gold/models/_sources/.yml` lacks; the first product creates
the project itself. Dagster loads every module in `pipelines/dagster/` by
itself.
The generated model `mart_campaign_performance.sql` selects everything from
the first Silver input. Replace it with your SQL, reading Silver through
`{{ source('', '
') }}`, and describe and test it in the
product's `schema.yml`; dbt runs the tests in the same build, so a failing
test fails the run. Do not hard-code Trino hosts or catalogs: OpenLakeForge
renders the dbt profile for each stage.
## Add a resource to an existing source
1. Add it under `resources` in `bronze/marketing_platform/source.yaml`.
2. Add its data as `examples/.csv`.
3. Add its name to the entity tuple in `dlt/marketing_platform.py`:
```python
MARKETING_PLATFORM_ENTITIES = ("campaigns", "ad_groups")
```
4. Carry it into Silver. The simplest way is a new product that reads it, which
also adds the Silver table and its Floe entity:
```bash
olf product new marketing/ad_group_report \
--input marketing_platform/ad_groups --gold-table mart_ad_groups
```
To let an existing product read the resource instead, make these edits by
hand:
| File | Add |
| --- | --- |
| `silver/marketing/contracts/ad_groups.yml` | An entity file, copied from an existing one, with `source: { ref: marketing_platform, resource: ad_groups }` |
| `gold/models/_sources/marketing.yml` | `- name: ad_groups` under the `marketing` source |
| `gold/models//.sql` | A read of `{{ source('marketing', 'ad_groups') }}` |
## Add a Gold model to an existing product
1. Add `gold/models//.sql` and describe it in the product's
`schema.yml`. No descriptor lists it: its folder puts it in
`_gold`, and a table there belongs to the product.
The product's Dagster job picks the model up from the dbt project; nothing in
`pipelines/dagster/.py` lists it.
A product's models are private to it: `gold/dbt_project.yml` sets
`+access: private`, and each product is a dbt group. To let another product
`ref()` a mart, set `access: public` on that model in its `schema.yml`:
```yaml
models:
- name: mart_campaign_performance
access: public
```
A `ref()` to a model that is not public fails to parse. The reading product's
job uses the mart as it is and never rebuilds it.
Keep one model's reads to about 150 tables or fewer. Trino counts about two
stages per table a query reads and stops at `max_stage_count` (300 in every
`query.size`, see
[the deployment profile](https://openlakeforge.dev/docs/reference/deployment-profile/)) with
`QUERY_HAS_TOO_MANY_STAGES`. A union over a whole domain should be split into
staging models.
## Remove a product
Delete its entry from `governance.yml`, its `gold/models//` folder,
its block in `gold/dbt_project.yml` and its Dagster module. Dagster loads every module under `pipelines/dagster/`,
declared or not, so a leftover module keeps the job alive.
Renaming a source, domain, product or table changes the derived namespaces,
so on a deployed stage treat it as a data migration, not an edit.
`displayName`, `description` and `status` are metadata only.
## Validate and deploy
| Command | Checks |
| --- | --- |
| `olf check contracts` | Each descriptor against its schema: identifiers, duplicates, a domain or product without its directory; each Floe domain writes its own `_silver` namespace |
| `olf check project-code` | The whole inventory loads in Dagster, including references between descriptors |
| `olf check dbt` | Every product's dbt project parses and compiles, and its models and sources sit in the schemas the descriptors name. Incremental models are parsed (refs, sources, Jinja) but not compiled: `is_incremental()` needs a warehouse connection, so their rendered SQL is not checked |
Then deploy only the artifacts phase, which covers everything derived from
`lakehouse_code/`:
```bash
olf infra deploy --provider local --phase artifacts
```
It reconciles the catalog namespaces, builds the project-code image and
restarts Dagster's code location.
### Python dependencies
A project that needs a Python package (an API client, a dlt source) lists it in
`lakehouse_code/requirements.txt`, with plain pins or ranges. The image installs the file in its own
layer after the platform dependencies, constrained to their exact versions, so a project cannot change
a platform pin. `olf check project-code` and the image build resolve the file against those pins and
fail on a conflict. Unlike the platform lock, this layer is not hash-verified. Without the file the
image is unchanged.
## Check it worked
Launch `campaign_performance_pipeline` in Dagster, then query the mart:
```bash
olf infra query "SELECT * FROM campaign_performance_gold.mart_campaign_performance"
```
`olf infra e2e run --env local --suite full` also covers the new product, because it
discovers products from `governance.yml`.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/data-products.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/data-products.md).
---
# Load an external source incrementally
> How to load an API or a database into Bronze one change at a time, carry it through Silver and Gold incrementally, and rebuild them when you need to. For…
Source: https://openlakeforge.dev/docs/guides/incremental-sources/
How to load an API or a database into Bronze one change at a time, carry it
through Silver and Gold incrementally, and rebuild them when you need to. For
the contract each file follows, see the
[descriptor reference](https://openlakeforge.dev/docs/reference/descriptors/): its `source.yaml`,
**Load modes** and **Full refresh** sections are the canonical rules this
guide applies.
The examples use a source `shop` with an HTTP API resource `products` and a
database resource `orders`, in a domain `sales`.
## Start from the scaffold
```bash
olf source new shop --kind api --resource products --cursor updated_at --primary-key sku
```
`--kind api` (or `--kind sql`) writes everything the rest of this guide
describes for one source: `source.yaml` with each resource incremental and its
`runtime` keys, a connector on `openlakeforge_runtime.bronze_incremental`, and an example CSV per
resource. The example is not loaded; give it the real columns, because
```bash
olf domain new sales --input shop/products
```
infers the Silver contract's columns from it, and writes the entity with
`incremental_mode: file`, `merge_scd1` on the declared primary key, and a
Parquet entry in `silver/sources.yml`. The sections below explain each piece,
for adapting the scaffold or writing a source by hand.
## Declare the source
In `lakehouse_code/bronze/shop/source.yaml`, give each resource its load mode
and name the settings and credentials the connector reads:
```yaml
apiVersion: openlakeforge.io/v1beta1
kind: Source
name: shop
displayName: Shop
description: Products from the shop API and orders from its database.
status: active
resources:
- name: products
load: { mode: incremental, cursor: updated_at, primary_key: [sku] }
- name: orders
load: { mode: incremental, cursor: id, primary_key: [id] }
runtime:
config: [base_url, host, port, database]
secrets: [api_token, username, password]
```
A cursor is a column that only grows when a row is added or changed: a
modification time, or a key that increases. A resource with no usable cursor
stays `full` and is replaced on every run.
## Write the connector
The connector lives in `lakehouse_code/bronze/shop/dlt/shop.py`. It is a dlt
source whose incremental resources declare their cursor with
`dlt.sources.incremental`, on the column `source.yaml` names. A loader runs it
through `openlakeforge_runtime.bronze_dlt.load_dlt_source`, which applies the declared modes and
refuses a cursor that differs from the descriptor.
`openlakeforge_runtime.bronze_incremental` holds the two read patterns most sources fit, so the
connector keeps only the request, the query and the row shape:
| Helper | For | What it guarantees |
| --- | --- | --- |
| `newest_first_pages` | An API that sorts by modification time but cannot filter on it | Stops at the cursor; reads a changed item once; waits between requests; with no cursor yet, loads the newest pages the budget allows; with one, fails rather than skip items when the budget runs out |
| `keyset_batches` | A table with an increasing key | Reads past the cursor in key order, at most `max_rows` a run, so a large table backfills a slice per run and a killed run resumes |
| `sql_engine` | A database source | A SQLAlchemy engine from the bound `host`, `port`, `database`, `username`, `password` |
```python
from collections.abc import Iterator, Sequence
from typing import Any
import dlt
import sqlalchemy as sa
from dlt.sources.helpers import requests
from openlakeforge_runtime.bronze_csv import BronzeLoadResult
from openlakeforge_runtime.bronze_dlt import load_dlt_source
from openlakeforge_runtime.bronze_incremental import keyset_batches, newest_first_pages, sql_engine
_ORDERS = sa.text("select id, sku, quantity, placed_at from orders where id > :last order by id limit :limit")
@dlt.source(name="shop")
def shop(
base_url: str = dlt.config.value,
api_token: str = dlt.secrets.value,
host: str = dlt.config.value,
port: int = dlt.config.value,
database: str = dlt.config.value,
username: str = dlt.secrets.value,
password: str = dlt.secrets.value,
) -> Any:
def page(number: int) -> list[dict[str, Any]]:
response = requests.get(
f"{base_url}/products",
params={"sort": "-updated_at", "page": number, "per_page": 100},
headers={"Authorization": f"Bearer {api_token}"},
)
response.raise_for_status()
return response.json()["items"]
@dlt.resource(name="products", primary_key="sku")
def products(updated_at: Any = dlt.sources.incremental("updated_at", initial_value=0)) -> Iterator[Any]:
yield from newest_first_pages(
page, updated_at, cursor_field="updated_at", key="sku", page_size=100, max_pages=20, interval_seconds=1
)
@dlt.resource(name="orders", primary_key="id")
def orders(id: Any = dlt.sources.incremental("id", initial_value=0)) -> Iterator[Any]:
engine = sql_engine(
"postgresql+psycopg2",
{"host": host, "port": port, "database": database, "username": username, "password": password},
connect_args={"connect_timeout": 30},
)
with engine.connect() as connection:
yield from keyset_batches(connection, _ORDERS, id, cursor_field="id", batch_size=10_000, max_rows=100_000)
return products, orders
def load_shop_entities_to_bronze(resources: Sequence[str]) -> dict[str, BronzeLoadResult]:
return load_dlt_source("shop", shop(), resources)
```
Choose the budgets from the source's limits: an API that serves at most N
pages, or allows N requests a minute, sets `max_pages` and `interval_seconds`;
a database's load sets `max_rows`. Declare the column types of anything a page
or batch can leave empty (`columns=` on the resource), or a later run can land
the column under another type.
Batches land at `/shop//` as Parquet, one file
per run, named so the newest sorts last; dlt keeps each cursor in the same
bucket, per stage.
## Read it into Silver
In `lakehouse_code/silver/sources.yml`, name the source's Parquet files:
```yaml
sources:
- name: "shop"
format: "parquet"
path: "shop/{{resource}}"
storage: "lakehouse_bronze"
options: { glob: "*.parquet" }
```
An entity reading an incremental resource reads new files only and merges them
on the primary key: `incremental_mode: "file"` with `sink.write_mode`
`merge_scd1` (`merge_scd2` and `append` are also allowed). `olf check contracts`
rejects a mode that does not fit the resource; the rules are in **Load modes**
in the [descriptor reference](https://openlakeforge.dev/docs/reference/descriptors/).
## Bind each stage
Every stage that runs the source binds the keys `runtime` lists: a ConfigMap
`olf-source-shop` and a Secret `olf-source-shop-credentials` in the stage
namespace (the naming rules are in the `source.yaml` section of the
[descriptor reference](https://openlakeforge.dev/docs/reference/descriptors/)):
```bash
kubectl -n olf-dev create configmap olf-source-shop \
--from-literal=base_url=https://api.example.test --from-literal=host=db.example.test \
--from-literal=port=5432 --from-literal=database=shop
```
```bash
kubectl -n olf-dev create secret generic olf-source-shop-credentials \
--from-literal=api_token="$SHOP_API_TOKEN" --from-literal=username=reader \
--from-literal=password="$SHOP_DB_PASSWORD"
```
`olf infra project deploy` refuses to activate a revision in a stage that has
not bound every key.
On `local`, a stage's run pods reach nothing outside the cluster unless its
Deployment Profile opens the ports the source needs (see
[`spec.stages`](https://openlakeforge.dev/docs/reference/deployment-profile/)):
```yaml
stages:
dev:
source_egress:
ports: [443, 5432]
```
## Test it offline
`load_dlt_source` takes a local bucket and project root, so a test can run the
real connector against a controlled server or a temporary database and assert
on the Parquet it lands:
```python
from openlakeforge_runtime.bronze_dlt import load_dlt_source
def test_a_second_run_with_no_change_loads_nothing(tmp_path, monkeypatch):
monkeypatch.setenv("SOURCES__SHOP__BASE_URL", fake_api.url)
# ... the other SOURCES__SHOP__* bindings
def load():
return load_dlt_source(
"shop", shop(), ("products",), environ={"OPENLAKEFORGE_STAGE": "dev"},
bucket_url=(tmp_path / "bronze").as_uri(), lakehouse_root=LAKEHOUSE_CODE,
)["products"].rows
assert load() > 0
assert load() == 0
```
Cover the first run, a run with no change, a changed row, a page budget that
runs out, and DEV and PROD keeping their own cursor.
## Run it
```bash
olf infra product run --stage dev
```
A run is incremental: Bronze takes the rows past each cursor, Floe merges the
new files, and dbt runs the product's incremental models. To rebuild Silver and
Gold from everything Bronze holds, without extracting again:
```bash
olf infra product run --stage dev --full-refresh bronze
```
A row deleted at the source never reaches Bronze, so no run removes it from
Silver; the known limits are listed under **Full refresh** in the
[descriptor reference](https://openlakeforge.dev/docs/reference/descriptors/).
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/incremental-sources.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/incremental-sources.md).
---
# Dashboards as code
> How to keep Superset dashboards in git: edit a dashboard in the Superset UI, export it back into lakehouse_code/dashboards/superset/, validate it and import…
Source: https://openlakeforge.dev/docs/guides/dashboards-as-code/
How to keep Superset dashboards in git: edit a dashboard in the Superset UI,
export it back into `lakehouse_code/dashboards/superset/`, validate it and
import it again. Dashboards need the Full
preset, which adds Superset.
## 1. Use the Full preset
Set `preset: full` under `spec` in `openlakeforge.yaml`, then deploy:
```yaml
spec:
provider:
type: local
preset: full
```
```bash
olf infra deploy --provider local
```
The deploy applies the change in place: Terraform adds OpenMetadata and
Superset and leaves the data path and its tables as they are. Its artifacts
phase imports every dashboard bundle under `lakehouse_code/dashboards/superset/`.
`olf infra status --provider local` lists the Superset URL, for example
`http://superset-dev.olf.localhost`. With sign-in off, Superset opens as its
local Admin.
## 2. Know the bundle
Each dashboard is a directory, a bundle, holding what Superset exports:
```text
lakehouse_code/dashboards/superset/sales_customer_health/
├── metadata.yaml
├── databases/
├── datasets/
├── charts/
└── dashboards/
```
A directory under `dashboards/superset/` is a dashboard once it holds a
`metadata.yaml`, which the export writes. Its datasets name the Gold schema
they read (`schema: customer_health_gold`), and that is how OpenLakeForge knows
which products the dashboard serves. One dashboard can read several products.
The deploy requires exact parity between the declared dashboards and the
bundle directories.
## 3. Start a new dashboard
`olf product new` accepts `--with-report` when it creates a product. Use it
for a new product, not one that already exists. The example reads the
`campaigns` Silver table of a `marketing` domain, which must already exist; if
it does not, create the source and the domain as in
[Build and manage data products](https://openlakeforge.dev/docs/guides/data-products/).
```bash
olf product new marketing/campaign_summary \
--silver-input campaigns --gold-table mart_campaign_summary \
--with-report
```
It writes a draft under `lakehouse_code/dashboards/superset/campaign_summary/`:
the Trino database, one dataset per Gold mart and a README. It adds no
`metadata.yaml`, so the draft is not a dashboard or promotable yet, and the
deploy does not import it into Superset.
Deploy the new product so the platform knows it, then build its table:
```bash
olf infra deploy --provider local --phase artifacts
```
In Dagster, launch `campaign_summary_pipeline` once, so
`campaign_summary_gold.mart_campaign_summary` has rows.
Then build the dashboard in Superset: open **Datasets**, add a dataset from the
`OpenLakeForge Trino` database, the `campaign_summary_gold` schema and the
`mart_campaign_summary` table, chart it and save a dashboard. Then export it.
## 4. Export a dashboard
After you build or change a dashboard in the Superset UI, export it back into
its bundle. `olf infra report export` takes the stage you authored in; author in
DEV. For the `campaign_summary` draft of step 3, which has nothing exported
yet, name the dashboard by the slug you gave it in Superset (its
**Properties**):
```bash
SUPERSET_REPORT_SOURCE_DIR=lakehouse_code/dashboards/superset/campaign_summary \
SUPERSET_DASHBOARD="campaign-summary" \
olf infra report export --stage dev
```
For a dashboard that is already in a bundle, such as the demo
`sales_customer_health`, set only `SUPERSET_REPORT_SOURCE_DIR` to its
directory.
- `SUPERSET_REPORT_SOURCE_DIR` picks the bundle. It must be a directory
directly under `lakehouse_code/dashboards/superset/`. Without it the command
exports the first dashboard bundle it finds.
- The dashboard is found by the uuid stored in the bundle, which survives a
rename in Superset. For a draft with nothing exported yet, set
`SUPERSET_DASHBOARD` to its uuid or slug.
- `SUPERSET_ADMIN_USERNAME` defaults to `admin`. The password is read from
the `superset-credentials` Secret in the stage namespace; set
`SUPERSET_ADMIN_PASSWORD` to use another Superset.
The export writes a stage-neutral bundle: it replaces DEV's live Trino
connection with the placeholder each deploy rewrites, so the same bundle can be
promoted to PROD.
The export writes `campaign_summary`'s `metadata.yaml`, which makes it a
dashboard next to the demo ones.
## 5. Import a bundle
The next `olf infra deploy` imports every bundle. To import without a full deploy:
```bash
olf infra report import --stage dev
```
`olf infra project build` packages the bundles into a project revision, so a revision
promoted to PROD carries its dashboards.
## Check it worked
```bash
olf report validate
```
It checks every bundle for stable identities, resolvable references and no
stage-bound values. With the three demo dashboards and `campaign_summary`
exported, it prints:
```text
4 report bundle(s) are promotable.
```
Pass a dashboard name to check only that one.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/dashboards-as-code.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/dashboards-as-code.md).
---
# Deploy to AWS
> How to run your project in your own AWS account: EKS for Kubernetes, ECR for images, S3 for storage, RDS PostgreSQL for service state and AWS Glue as the…
Source: https://openlakeforge.dev/docs/guides/cloud/deploy-to-aws/
How to run your project in your own AWS account: EKS for Kubernetes, ECR for
images, S3 for storage, RDS PostgreSQL for service state and AWS Glue as the
Iceberg catalog. Your `lakehouse_code/` does not change; only the Deployment
Profile does.
:::caution
The AWS deployment is alpha. It has passed the end-to-end suite in a test
account but is not production-hardened, and it creates billable resources.
Read [Limitations and costs](#limitations-and-costs) first, and tear it
down when you are done.
:::
## Prerequisites
- An initialized project (`olf init`) and `olf` installed as in
[Install and configure a local deployment](https://openlakeforge.dev/docs/guides/local-installation/).
- A running Docker engine: the deploy builds and pushes images.
- An AWS identity allowed to create a VPC, an EKS cluster and its node group,
an ECR repository, IAM roles and EKS Pod Identity associations, an RDS
instance, S3 buckets and Glue databases. `AdministratorAccess` in a
dedicated account is the simplest choice.
You do not need the AWS CLI, Terraform, Helm or kubectl: `olf` uses the AWS SDK
and its own pinned tools.
## 1. Authenticate
`olf` reads credentials through the AWS SDK, from the first source it finds:
| Source | How |
| --- | --- |
| Automation credentials | `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`, a web identity token (GitHub Actions OIDC), a container role or an EC2 instance profile |
| An existing AWS profile | `olf infra auth login --provider aws --profile ` |
| IAM Identity Center (SSO) | `olf infra auth login --provider aws --start-url --sso-region ` |
For IAM Identity Center, the start URL is your AWS access portal URL, and
`--sso-region` is the region of your Identity Center instance, which can
differ from the region you deploy to. The command opens a browser to approve
the device; add `--no-browser` to print the URL and code instead. With no
option at all, `olf infra auth login --provider aws` reuses the `default` profile, or
asks for the start URL.
Check which identity `olf` will use:
```bash
olf infra auth status --provider aws
```
## 2. Point the profile at AWS
Edit `openlakeforge.yaml`:
```yaml
spec:
provider:
type: aws
region: eu-west-1
stages:
dev:
enabled: true
```
- `region` is where everything is created. Without it, `AWS_REGION` applies,
then `eu-west-1`.
- Delete any `access:` block: the cloud publishes no routes, and an `access:`
block would require `spec.identity`.
- Leave out `spec.identity`. The cloud deployment publishes no routes, so
there is nothing to sign in to: you reach the services with `olf infra forward`
from your machine, and authentication stays off.
- Keep DEV as the only stage: the cloud guides are validated with one stage.
```bash
olf profile validate --project .
```
## 3. Optional configuration
Everything has a default. Override with environment variables in the shell
that runs `olf`:
| Variable | Default | Meaning |
| --- | --- | --- |
| `AWS_CLUSTER_NAME` | `eks-openlakeforge`, or the name an existing deployment already uses | EKS cluster name, also the prefix of the IAM roles |
| `AWS_NODE_INSTANCE_TYPES` | `m7i.large` | Node instance type(s) |
| `AWS_NODE_DESIRED_SIZE`, `AWS_NODE_MIN_SIZE`, `AWS_NODE_MAX_SIZE` | `3`, `1`, `4` | Node group size |
| `AWS_TFVARS_FILE` | none | A Terraform variables file, for resource tags |
Set the same values for every later command, including `olf infra e2e run` and
`olf infra destroy`: they find the cluster by its name.
To tag every resource, for cost tracking or because your organization requires
it, put the tags in a variables file and export its path:
```bash
cat > aws.tfvars <<'HCL'
default_tags = {
Project = "openlakeforge"
Owner = "you@example.com"
}
HCL
export AWS_TFVARS_FILE="$(pwd)/aws.tfvars"
```
Keep it out of git. The same file applies to the cluster and the platform.
## 4. Deploy
```bash
olf infra deploy
```
It runs three phases, which you can also run one at a time with `--phase`:
| Phase | Creates |
| --- | --- |
| `foundation` | VPC with two public subnets, EKS and its node group, an ECR repository, IAM roles |
| `platform` | S3 buckets, Glue databases, RDS PostgreSQL, Trino, Dagster; Superset and OpenMetadata with the Full preset |
| `artifacts` | Builds and pushes the project-code image to ECR and deploys your data products |
Creating the EKS cluster takes most of the time. If this shell still exports
`PROJECT_CODE_IMAGE_REPOSITORY` from a local promotion, unset it: the cloud
pushes to its own ECR.
## 5. Open and validate the platform
The cloud deployment has no public endpoint. Port-forward the services to
your machine, on the same ports as locally (Dagster on
`http://localhost:3000`, Trino on `8080`, Superset on `8088`, OpenMetadata on
`8585`), and stop with Ctrl-C:
```bash
olf infra forward
```
Run the end-to-end suite after you stop `olf infra forward`: `olf` runs one command
at a time, and the suite opens its own port-forwards.
```bash
olf infra e2e run --env aws
```
It launches every product's job on EKS, checks the Silver and Gold tables
through Trino and Glue, and on Full also the dashboards and OpenMetadata. It
ends with `... e2e validation passed.`
## 6. Tear down
```bash
olf infra destroy
```
It removes the platform (RDS, buckets, Helm releases), then the foundation
(EKS, ECR with its images, networking). Run it from the same machine and
project as the deploy: Terraform state is local (see below). With `--phase`,
destroy `platform` before `foundation`; the foundation refuses to go first.
## Limitations and costs
| Area | Today |
| --- | --- |
| Access | No ingress, DNS, TLS or sign-in. Services are reached with `olf infra forward` only, by whoever has credentials to the cluster, with no OpenLakeForge sign-in in front of them. |
| Stages | Validated with DEV only. |
| State | Terraform state stays on your machine under `~/.openlakeforge`. There is no remote backend, so losing that directory loses the ability to update or destroy the deployment with `olf`. |
| Secrets | Generated service passwords live in Kubernetes Secrets and in the local Terraform state. |
| Network | Nodes run in public subnets, and the EKS API endpoint accepts connections from any address (`0.0.0.0/0`), protected by IAM authentication. |
| Data | RDS is a single `db.t4g.micro` instance with no final snapshot on destroy. There are no backups. |
| `olf infra query` | Not supported on AWS yet. |
The main running costs are the EKS control plane, three `m7i.large` nodes and
the RDS instance, plus S3 storage and data transfer. They accrue until
`olf infra destroy` finishes.
Workload identity uses EKS Pod Identity rather than IRSA, because the
restricted test account the AWS deployment was built in denied creating an
OIDC provider. Deployments created before 0.5 keep their
`limited-eks-openlakeforge-poc` cluster name: `olf` reads it from the
foundation state.
## Troubleshooting
| Symptom | Fix |
| --- | --- |
| `AWS is not authenticated` | Run `olf infra auth login --provider aws`, then `olf infra auth status --provider aws`. |
| `x509: certificate signed by unknown authority` from the SDK | A proxy intercepts TLS: `export AWS_CA_BUNDLE=/path/to/your-ca-bundle.pem`. |
| An `AccessDenied` or `UnauthorizedOperation` error | Your identity lacks a permission from the prerequisites. Organization policies (SCPs) can also require tags or names; set them with `AWS_TFVARS_FILE` and `AWS_CLUSTER_NAME`. |
| `olf infra e2e run` cannot find the cluster | Export the same `AWS_CLUSTER_NAME` as for the deploy. |
To promote revisions from CI, see
[CI/CD and environment promotion](https://openlakeforge.dev/docs/guides/promote-dev-to-prod/).
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/cloud/deploy-to-aws.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/cloud/deploy-to-aws.md).
---
# Deploy to Azure
> How to run your project in your own Azure subscription: AKS for Kubernetes and ACR for images, with the same in-cluster storage (SeaweedFS), catalog…
Source: https://openlakeforge.dev/docs/guides/cloud/deploy-to-azure/
How to run your project in your own Azure subscription: AKS for Kubernetes and
ACR for images, with the same in-cluster storage (SeaweedFS), catalog
(Polaris) and PostgreSQL as the local platform. Your `lakehouse_code/` does
not change; only the Deployment Profile does.
:::caution
Azure is a preview. It runs the same platform modules as local, but its
latest changes are checked with `terraform validate` and `plan` only, not
yet deployed to a live subscription. It creates billable resources. Read
[Limitations and costs](#limitations-and-costs) first, and tear it down when
you are done.
:::
## Prerequisites
- An initialized project (`olf init`) and `olf` installed as in
[Install and configure a local deployment](https://openlakeforge.dev/docs/guides/local-installation/).
- A running Docker engine: the deploy builds and pushes images.
- An Azure identity allowed to create a resource group, an AKS cluster, an
ACR registry and a role assignment in the subscription. `Owner` on the
subscription is the simplest choice; `Contributor` cannot create the role
assignment that lets AKS pull from ACR.
You do not need the Azure CLI, Terraform, Helm or kubectl: `olf` uses the
Azure SDK and its own pinned tools.
## 1. Authenticate
`olf` reads credentials through the Azure SDK, from the first source it finds:
| Source | How |
| --- | --- |
| A service principal or workload identity | `ARM_CLIENT_ID`, `ARM_TENANT_ID` and `ARM_CLIENT_SECRET` (or a certificate or OIDC token), the `AZURE_*` equivalents, or a managed identity |
| An existing `az login` session | `olf infra auth login --provider azure` reuses it when the `az` CLI is installed |
| Browser sign-in | `olf infra auth login --provider azure`, then pick the subscription |
On a machine without a browser, add `--device-code`. `--tenant-id` and
`--subscription-id` skip the prompts. Check which identity `olf` will use:
```bash
olf infra auth status --provider azure
```
## 2. Point the profile at Azure
Edit `openlakeforge.yaml`:
```yaml
spec:
provider:
type: azure
stages:
dev:
enabled: true
```
- Do not set `region`: Azure takes its region from `location` in the variables
file below.
- Delete any `access:` block: the cloud publishes no routes, and an `access:`
block would require `spec.identity`.
- Leave out `spec.identity`. The cloud deployment publishes no routes, so
there is nothing to sign in to: you reach the services with `olf infra forward`
from your machine, and authentication stays off.
- Keep DEV as the only stage: the cloud guides are validated with one stage.
```bash
olf profile validate --project .
```
## 3. Configure the resource group and nodes
Azure needs a Terraform variables file. Create one outside git and export its
path:
```bash
cat > azure.tfvars <<'HCL'
create_resource_group = true
resource_group_name = "rg-openlakeforge"
location = "westeurope"
node_vm_size = "Standard_D4s_v5"
HCL
export AZURE_TFVARS_FILE="$(pwd)/azure.tfvars"
```
| Variable | Required | Meaning |
| --- | --- | --- |
| `node_vm_size` | yes | A VM size your subscription and region offer |
| `location` | no, default `westeurope` | The Azure region |
| `create_resource_group` | no, default `true` | `true` lets Terraform create and later delete the group; `false` deploys into an existing group you manage |
| `resource_group_name` | no, default `rg-openlakeforge-azure-poc` | The group to create, or the existing one to use |
Keep `AZURE_TFVARS_FILE` exported for every later command, including
`olf infra destroy`: the foundation cannot be read without it.
Other settings are environment variables:
| Variable | Default | Meaning |
| --- | --- | --- |
| `AZURE_CLUSTER_NAME` | `aks-openlakeforge-poc` | AKS cluster name |
| `AZURE_NODE_COUNT` | `3` | Node count |
| `AZURE_ACR_NAME_PREFIX` | `openlakeforgepoc` | ACR name prefix; a random suffix makes it globally unique |
## 4. Deploy
```bash
olf infra deploy
```
It runs three phases, which you can also run one at a time with `--phase`:
| Phase | Creates |
| --- | --- |
| `foundation` | The resource group (when `create_resource_group = true`), AKS, ACR and the AKS-to-ACR pull role |
| `platform` | Deploys SeaweedFS, Polaris, PostgreSQL, Trino and Dagster; Superset and OpenMetadata with the Full preset |
| `artifacts` | Builds and pushes the project-code image to ACR and deploys your data products |
If this shell still exports `PROJECT_CODE_IMAGE_REPOSITORY` from a local
promotion, unset it: the cloud pushes to its own ACR.
## 5. Open and validate the platform
The cloud deployment has no public endpoint. Port-forward the services to
your machine, on the same ports as locally (Dagster on
`http://localhost:3000`, Trino on `8080`, Polaris on `8181`, SeaweedFS S3 on
`9000`, and on Full Superset on `8088` and OpenMetadata on `8585`), and stop
with Ctrl-C:
```bash
olf infra forward
```
Run the end-to-end suite after you stop `olf infra forward`: `olf` runs one command
at a time, and the suite opens its own port-forwards.
```bash
olf infra e2e run --env azure
```
It launches every product's job and checks the Silver and Gold tables, and on
Full also the dashboards and OpenMetadata. It ends with
`... e2e validation passed.`
## 6. Tear down
```bash
olf infra destroy
```
It removes the platform, then AKS and ACR. With
`create_resource_group = true` the resource group goes too; with `false` it is
left in place. Run it from the same machine and project as the deploy, with the
same `AZURE_TFVARS_FILE`. With `--phase`, destroy `platform` before
`foundation`.
## Limitations and costs
| Area | Today |
| --- | --- |
| Access | No ingress, DNS, TLS or sign-in. Services are reached with `olf infra forward` only, by whoever has credentials to the cluster, with no OpenLakeForge sign-in in front of them. |
| Stages | Validated with DEV only. |
| Services | SeaweedFS, Polaris and PostgreSQL run inside the cluster on its disks, with no backups or high availability. Azure Blob Storage and managed PostgreSQL are not used. |
| State | Terraform state stays on your machine under `~/.openlakeforge`. There is no remote backend. |
| Secrets | Generated service passwords live in Kubernetes Secrets and in the local Terraform state. |
The main running costs are the AKS nodes (three of `node_vm_size`), their
disks and ACR, plus data transfer. They accrue until `olf infra destroy` finishes.
## Troubleshooting
| Symptom | Fix |
| --- | --- |
| `Azure is not authenticated` | Run `olf infra auth login --provider azure`, then `olf infra auth status --provider azure`. |
| `Azure foundation configuration not found` | Export `AZURE_TFVARS_FILE` pointing at your variables file. |
| A VM size or quota error | Pick a `node_vm_size` your region offers and your subscription has quota for. |
| A policy forbids creating resource groups | Ask for a group, then set `create_resource_group = false` and its `resource_group_name` and `location`. |
| `certificate verify failed` from the SDK | A proxy intercepts TLS: `export REQUESTS_CA_BUNDLE=/path/to/your-ca-bundle.pem`. |
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/cloud/deploy-to-azure.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/cloud/deploy-to-azure.md).
---
# Connect GitHub
> How to turn on GitHub sign-in for a local OpenLakeForge deployment: create the GitHub App, install it on your organization, and fix a refused sign-in.
Source: https://openlakeforge.dev/docs/guides/identity/connect-github/
How to turn on GitHub sign-in for a local OpenLakeForge deployment: create the
GitHub App, install it on your organization, and fix a refused sign-in.
Without `spec.identity` in `openlakeforge.yaml`, authentication is off and
every service opens with administrator rights. `olf` allows that only when
nothing is published beyond your machine: locally on a `*.localhost` domain,
and on AWS or Azure without `spec.access`. With `spec.identity`, every
service sits behind a sign-in perimeter, and each person gets the role their
GitHub team grants. Lesson 8 of the tutorial walks through this once:
[Sign in with GitHub](https://openlakeforge.dev/docs/tutorial/08-sign-in-with-github/).
:::note
Sign-in is implemented for the local provider. The AWS and Azure
deployments publish no routes yet, so they are reached with `olf infra forward`
and never ask anyone to sign in.
:::
## Turn on sign-in
1. Add an identity block to `openlakeforge.yaml`. Each role maps to one or
more team slugs, as they appear in the team URL; a role you leave out is
held by nobody. See [Map teams to roles](https://openlakeforge.dev/docs/guides/identity/map-teams-to-roles/).
```yaml
spec:
access:
tls: none
identity:
issuer: github
github:
organization: my-org
teams:
platform-admin: [olf-platform-admins]
data-engineer: [olf-data-engineers]
analyst: [olf-analysts]
viewer: [olf-viewers]
oauth_app_secret_ref:
name: github-oauth-app
```
`organization` is the login exactly as GitHub shows it, case included.
Only members of the mapped teams can sign in; organization ownership grants
nothing. Sign-in works over plain HTTP or HTTPS.
2. Deploy:
```bash
olf infra deploy --provider local
```
In an interactive terminal, `olf infra deploy` notices the missing GitHub
credentials and runs the GitHub step first. It prints a URL and opens it in
your browser (on WSL through Windows' `explorer.exe`, when present), where
you select **Create GitHub App** with your own session. It stores the app's
credentials in the Kubernetes Secret named by `oauth_app_secret_ref`, and
the rest of the deploy runs unattended.
You can also run this step on its own, once the cluster exists:
```bash
olf infra github connect --project .
```
3. Install the app on the organization on the install page GitHub shows
after you create it. The app reads team membership only in organizations
it is installed on. The deploy ends with the portal URL and either
"GitHub App installed on " or the install link.
`--no-browser` (on `olf infra github connect`) prints the URL without opening it;
without a click within 15 minutes, nothing is written. Credentials are never
printed. To replace the app, use `olf infra secrets rotate github-app`, which
registers a new app, replaces the Secret and restarts Dex
([Rotate secrets](https://openlakeforge.dev/docs/guides/identity/rotate-secrets/#the-github-app)); then delete the old app
and its private key in the organization settings yourself. To make `olf infra deploy` fail on a missing Secret instead of
creating the app, pass `--no-github-connect`. In CI (no terminal, or `CI`
set) it never asks.
## Use an OAuth App instead
When you cannot create a GitHub App, create an organization-owned OAuth App
(Settings, Developer settings, OAuth Apps, New OAuth App):
| Field | Value |
| --- | --- |
| Homepage URL | `https://olf.localhost`, or `http://olf.localhost` with `tls: none` |
| Authorization callback URL | `https://auth.olf.localhost/callback`, or `http://auth.olf.localhost/callback` with `tls: none` |
Replace `olf.localhost` with your `spec.access.base_domain` if you changed it.
Generate a client secret, then store both values. The first `olf infra deploy`
creates the `olf-system` namespace and stops with the exact command; run it
with the managed kubectl:
```bash
export KUBECONFIG="$HOME/.openlakeforge/state/local/kubeconfig.yaml"
"$(olf toolchain path kubectl)" -n olf-system create secret generic github-oauth-app \
--from-literal=client-id="$GITHUB_CLIENT_ID" \
--from-literal=client-secret="$GITHUB_CLIENT_SECRET"
```
Then run `olf infra deploy --provider local` again, with `--no-github-connect` so it
does not offer to create a GitHub App. An OAuth App has no installation step, but without the GitHub App's
`app-id` the OpenMetadata role sync is skipped
([Add, change or remove a member](https://openlakeforge.dev/docs/guides/identity/manage-members/)).
## Troubleshooting
Dex's refusal page ("Internal Server Error", with the two likely causes) and
the perimeter's "Sign-in was refused" page both link here.
| Symptom | Cause and fix |
| --- | --- |
| "Sign-in was refused" | The GitHub App is not installed on the organization, or you are in no mapped team. Check `olf infra deploy`'s last lines for the install link; add yourself to a mapped team in GitHub. |
| "Access is role-restricted" | Your role does not open this service; see [Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/). A platform-admin changes team membership in GitHub. |
| `olf infra deploy` stops on a missing Secret | Run `olf infra github connect --project .`, or create the OAuth App Secret as above. |
| The organization is spelled differently | `organization` is compared exactly, case included. Use the login as GitHub shows it. |
| A request from `curl` answers `302` or `401` | Every route except `auth.` requires a browser session; `olf`'s own commands port-forward instead. |
## Check it worked
Open the portal, `http://olf.localhost`. It sends you to sign in with GitHub,
then shows the portal. With the Full preset, a person in the `analyst` team
reaches Superset and is refused Dagster.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/identity/connect-github.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/identity/connect-github.md).
---
# Map teams to roles
> How spec.identity.github.teams turns GitHub teams into the four OpenLakeForge roles, and what to check when a person gets the wrong one.
Source: https://openlakeforge.dev/docs/guides/identity/map-teams-to-roles/
How `spec.identity.github.teams` turns GitHub teams into the four OpenLakeForge
roles, and what to check when a person gets the wrong one.
## The mapping
```yaml
spec:
identity:
issuer: github
github:
organization: my-org
teams:
platform-admin: [olf-platform-admins]
data-engineer: [olf-data-engineers]
analyst: [olf-analysts, partner-analysts]
viewer: [olf-viewers]
```
| Rule | Detail |
| --- | --- |
| Keys | The canonical roles: `platform-admin`, `data-engineer`, `analyst`, `viewer`. Any other name is rejected. |
| Values | A non-empty list of team slugs, as they appear in the team URL. `olf` lowercases them. |
| Repeats | A slug may not repeat within a list, and one team may not map to two roles. |
| Omitted roles | A role you leave out is held by nobody. At least one role must be mapped. |
| Organization | The login exactly as GitHub shows it, case included. |
Several teams can feed one role. A person in teams of more than one role holds
the highest of them: the grants are cumulative, so a `platform-admin` also
holds everything below. Roles and what they open are in
[Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/).
## Apply a change
The mapping is part of the deployment, so changing which teams feed a role
takes a deploy:
```bash
olf infra deploy --provider local
```
Changing who is in a team does not: see
[Add, change or remove a member](https://openlakeforge.dev/docs/guides/identity/manage-members/).
## Check a person's role
Sign in as that person in a fresh private window and open Superset and
Dagster. The table in
[Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/) says what
each role opens. A person who is refused at sign-in is in no mapped team, or
the GitHub App is not installed:
[Troubleshooting](https://openlakeforge.dev/docs/guides/identity/connect-github/#troubleshooting).
Map direct teams only for OpenMetadata. The OpenMetadata role sync reads each
team's members, which include the people of its child teams, so it refuses to
run when a mapped team has child teams (`map direct teams only; has
child teams`). Map the child teams instead, or flatten the hierarchy.
Only teams in the organization named by `organization` count. A team
elsewhere with the same slug grants nothing.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/identity/map-teams-to-roles.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/identity/map-teams-to-roles.md).
---
# Add, change or remove a member
> How to give a person access, change their role or take it away. People and roles live in your GitHub organization, so there is no olf command for users and…
Source: https://openlakeforge.dev/docs/guides/identity/manage-members/
How to give a person access, change their role or take it away. People and
roles live in your GitHub organization, so there is no `olf` command for users
and none of these steps needs a deploy.
| To | Do this in GitHub | What happens |
| --- | --- | --- |
| Give the first administrators access | Put them in the team mapped to `platform-admin` | They hold `platform-admin` at their first sign-in. Nothing is created at deploy. |
| Add a person | Add them to the organization and to a mapped team | They sign in with GitHub on the portal. GitHub owns their password, two-factor authentication and recovery. |
| Change a role | Move them between mapped teams | Their next token carries the new teams. |
| Remove every role | Remove them from every mapped team | Dex refuses their next sign-in or refresh. |
| Offboard | Remove them from the organization | The same, and GitHub ends their organization access everywhere else at once. |
Only members of a mapped team can sign in. Being an organization owner grants
nothing in OpenLakeForge.
## How fast a change takes effect
A person with no open session is affected at their next sign-in. For a person
who is signed in:
| Where | Delay | Why |
| --- | --- | --- |
| Portal, Dagster, Trino UI and every route (the perimeter) | About 4 to 5 minutes | The perimeter refreshes the session against Dex at most every 4 minutes, and Dex re-reads team membership on a refresh. The change shows on the first request after a refresh; access tokens last 5 minutes. |
| OpenMetadata roles | Up to 5 minutes plus the run | A CronJob, `openmetadata-role-sync`, reads the mapped teams every 5 minutes and sets the administrator flag and the `DataSteward` role. It needs the GitHub App (the Secret's `app-id` and `private-key`); with a hand-made OAuth App it is skipped and OpenMetadata users stay at the read baseline. |
| Superset roles | At most 15 minutes (designed; not measured) | Superset's own session is designed to last 15 minutes without sliding, and its roles are read again at each sign-in. The perimeter refuses a removed person first. |
Measured once, against real GitHub: a member moved to another team lost the
old role on the first request after the 4-minute refresh. The bound is "the
next request at least 4 minutes after sign-in or the last refresh", not a
timer, so a person who stays idle is refused at their next request.
A person's session also ends 30 minutes after their last request and 10 hours
after sign-in, whatever else is true.
:::note
Ownership outlives a role. In OpenMetadata, the owner of an asset keeps full
control of it after a demotion until the ownership is reassigned. Reassign
the assets of someone you demote or offboard.
:::
## Sign out
A person does not need to sign out for a team change to apply: it takes effect
within the refresh bounds above. To end a session anyway, select **Sign out** in
the portal header. It clears the perimeter cookie.
- Superset keeps its own session. Its Logout menu item does the same.
- GitHub's own session stays open, so signing in again usually does not prompt;
Dex re-reads teams at each sign-in.
- A private window is the easy alternative: closing it drops every cookie.
## Check a change took effect
1. Make the change in GitHub and note the time.
2. In a fresh private window, sign in as the person (or use their open
session) and open a service their new role should deny.
3. Expect the "Access is role-restricted" page, or Dex's refusal when they have
no role at all.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/identity/manage-members.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/identity/manage-members.md).
---
# Bring your own OIDC issuer
> How to sign people in through an identity provider you run, such as Okta, Entra ID or Auth0, instead of GitHub. OpenLakeForge then deploys no issuer of its own.
Source: https://openlakeforge.dev/docs/guides/identity/external-issuer/
How to sign people in through an identity provider you run, such as Okta,
Entra ID or Auth0, instead of GitHub. OpenLakeForge then deploys no issuer
of its own.
```yaml
spec:
access:
tls: none
identity:
issuer: external
issuer_url: https://login.example.com/
role_claim: groups
role_mapping:
platform-admin: [olf-admins]
analyst: [analysts]
```
| Field | Meaning |
| --- | --- |
| `issuer_url` | An `https://` URL. The token's `iss` claim must equal it. |
| `role_claim` | The token claim that holds group values, such as `groups`. |
| `role_mapping` | Each canonical role and the claim values that grant it. A value may not map to two roles. |
| `client_ids` | Optional issuer-assigned client ids, keyed by consumer. |
Every field is in the
[Deployment Profile reference](https://openlakeforge.dev/docs/reference/deployment-profile/#specidentity).
## Register the clients
Register three confidential OIDC clients in your issuer: `perimeter`,
`superset` and `openmetadata`, or the ids you set under `client_ids`. Store each
client secret in a Kubernetes Secret named `oidc-client-` in
`olf-system`, with the key `client-secret`. The contract names all three, so
create all three; only the `perimeter` client is used by a deployed service
today (see Limits).
For the `perimeter` client, register this redirect URI, with the scheme you
deploy (`http` with `access: {tls: none}`, `https` otherwise):
```text
://oauth2./oauth2/callback
```
For example `http://oauth2.olf.localhost/oauth2/callback`.
`olf-system` does not exist on a fresh stack, and `olf` creates it early only
for `issuer: github`. Do not create it by hand: Terraform owns it and cannot
adopt a hand-made one. The order to use: run `olf infra deploy --provider local`,
which creates the namespace and may fail or wait on the pods that need the
Secrets; then create the Secrets below and run `olf infra deploy --provider local`
again. This order has not been run end to end; the missing early namespace step
for `external` is tracked in #521.
```bash
export KUBECONFIG="$HOME/.openlakeforge/state/local/kubeconfig.yaml"
"$(olf toolchain path kubectl)" -n olf-system create secret generic oidc-client-perimeter \
--from-literal=client-secret="$PERIMETER_CLIENT_SECRET"
```
Repeat for `superset` and `openmetadata`.
Also register a fourth, public client for the command line: `olf-cli`, or the id
you set under `client_ids`. It has no secret and no Kubernetes Secret.
| Setting | Value |
| --- | --- |
| Client type | Public (no client secret) |
| Grant | Authorization Code with PKCE (S256) |
| Redirect URIs | Loopback addresses on any port (`http://127.0.0.1:/...`, `http://localhost:/...`, `http://[::1]:/...`) |
| Scopes | `openid`, `email`, `profile` and `groups` (or whichever scope carries your `role_claim`), plus `offline_access` for refresh tokens |
| Claims | The `role_claim` and `preferred_username`: OpenMetadata names users by it |
The perimeter accepts a bearer token whose `iss` is your `issuer_url` and whose
`aud` is this client id, but only when your `role_claim` is `groups`: oauth2-proxy
reads the roles of a bearer token from that claim name alone, so with another
`role_claim` every bearer token is refused with 401. No `olf` command signs in with it yet.
## Limits
- **The issuer must be public and trusted.** The perimeter gets the local CA
only when Dex is deployed. With an external issuer, the issuer must be
reachable from inside the cluster and present a publicly trusted
certificate; a private CA is not supported.
- **Refresh must return the role claim.** The perimeter re-reads roles when it
refreshes a session. If your issuer's refresh response carries no ID token
with the role claim, a removed role stays usable until the issuer's session
ends, which can be hours. Test removal before you rely on it.
- **Only the perimeter uses your issuer.** With `external`, OpenMetadata and
Superset are deployed with no OIDC configuration (`oidc = null`), so they
keep their own logins behind the perimeter. The OpenMetadata role sync, which
reads GitHub teams, does not apply either. The per-service roles in
[Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/) are
therefore enforced by the perimeter only: which services a person opens.
- **Rotation is yours.** `olf infra secrets rotate` works for `issuer: github` only.
Rotate the client secrets in your issuer and in the `oidc-client-`
Secrets, then restart the consumers.
- **Local provider.** Sign-in is implemented for the local provider only.
The mapping, roles and what they open are the same as with GitHub:
[Roles and permissions](https://openlakeforge.dev/docs/reference/roles-and-permissions/).
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/identity/external-issuer.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/identity/external-issuer.md).
---
# Rotate secrets
> How to rotate the secrets sign-in depends on with olf infra secrets rotate, and the manual procedure for the clients the command does not cover.
Source: https://openlakeforge.dev/docs/guides/identity/rotate-secrets/
How to rotate the secrets sign-in depends on with `olf infra secrets rotate`, and the
manual procedure for the clients the command does not cover.
Rotate after a suspected leak, when someone who could read the Secrets leaves,
or on a schedule. The command is for `provider: local` with
`identity.issuer: github`. With `issuer: external`, rotate the client secrets
in your issuer and in the `oidc-client-` Secrets, then restart the
consumers ([Bring your own OIDC issuer](https://openlakeforge.dev/docs/guides/identity/external-issuer/)).
## `olf infra secrets rotate`
```bash
olf infra secrets rotate dex-client-perimeter
```
Add `-f ` if you deployed from a profile file. The command prints what
it rotated and restarted, and never prints a secret value.
| Target | Rotates | Restarts |
| --- | --- | --- |
| `dex-client-perimeter` | The perimeter's Dex client secret | `deployment/dex` and the perimeter deployments |
| `github-app` | Registers a new GitHub App through `olf infra github connect` and replaces its Secret | `deployment/dex` |
For a Dex client, the command deletes the Secret, applies only the credentials
Job (a targeted Terraform apply with `-replace`) so the Secret is made again,
restarts what reads it, waits for the rollouts, and ends with
`Confirm: sign in at `. Signing in succeeds only when Dex and the
service hold the same secret.
### What it refuses
Before it deletes anything, it stops and names the cause when:
- the provider is not `local`, or `identity.issuer` is not `github`;
- the platform state has drifted: run `olf infra deploy` first;
- the Secret lacks the `client-secret` key;
- another `dex-client-*` Secret is missing, because the shared Job would
regenerate that one too, without restarting its consumers: run `olf infra deploy`
first.
### The GitHub App
`olf infra secrets rotate github-app` registers a new GitHub App in your browser,
replaces the Secret named by `oauth_app_secret_ref` and restarts Dex. Then:
1. Install the new app on the organization (the command prints the link).
2. Delete the old GitHub App and its private key in the organization settings.
`--no-browser` prints the URL instead of opening it.
To rotate only the client secret by hand, generate a new one in GitHub, update
the Secret, and restart Dex:
```bash
export KUBECONFIG="$HOME/.openlakeforge/state/local/kubeconfig.yaml"
KUBECTL="$(olf toolchain path kubectl)"
"$KUBECTL" -n olf-system rollout restart deployment dex
```
Rotating `dex-client-perimeter` is exercised in the local end-to-end run; it
took about 100 seconds there. That is one measurement, not a bound.
## Manual: the Superset and OpenMetadata clients
The command does not cover `superset` and `openmetadata`: Superset keeps a copy
of its secret per stage, and OpenMetadata has no consumer step documented.
For `superset`, with the managed kubectl and kubeconfig set as above:
1. Delete the Secret:
```bash
"$KUBECTL" -n olf-system delete secret dex-client-superset
```
2. Re-run the platform phase with the Dex credential Job replaced, so it recreates
the missing Secret. Each stage keeps its own Superset copy, made by the
one-shot `kubernetes_job_v1.oidc_secret` of that stage's `module.superset`:
add a `-replace` of that Job for each stage.
```bash
TF_CLI_ARGS_apply='-replace=module.dex[0].kubernetes_job_v1.credentials -replace=module.superset[""].kubernetes_job_v1.oidc_secret[0]' \
olf infra deploy --provider local --phase platform
```
3. Restart Dex, then the Superset web deployment in each stage namespace
(`olf-`, for example `olf-dev`):
```bash
"$KUBECTL" -n olf-system rollout restart deployment dex
"$KUBECTL" -n olf- rollout restart deployment/superset
```
4. Sign in through the portal.
If the Dex credential Job fails with `Secret exists without key
client-secret`, something else created that Secret: fix or delete it and re-run
step 2. An interrupted bootstrap is safe to re-run.
## The session cookie secret
Rotating it signs everyone out (with `KUBECTL` set as above):
```bash
"$KUBECTL" -n olf-system delete secret oauth2-proxy-cookie --ignore-not-found
TF_CLI_ARGS_apply='-replace=module.perimeter[0].kubernetes_job_v1.cookie_secret' \
olf infra deploy --provider local --phase platform
"$KUBECTL" -n olf-system rollout restart deployment -l openlakeforge.io/role-floor
```
Polaris token-key rotation has no documented procedure and is not covered.
---
Synced from openlakeforge @ `v0.6.0-alpha.3` (`882b426`), [docs/guides/identity/rotate-secrets.md](https://github.com/OpenLakeForge/openlakeforge/blob/882b426992381ef277f7c0830f36c0d6fa348644/docs/guides/identity/rotate-secrets.md).
---
# Break-glass access and issuer recovery
> How a cluster administrator reaches a service when the issuer (Dex, and behind it GitHub) is unavailable, and how to bring sign-in back. It applies to the…
Source: https://openlakeforge.dev/docs/guides/identity/break-glass/
How a cluster administrator reaches a service when the issuer (Dex, and behind
it GitHub) is unavailable, and how to bring sign-in back. It applies to the
local provider.
## What happens when the issuer is down
The perimeter fails closed. It does not extend a session it cannot refresh and
has no grace period. Sessions that are already open keep working until their
access token expires, at most 5 minutes, then every protected route refuses
requests. New sign-ins fail. The portal is behind the perimeter, so it refuses
too. Superset's and OpenMetadata's own sessions cannot be renewed either.
Break-glass is the way in that does not depend on the issuer: your Kubernetes
access.
## Use `olf infra break-glass`
```bash
olf infra break-glass dagster --local-port 3000 --reason "Dex is down; checking the daily run"
```
Then open `http://127.0.0.1:3000`. The command runs until you exit (Ctrl-C) or
the time limit passes, and prints the record it left. `--reason` is required
and recorded. Dagster's remote port is 80, which an unprivileged user cannot
bind locally, hence `--local-port`.
| Service | What you get |
| --- | --- |
| `dex` | A port-forward to the Dex Service on `127.0.0.1:5556`, for diagnosis. Dex has no admin console or account. |
| `trino` | A port-forward to the stage's Trino Service on `127.0.0.1:8080`, plain HTTP, for diagnosis (for example `/v1/info`). Trino has no authentication of its own, and its Web UI opens as the fixed user `olf-web`. Reading a table still needs a Polaris token sent as the `token` extra credential, which Dex cannot issue during the outage. |
| `dagster` | A port-forward to the Dagster webserver (remote port 80), in the DEV stage only. |
| `superset`, `openmetadata` | A shell in the service's pod, for its CLI. Their UIs accept only issuer login and are not reachable during an outage. `superset` reaches the DEV stage only. |
There is no `--stage` option: `dagster` and `superset` always target the DEV
namespace (tracked in #521).
| Option | Default | Meaning |
| --- | --- | --- |
| `--ttl-minutes` | 30 | Hard stop. The access ends when the process exits or the time passes. |
| `--local-port` | the remote port | Local port for the port-forward. |
Properties:
- **Time-boxed.** Nothing persistent grants access: the port-forward ends with
its process, so there is nothing to remove afterwards.
- **Recorded.** Each use writes one ConfigMap, `break-glass-