# 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 about 1.4 s every half minute. Polaris
accepts up to 5 s of skew on the tokens it issues, so nothing needs changing.
`olf infra doctor` lists the second time source under `WSL clock` as
information. If Trino still fails at random with `Not authorized`, 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).

### Hardware

The resources Docker can use, not the whole machine:

| Deployment | CPU | Memory | Free disk |
| --- | --- | --- | --- |
| Slim, one stage (the Quickstart) | 4 | 16 GB | about 35 GB |
| 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. The Slim smoke deploy adds about 33 GB to the runner's disk:
built images, the kind nodes and the `olf` toolchain. With Full and two stages
running, the host used about 9 GB of memory. Most of the disk is container
images, not data: the kind nodes pull the catalog images themselves, so each
worker keeps its images once unpacked (16 GB) next to 1.4 GB of compressed
layers. On the nightly runner, a Full DEV+PROD deployment used 87 GB of the
root disk, 40.77 GB of it in the three kind nodes' volumes
([run 45053002752](https://github.com/OpenLakeForge/openlakeforge/actions/runs/45053002752)).
The same deployment on main with images imported from the host's Docker
([run 44934519070](https://github.com/OpenLakeForge/openlakeforge/actions/runs/44934519070)) used 113 GB,
52.08 GB in the volumes, because each worker also held 14 GB of uncompressed
layers. The kind nodes pull anonymously, without your `docker login`, registry mirrors
or proxy settings. When a node's pull fails, for example on a Docker Hub rate
limit or with no route to the registry, `olf` pulls that image through your
host's Docker instead and imports it, which uses the extra disk again for that
image. An image your Docker already holds is imported without any pull.
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.7.5b1" --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.7.5b1"
```

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>` | 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-<stage>`, 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 `<N>` the pull
   request number and `<digest>` the 64 hex digits after `sha256:`:

   ```hcl
   portal_image = "ghcr.io/openlakeforge/openlakeforge-portal:pr-<N>@sha256:<digest>"
   ```

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.

Destroying the cluster (`olf infra destroy`, or `--phase foundation`) also
removes the images on the host's Docker that `olf` created: the project-code,
platform API and Superset images it built, and the images its prefetch pulled.
`olf` records each in `olf-host-images.txt` under the work directory and
removes them by name. An image you already had is not in that record and
stays, as does an image you built `FROM` one of theirs, and so do containers,
volumes and the build cache. An image `olf` pulled is removed even if you have
used it since, unless a container still uses it. The build cache is not
pruned, because Docker cannot scope it to `olf`; reclaim it yourself with
`docker builder prune`. The next `olf infra deploy` pulls or rebuilds the
removed images.

| 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.7.5-beta.1/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.`

---

<small>Synced from openlakeforge @ `v0.7.5-beta.1` (`8a7bf72`), [docs/guides/local-installation.md](https://github.com/OpenLakeForge/openlakeforge/blob/8a7bf7296968594c1676b0f581f7c40c3d31b7ba/docs/guides/local-installation.md).</small>
