Skip to content

Deploy Governance to a VB-OS Environment

Set up environments for your project:

from vbos import VBOSClient
client = VBOSClient(api_key="YOUR_API_KEY")
dev_env = client.environments.create(
project_id="PROJECT_ID",
name="development",
)
staging_env = client.environments.create(
project_id="PROJECT_ID",
name="staging",
)
prod_env = client.environments.create(
project_id="PROJECT_ID",
name="production",
)

Deploy a compiled boundary version to an environment:

deployment = client.deployments.create(
project_id="PROJECT_ID",
environment_id=dev_env["id"],
boundary_version_id="COMPILED_VERSION_ID",
)

If the environment already has an active deployment, it transitions to SUPERSEDED status. The new deployment becomes ACTIVE.

Promote a specific version through environments:

version_id = "COMPILED_VERSION_ID"
# Deploy to development
client.deployments.create(
project_id="PROJECT_ID",
environment_id=dev_env["id"],
boundary_version_id=version_id,
)
# Test in development...
# Promote to staging
client.deployments.create(
project_id="PROJECT_ID",
environment_id=staging_env["id"],
boundary_version_id=version_id,
)
# Run certifications against staging...
# Promote to production
client.deployments.create(
project_id="PROJECT_ID",
environment_id=prod_env["id"],
boundary_version_id=version_id,
)

Promotion requires an explicit boundary_version_id. You cannot promote “the latest”: you must specify the exact compiled version. This prevents TOCTOU races where a newer version is compiled between your decision to promote and the actual promotion.

Roll back a deployment:

client.deployments.rollback(
project_id="PROJECT_ID",
environment_id="ENVIRONMENT_ID",
boundary_id="BOUNDARY_ID",
reason="Rolling back due to evaluation failures",
)

Rollback targets a specific boundary within an environment. The current deployment transitions to ROLLED_BACK. To restore a previous version, create a new deployment with that version’s ID.

Terminal window
vbos deployments create \
--project PROJECT_ID \
--environment ENVIRONMENT_ID \
--boundary-version VERSION_ID