deployment
pfy deployment reads and edits a deployment's spec, the structured description (image, ports, resources, health checks, scaling, ...) that pfy nomad render|deploy turn into a Nomad job. get and set work on the Manager directly; snapshot and apply move the spec through a file so you can review and commit it.
Synopsis
pfy deployment <subcommand> [flags]Description
Every (application, environment) pair, plus one per dedicated tenant and one per backend service, has a Deployment row on the Manager carrying a deployment spec: image, ports, resources, health checks, env wiring, scaling, migration, extra_hcl. pfy nomad render|deploy render Nomad jobs from it.
pfy deployment is the command-line equivalent of the Manager's deployment editor. get/set read and write the spec directly. snapshot exports it to a file and apply writes a file back, so you can review the change in a pull request first.
Target flags
All subcommands share the deployment targeting flags: --env/-e (project.yaml alias), --app (application ID), --deployment-id, --name, --tenant (dedicated deployment), --service (backend service; default: the primary).
deployment get
Print a deployment's spec.
pfy deployment get --env prod [-o yaml|json]| Flag | Short | Description |
|---|---|---|
--output | -o | Output format: yaml (default) or json. This local flag shadows the root -o; text is not accepted here |
Example
pfy deployment get --env prodimage: ghcr.io/acme/myapp
count: 2
resources:
cpu_mhz: 500
memory_mb: 512
health:
path: /healthz
…With --verbose, a comment line naming the deployment ID, upstream, and spec hash is printed first.
deployment set
Set spec fields via dotted paths and/or bulk-apply a spec file.
pfy deployment set --env prod --field resources.memory_mb=512 --field count=3
pfy deployment set --env prod --file spec.yaml| Flag | Description |
|---|---|
--field | Dotted spec path and value, e.g. resources.memory_mb=512 (repeatable) |
--file | Bulk-apply a spec file (yaml or json) on top of the current spec |
Field values are converted by a simple rule: true/false become booleans, whole numbers become integers, everything else stays a string. Numeric path segments index into existing list elements (ports.0.to=8080); growing or shrinking a list needs --file. To turn a block off use scaling.enabled=false / migrate.enabled=false; to empty a list, use --file with an explicit empty list (domains: []). When both flags are given, --file is applied first, then the --field edits. At least one of them is required.
Updated deployment <id> (spec 3f9a2c…)deployment snapshot
Export a deployment's spec to a file for git-anchored review.
pfy deployment snapshot --env prod [--out <path>]| Flag | Description |
|---|---|
--out | Output path. Default: deploy/spec.<env>[.<service>][.<tenant>].yaml; the service segment is absent for the application's primary service |
Examples
pfy deployment snapshot --env prod # -> deploy/spec.prod.yaml
pfy deployment snapshot --env prod --tenant acme # -> deploy/spec.prod.acme.yaml
pfy deployment snapshot --env prod --service api # -> deploy/spec.prod.api.yamlWrote spec snapshot to deploy/spec.prod.yaml (spec 3f9a2c…)deployment apply
Apply a spec file back to a deployment; a snapshot round-trips losslessly. The target is not read from the file name: pass the same target flags you used for the snapshot (--env, and --tenant/--service where they apply).
pfy deployment apply <spec-file> --env prod
pfy deployment apply deploy/spec.prod.acme.yaml --env prod --tenant acmeApplied deploy/spec.prod.yaml to deployment <id> (spec 3f9a2c…)Absent means keep, present means apply
A spec file does not have to be complete. Whether a field is absent or present is what decides between keeping and overwriting:
| In the file | Effect |
|---|---|
| Field omitted | The Manager keeps what it has stored |
scaling: / migrate: block present | Applied as written, including enabled: false, which turns it off |
List field present but empty (domains: []) | Clears the stored list |
| List field omitted | The stored list is kept |
So turning scaling off is scaling: {enabled: false}, not deleting the block; deleting it means "leave scaling alone". This is what lets a snapshot round-trip losslessly: a spec you exported, applied unchanged, produces the same deployment.
Review workflow
# 1. Export the current spec into the repo
pfy deployment snapshot --env prod
# 2. Edit, review, and commit it
$EDITOR deploy/spec.prod.yaml
git add deploy/spec.prod.yaml && git commit -m "Bump prod memory"
# 3. Apply it back to the Manager
pfy deployment apply deploy/spec.prod.yaml --env prod
# 4. Deploy from the updated spec
pfy nomad deploy --env prod --tag v1.2.3 --yesSee Also
- nomad - Render and deploy jobs from the spec
- deploy diff - Detect spec vs. repo vs. cluster drift
- tenant - Targeting dedicated deployments
- Generated Artifacts - The rendering model