# Preview, approve and deploy

> Save source, build in your cloud, preview a release, get it approved and promote it.

Source: https://diakrin.com/docs/deploy

Every release takes the same governed path from source to production. Each step produces its own evidence, and none of them stands in for the next: a successful build is not a preview, and a preview is not production approval.

```steps
Save source | Builder | Save a version of the app. Saving does not publish anything.
Build and check | Your cloud | Builds and scans run in your cloud from an approved, immutable commit and pinned template metadata.
Preview a release | Builder | Choose a checked release and approved hosting, inspect the cost, access and expiry, then deploy a bounded preview.
Approve the plan | Independent reviewer | At the production review gate, an eligible reviewer who is not the requester approves or denies the exact plan.
Promote | Builder | Promotion applies that approval to the release you reviewed.
Verify and open | Diakrin | The app opens only with fresh, server-verified health evidence and current access at the moment of the click.
```

> [!SELF-HOSTED]
> Builds run on your company's own GitHub Actions runner, labelled `diakrin-customer`, and report to your installation. They never use GitHub-hosted runners or Diakrin's hosted service. Builds and deploys also stay blocked until IT configures the audit archive.

## Save your app in company source

When your company enables source access, choose **Start fresh**, **Bring an app — in my coding tool** or **Bring an app — company repository**. IT connects company GitHub once. You use company sign-in and do not need your own GitHub account. An access request stays pending until its owner acts.

Use the Diakrin source helper for checkout, assessment and saving. Check the app name and confirmation code in the browser before approving a helper connection. Source files move directly to your company service. Keep sample data on your laptop; use an approved private company preview for real data. Imported code is assessed without running it, and proposed adaptation work stays separate from the original.

**Save version** records source history. It does not publish. Review the source status and use the app’s build, preview and publishing actions. On a conflict, refresh and reconcile; do not force an overwrite. Closing a browser does not approve pending work.

## Prepare a reviewed employee app

Open your app, select a reviewed starter and save its purpose, audience, useful tasks and acceptance checks. The starter's capability requests are not permission grants.

**Choose source and request access** opens the company Integrations flow. IT approves the named read-only operation, its resource and field constraints and its limits, with separate app and employee grants.

For company data, request a named operation from **Connections**. Only an authorized owner enters credentials, on the customer-hosted secure form. Do not paste keys or passwords into your coding tool. Saved credentials still need verification, and the app and employee still need approved access. Direct runtime credentials require a separate supported policy and explicit disclosure that app code can read its own value.

Use the trusted developer contract before coding or requesting a build. Do not upload source code, credentials, tokens or business rows to Diakrin.

## Preview a release

Choose a checked release and company-approved hosting, then select **Preview release**. Inspect the cost estimate, access implications, pinned image and expiry before you continue.

**Deploy reviewed preview** requests customer-side preview checks under your company policy, which may require independent approval before the preview runs.

A build or deploy first reserves budget for that one operation. When the app's budget for the month is used up, the request is refused with `BUDGET_EXHAUSTED` and nothing is built or deployed; raise the ceiling on the app's **Cost** card or wait for held reservations from earlier operations to settle, then retry.

> [!SELF-HOSTED]
> Builds, deploys and publishes are refused with `BUDGET_REQUIRED` when the owner has not approved a build, runtime and total budget, and with `BUDGET_EXHAUSTED` when this month's limit is used up. Nothing is built or deployed. The owner approves or raises **Organization spending limits** in **Finish setup**, on the deployment prerequisites step, then you retry. A refused request always names the rule (`COST-01`) and the next step; see [When a build, deployment or publish is refused](/docs/governance#when-a-build-deployment-or-publish-is-refused).

## Get the plan approved and promote it

When the release reaches production review, select **Load reviewed release plan**. An eligible independent reviewer then records **Approve reviewed plan** or **Deny plan**. On Google Cloud, production always needs a current independent approval, even when your policy permits a preview without one.

**Promote reviewed app** applies that exact approval to the release. It does not mean the app is live yet.

## Verify and open

**Verify and open preview** checks the app's health and your current access at the moment you click, then opens the exact checked image over HTTPS. It never reuses a cached link. Preview access does not replace production approval.

Employees open live apps from the Company catalog. Its launch action rechecks app-use permission, runtime stop or revocation and fresh deployment evidence; catalog visibility alone does not grant app or source access.

## Publish and roll back

Your app has two kinds of version. **Preview** is a running candidate that only you and the people you share it with can open. **Live** is what your company opens. The console says **Live v3 · a1b2c3d4e5f6 · published 2 minutes ago** only after Diakrin's release record shows it, never from a build or a Preview.

After the first publish, saving a change shows **Ready to publish**. That means the version passed its checks; nothing is running for it yet, so there is no Preview of the change. Select **Publish** on your latest version. Publish is an approved rolling update: the new version replaces the old one gradually, health checks stop it if the new version does not come up healthy, and the app stays on the old version until the release record says otherwise. When the plan needs an independent approval the console shows **Waiting for approval** until a different person approves. Closing the page does not stop it; open it again to follow along.

**Roll back to v<n>** appears when there is an earlier Live version. It redeploys that version's image and never touches the database.

- Only your latest version can be published. An older one is refused; save your change as a new version first.
- Roll back reuses the earlier version's plan and approval. When they have expired, Roll back says the earlier version needs a fresh approval. The owner approves a new plan in the console, then selects **Roll back** again.
- Roll back checks the database first, and is available today for the synthetic web starter (version 1.1.0), which has no database. Other templates are refused because Diakrin cannot yet confirm the earlier version fits the current database. Publish a fixed version instead.

> [!SELF-HOSTED]
> From a terminal: `diakrin app publish` publishes your latest saved version and follows it until it prints `Live: version N`; `diakrin app rollback --version-id VERSION_ID` returns to an earlier release. A different administrator approves; the requester cannot approve their own publish. Refusals you may see: `VERSION_NOT_LATEST` (save your change as a new version), `ROLLBACK_PLAN_REFRESH_REQUIRED` (the owner approves a fresh plan, then roll back again) and `ROLLBACK_SCHEMA_UNKNOWN` (rollback is supported only for the synthetic web starter, version 1.1.0). Roll back never runs or reverses a database migration.

Current limits:

- After the first publish, an edit gets no separate Preview. **Publish** builds and starts it as part of the publish itself. A running candidate you can open before you publish is planned.
- Roll back never reverses a database migration.

## Follow builds and deployments

Open your app and select the **Deployment** tab. The console reads the same operation IDs, stages and states as your coding tool. **Current app revision** describes the saved definition now; the operation's immutable source commit and template version identify the reviewed build source. A successful build is not a live deployment.

The view shows anything still missing and the next action: inspect progress, review the plan, or ask IT to resolve an uncertain result. Use **Review connections** for runtime enrollment. Builds, company data and execution stay in your cloud.

Before launch, IT runs the [deployment review checklist](/docs/governance#review-before-deployment).
