Nomad Deployment Commands
The Nomad deployment commands help manage Nomad job deployments by automating image version updates and job execution.
Overview
The pfy nomad command group provides utilities for:
- Updating Docker image references in Nomad HCL files
- Validating Nomad job configurations
- Planning job changes
- Deploying jobs to Nomad clusters
These commands integrate with the CLI's version management to streamline deployment workflows.
Commands
pfy nomad deploy
Update image/tag in a Nomad HCL file and deploy the job.
Usage:
pfy nomad deploy -f <file> [options]Flags:
-f, --file- Path to the Nomad HCL file (usesnomad_filefrom project.yaml if not specified)-i, --image- Docker image name (e.g.,ghcr.io/productifyfw/manager)-t, --tag- Docker image tag/version--use-project-version, -pv- Use version fromproject.yamlas the image tag--plan-only- Only runnomad job planwithout deploying--skip-validation- Skip thenomad job validatestep--dry-run- Show what would be changed without modifying files or deploying
Examples:
Deploy with a specific tag:
pfy nomad deploy -f manager/nomad/manager.nomad --tag v1.2.3Deploy using the version from project.yaml:
pfy nomad deploy -f manager/nomad/manager.nomad --use-project-versionIf you've set nomad_file in project.yaml, you can omit the -f flag:
# Requires nomad_file configured in project.yaml
pfy nomad deploy --use-project-versionUpdate both image and tag:
pfy nomad deploy -f manager/nomad/manager.nomad \
--image ghcr.io/productifyfw/manager \
--tag v1.2.3Plan before deploying:
pfy nomad deploy -f manager/nomad/manager.nomad --tag v1.2.3 --plan-onlyPreview changes without applying:
pfy nomad deploy -f manager/nomad/manager.nomad --tag v1.2.3 --dry-runWorkflow:
- Updates the image reference in the HCL file
- Validates the job file (unless
--skip-validation) - Runs
nomad job plan(if--plan-only) ornomad job run
pfy nomad update-image
Update only the image/tag in a Nomad HCL file without deploying.
Usage:
pfy nomad update-image -f <file> [options]Flags:
-f, --file(required) - Path to the Nomad HCL file-i, --image- Docker image name-t, --tag- Docker image tag/version--use-project-version, -pv- Use version fromproject.yamlas the image tag
Examples:
Update only the tag:
pfy nomad update-image -f manager/nomad/manager.nomad --tag v1.2.3Update using project version:
pfy nomad update-image -f manager/nomad/manager.nomad --use-project-versionpfy nomad validate
Validate a Nomad HCL job file.
Usage:
pfy nomad validate -f <file>Flags:
-f, --file(required) - Path to the Nomad HCL file
Example:
pfy nomad validate -f manager/nomad/manager.nomadThis runs nomad job validate to check the job file syntax and configuration.
pfy nomad plan
Run nomad job plan on a HCL file to preview changes.
Usage:
pfy nomad plan -f <file>Flags:
-f, --file(required) - Path to the Nomad HCL file
Example:
pfy nomad plan -f manager/nomad/manager.nomadThis shows what changes would be made to the Nomad cluster without actually applying them.
Integration with Version Management
The Nomad commands integrate seamlessly with the CLI's version management system:
# Bump version in project.yaml
pfy version bump --part minor
# Deploy using the new version
pfy nomad deploy -f manager/nomad/manager.nomad --use-project-versionThis workflow ensures consistency between your project version and deployed container versions.
Common Workflows
Simple Deployment
# Update version
pfy version set --version 1.2.3
# Deploy to Nomad
pfy nomad deploy -f manager/nomad/manager.nomad --use-project-versionSafe Deployment with Planning
# Update and plan
pfy nomad deploy -f manager/nomad/manager.nomad --tag v1.2.3 --plan-only
# Review the plan output, then deploy
pfy nomad deploy -f manager/nomad/manager.nomad --tag v1.2.3Multi-Environment Deployment
# Development
pfy nomad deploy -f nomad/dev/manager.nomad --tag dev-latest
# Staging
pfy nomad deploy -f nomad/staging/manager.nomad --tag v1.2.3
# Production
pfy nomad deploy -f nomad/prod/manager.nomad --tag v1.2.3 --plan-only
# Review plan, then:
pfy nomad deploy -f nomad/prod/manager.nomad --tag v1.2.3Prerequisites
- Nomad CLI must be installed and accessible in your PATH
- Nomad cluster must be configured (via environment variables or Nomad config)
- Appropriate permissions to deploy jobs to the target Nomad cluster