Skip to content
Charlie Voiselle edited this page Feb 11, 2022 · 1 revision

layout: commands page_title: "Commands: Run" sidebar_title: "run" description: "Run a new pack or update an existing pack"

Nomad-Pack Run

Command: nomad-pack run

Run a new pack or update an existing pack

Usage

Usage: nomad-pack run <pack-name> [options]

Install the specified Nomad Pack to a configured Nomad cluster.

Examples: # Run an example pack with the default deployment name "example". nomad-pack run example

# Run an example pack with the specified deployment name "dev"
nomad-pack run example --name=dev 

# Run an example pack with override variables in a variable file
nomad-pack run example --var-file="./overrides.hcl"

# Run an example pack with cli variable overrides
nomad-pack run example --var="redis_image_version=latest" --var="redis_resources={"cpu": "1000", "memory": "512"}"

# Run a pack under development from the filesystem - supports current working 
# directory or relative path
nomad-pack run . 

Operation Options

  • -var-file=<string> - Specifies the path to a variable override file. This can be provided multiple times on a single command to result in a list of files.
  • -var=<key=value> - Specifies single override variables in the form of HCL syntax and can be specified multiple times per command.
  • -name=<string> - If set, this will be the unique identifier of this deployed instance of the specified pack. If not set, the pack name will be used. This is useful for running more than one instance of a pack within the same cluster. Note that this name must be globally unique within a cluster. Running the run command multiple times with the same name, will just re-submit the same pack, and apply changes if you have made any to the underlying pack. Be mindful that, whether you have made changes or not, the underlying Allocations will be replaced. When managing packs, the name specified here is the name that should be passed to the plan or destroy commands.

Run Options

  • -registry=<string> - Specific registry name containing the pack to be run.
  • -ref=<string> - Specific git ref of the pack to be run. Supports tags, SHA, and latest. If no ref is specified, defaults to latest.

Using ref with a file path is not supported.

  • -check-index=<uint> - If set, the job is only registered or updated if the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with job plan command.
  • -consul-token=<string> - If set, the passed Consul token is stored in the job before sending to the Nomad servers. This allows passing the Consul token without storing it in the job file. This overrides the token found in the $CONSUL_HTTP_TOKEN environment variable and that found in the job.
  • -consul-namespace=<string> - If set, any services in the job will be registered into the specified Consul namespace. Any template stanza reading from Consul KV will be scoped to the the specified Consul namespace. If Consul ACLs are enabled and the allow_unauthenticated Nomad server Consul configuration is not enabled, then a Consul token must be supplied with appropriate service and kv Consul ACL policy permissions.
  • -vault-token=<string> - If set, the passed Vault token is stored in the job before sending to the Nomad servers. This allows passing the Vault token without storing it in the job file. This overrides the token found in the $VAULT_TOKEN environment variable and that found in the job.
  • -vault-namespace=<string> - If set, the passed Vault namespace is stored in the job before sending to the Nomad servers.
  • -policy-override - Sets the flag to force override any soft mandatory Sentinel policies.
  • -preserve-counts - If set, the existing task group counts will be preserved when updating a job.
  • -hcl1 - If set, the hcl V1 parser will be used to parse the job file.
Clone this wiki locally