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, 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.
How stages work
Section titled “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-<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.
1. Enable the PROD stage
Section titled “1. Enable the PROD stage”Add prod under spec.stages in openlakeforge.yaml:
spec: stages: dev: enabled: true prod: enabled: trueThen create the namespaces, buckets and catalogs for every enabled stage:
olf infra platform apply -f openlakeforge.yaml2. Choose a registry
Section titled “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:
export PROJECT_CODE_IMAGE_REPOSITORY=ghcr.io/<your-account>/project-codeexport PROJECT_CODE_IMAGE_TAG=devdocker login ghcr.io # or docker.io3. Build the revision once
Section titled “3. Build the revision once”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:
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.
4. Activate it in DEV, then in PROD
Section titled “4. Activate it in DEV, then in PROD”Activate it in DEV and validate it there first:
olf infra project deploy -f openlakeforge.yaml --stage dev --revision "$REVISION"olf infra e2e run --env local -f openlakeforge.yaml --stage dev --suite fullOnly when DEV passes, activate the same revision in PROD:
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
Section titled “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
Section titled “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 <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.
Check it worked
Section titled “Check it worked”olf infra e2e run --env local -f openlakeforge.yaml --stage prod --suite fullIt 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.What you learned
Section titled “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,buildanddeploy.
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.