Introduction to Nomad Pack
This guide will walk you through basic usage of Nomad Pack, a package manager and templating tool for Nomad.
By the end of this guide, you will know what Nomad Pack does, be able to deploy applications to Nomad using Nomad Pack, and discover packs built by the Nomad community.
What is Nomad Pack
Nomad Pack is a templating and packaging tool used with HashiCorp Nomad.
Nomad Pack is used to:
- Easily deploy popular applications to Nomad
- Re-use common patterns across internal applications
- Find and share job specifications with the Nomad community
Nomad Pack can be thought of as a templating and deployment tool like Levant with the ability to pull from remote registries and deploy multiple resources together, like Helm.
Requirements
- A Nomad cluster available
- Nomad cluster address defined in the
NOMAD_ADDR
environment variable.
Note
If Nomad ACLs are enabled, a token with proper permissions must be defined in the NOMAD_TOKEN
environment variable.
Installing Nomad Pack
To use Nomad Pack, download the binary for your system from HashiCorp Releases.
After downloading Nomad Pack, unzip the package, and make sure that the nomad-pack
binary is available on your PATH.
Alternatively, you can install it with Homebrew if you are on MacOS.
You can now run nomad-pack
.
Basic use
To get started, run the list
command to see which packs are available to deploy.
The first time you run the list
command, Nomad Pack will add a nomad/packs
directory to your desktop user's cache directory—$XDG_CACHE_DIR
on Linux,
~/Library/Caches
on macOS, %AppData%
on Windows, etc. This folder stores
information about cloned registries and their available packs.
During initializing, Nomad Pack downloads a default registry of packs from the Nomad Pack community registry.
To deploy one of these packs, use the run
command. This deploys each job defined in the pack to Nomad.
To deploy the hello_world
pack, you would run the following command:
Note
The syntax for Nomad Pack is different in version 0.1. To run packs written with the old syntax, provide the --parser-v1
flag.
Each pack defines a set of variables that can be provided by the user. To get information on the pack
and to see which variables can be passed in, run the info
command.
Values for these variables are provided using the --var
flag. Update your pack using
the following command:
Values can also be provided by passing in a variables file with the -f
flag.
To see a list of deployed packs, run the status
command
To see the status of the jobs deployed by a pack, run the status
command with the pack name.
To remove all the resources deployed by a pack, run the destroy
command with the
pack name.
To stop the jobs without removing them from Nomad, use the stop
command:
Adding non-default Pack registries
When using Nomad Pack, the default registry for packs is the Nomad Pack Community Registry. Packs from this registry will be made automatically available.
You can add more registries by using the registry add
command. For instance, if you want to add a registry from GitLab with the alias my_packs
, you can run the following command to download the registry and its contents.
To view the available registries, including yours, run the registry list
command.
To view the available packs, including yours, run the list
command.
You can deploy packs from this registry with the run
command and the alias given
to the registry, in this case my_packs
.
Next steps
In this tutorial you learned what Nomad Pack does, how to deploy applications to Nomad using Nomad Pack, and how to discover packs built by the Nomad community.
Continue on to the Detailed Usage Tutorial for more detailed information about how to use Nomad Pack.