Skip to Content
Docs

Applications CLI Reference

Resolve an Application manifest, preview changes to a tenant, and deploy with the Contextual CLI.

Use ctxl app to inspect what an Application would deploy, check the destination tenant, and apply the changes. The Application manifest guide explains the resource definitions and references that these commands read.

Before you start

Install a Contextual CLI version with app print and app deploy. Check that both commands are available with ctxl app print --help and ctxl app deploy --help.

For a dry run or deployment, follow CLI setup to sign in to the intended tenant and configure Docker registry access if the manifest builds Worker images. Your CLI identity needs permission to read the resources it checks. To apply a deployment, you also need permission to create or update the resources it deploys.

The examples use the dev stage and shipping-dev CLI configuration from Deploy alongside an existing Service. Substitute your own stage and configuration when working with a different Application.

Dedicated commands

Command Purpose Writes to the tenant
ctxl app print Resolve the manifest locally and print the plan as JSON. No
ctxl app deploy --dry-run Run preflight on the selected tenant and preview Object Type and Worker changes. No
ctxl app deploy Run preflight and apply the deployment. Yes

Both app print and app deploy accept these options.

Option Purpose
--file <path> (-f) Select a manifest. The default is contextual.yaml in the current directory.
--config-id <id> (-C) Choose the CLI configuration that selects the tenant and silo. Omit this option to use the current configuration.
--stage <name> (-s) Select a stage declared in the manifest. A stage selects manifest values.
--var NAME=VALUE Override a declared non-secret variable. Repeat the option to override more than one variable.
--compose-reader <mode> Choose docker, subset, or auto. The default, auto, uses Docker Compose when available and otherwise uses the subset reader.
--pretty Indent JSON. For app deploy, also pass --json to select JSON output.

Inspect the plan

Run this command from the directory containing contextual.yaml, or pass --file to select it.

Terminal
ctxl app print --stage dev --config-id shipping-dev --pretty

app print resolves the manifest and its local files. It uses the selected CLI configuration to resolve target-specific values such as image registry names and can run with a signed-out configuration. Use a dry run to check the plan against the tenant.

Look for complete: true and review order for the planned steps. A step's after list identifies dependencies handled by earlier steps. Its requires list identifies resources it expects to find on the target. If complete is false, the CLI exits with code 1 and lists the problems in issues.

Preview changes in the target tenant

Terminal
ctxl app deploy --stage dev --config-id shipping-dev --dry-run --json --pretty

The dry run performs the same read-only preflight as a deployment. It checks the target for required platform types, referenced resources, and Worker sizes. If the plan calls for an image build, it checks that Docker is available. It stops before building or pushing images or writing to the tenant or the local .contextual/state.json file.

For image references that begin with <tenantId>/worker/ or contextual/worker/platform/ and omit a registry host, the CLI skips the registry lookup. For example, a dry run can pass with acme/worker/invoice-worker:v2 even if only v1 was published. When the platform tries to start the Worker, it needs v2 and can fail to start the Worker if that version is missing. Before deploying, verify that the image version you named is available in the registry.

The changes list covers only Object Types with definitions and Workers. Each entry reports create, update, or unchanged. An unchanged entry requires a local state entry for that target and stage that matches both the planned definition and the current tenant resource. An existing resource can show update with an empty fields list, for example in a fresh checkout. A Worker with an image to build shows create or update. For an update, each image field the build fills is marked deploy-time.

A dry run that passes the checks exits with code 0 and reports dryRun: true and ok: false. In this result, ok: false means no deployment was applied. If the plan or preflight checks fail, the command exits with code 1 and reports issues. That result omits dryRun and changes.

Apply the deployment

Terminal
ctxl app deploy --stage dev --config-id shipping-dev --json --pretty

Use the same manifest, stage, CLI configuration, and inputs as in your dry run, including any variable overrides or Compose reader setting. Check the destination in the confirmation prompt. Press Enter or type y to continue. The CLI checks the Application again and applies the changes in the order shown by the plan.

On success, the CLI exits with code 0 and reports ok: true in JSON output. Check steps for what the deploy applied.

After saving resources, the CLI checks whether each Worker's Agent runs the saved revision and, where applicable, whether a new instance has started. It skips the instance check for scheduled and unchanged Workers. The default readiness timeout is 120 seconds. If a Worker fails the readiness checks, the command reports ok: false and exits with code 1 even if every save succeeded.

Saving a Worker leaves a stopped Agent stopped, which fails the readiness checks. Pass --start on a deployment when you intend to start a stopped Worker's Agent. Use --readiness-timeout <seconds> to change how long the CLI waits or --ignore-instances to skip the instance check. These flags are for deployments that apply changes.

After rollout, test the behavior your solution needs in the target tenant. For example, send a request to an HTTP Worker or check the output of a scheduled run. The rollout checks cover Workers. For a Flow-backed Agent, verify the Flow and Agent binding and test the Agent separately.

Troubleshoot a deployment

If issues lists problems, the deployment was blocked before any steps ran. Each issue has a code, phase, path, and message. Use its path to locate the affected input or resource and its message to see what blocked the deploy.

If the deployment started, check each entry in steps for its outcome and any detail. Earlier changes can remain if a deployment stops partway through. A save with outcome unknown may have reached the tenant. Check the resource in the tenant before retrying. interrupted means a signal stopped the step. not-run means the deploy stopped before attempting the step. In the plan, order[].after shows which steps depend on earlier saves.

For Worker rollout problems, check readiness.rollout.workers. Each entry has a status and guidance with commands to inspect instances and logs. If a Worker's Agent is stopped, stoppedBy identifies whether the platform or an operator stopped it.

Run from a script

Pass --yes (-y) to apply a deployment without an interactive prompt. A deployment with non-interactive input requires this flag. Specify --config-id explicitly so the deploy uses your intended target. A dry run needs no confirmation.

app print writes its JSON plan to stdout. Pass --json to app deploy to write a structured result to stdout. CLI notices and Docker output go to stderr. Use the exit status to distinguish success from failure. A command error, such as a missing manifest or an unknown CLI configuration, can end the command before it emits a plan or deploy result.

Deploy from GitHub Actions

Use a custom GitHub Actions workflow to deploy an Application with ctxl app deploy.

  1. Install the Contextual GitHub App in the GitHub account or organization that owns the repository and grant it access to that repository. In the target Contextual tenant, connect the installation through a GitHub Connection.
  2. In the Connection's Deploy key permissions, grant the deploy identity access to read the Application's dependencies and create or update the resources it deploys.
  3. Give the workflow job id-token: write and use ContextualIO/setup-ctxl-action@v1 with organization set to the target tenant ID. Set CONTEXTUAL_SILO for a nonproduction silo. The action authenticates later CLI steps through GitHub OIDC and sets up Docker registry access.

Use a CLI build that includes ctxl app. From the directory containing contextual.yaml, inspect the plan, check the target tenant with a dry run, and apply the deployment once the checks pass. Replace shipping-dev and dev with your CLI configuration and manifest stage.

Terminal
ctxl app print --config-id shipping-dev --stage dev
ctxl app deploy --config-id shipping-dev --stage dev --dry-run --json
ctxl app deploy --config-id shipping-dev --stage dev --yes --json

For an example of promoting the same commit from Dev to QA with a GitHub Environment secret, see the Application Examples deployment guide.