Skip to content

Add PROD and promote a revision

View as Markdownllms.txt

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: 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.

A Deployment Profile can enable dev, an optional uat and prod. Every stage runs in the same cluster, in its own olf-<stage> namespace with its own Dagster (and Superset with the Full preset), its own buckets and its own lakehouse_<stage> 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.

Stage promotion: a merged pull request builds one image and one project revision, which is activated in the DEV namespace, tested, approved, and then activated unchanged in PROD

Add prod under spec.stages in openlakeforge.yaml:

spec:
stages:
dev:
enabled: true
prod:
enabled: true

Then create the namespaces, buckets and catalogs for every enabled stage:

Terminal window
olf infra platform apply -f openlakeforge.yaml

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:

Terminal window
export PROJECT_CODE_IMAGE_REPOSITORY=ghcr.io/<your-account>/project-code
export PROJECT_CODE_IMAGE_TAG=dev
docker login ghcr.io # or docker.io
Terminal window
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, <repository>@sha256:<digest>. tail -n 1 keeps only that last line in IMAGE. Build the revision from it the same way:

Terminal window
REVISION="$(olf infra project build --project . --image "$IMAGE" | tee /dev/stderr | tail -n 1)"
echo "$REVISION"

It prints the revision id, sha256:<rev>. The revision freezes your descriptors, Floe contracts, dbt projects, Dagster code, reports and the image digest.

Activate it in DEV and validate it there first:

Terminal window
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:

Terminal window
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.

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.

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 <s> --revision <r>, fails unless olf infra project status records exactly <r>, 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.

Terminal window
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:

Local OpenLakeForge full e2e validation passed.
  • 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.

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.