Nomad Install Script
This folder contains a script for installing Nomad and its dependencies. You can use this script, along with the run-nomad script it installs to create a Nomad Amazon Machine Image (AMI) that can be deployed in AWS across an Auto Scaling Group using the nomad-cluster module.
This script has been tested on the following operating systems:
- Ubuntu 16.04
- Ubuntu 18.04
- Amazon Linux
There is a good chance it will work on other flavors of Debian, CentOS, and RHEL as well.
To install Nomad, use
git to clone this repository at a specific tag (see the releases page
for all available tags) and run the
git clone --branch <VERSION> https://github.com/hashicorp/terraform-aws-nomad.git terraform-aws-nomad/modules/install-nomad/install-nomad --version 0.5.4
install-nomad script will install Nomad, its dependencies, and the run-nomad script.
You can then run the
run-nomad script when the server is booting to start Nomad and configure it to automatically
join other nodes to form a cluster.
We recommend running the
install-nomad script as part of a Packer template to create a
Nomad Amazon Machine Image (AMI) (see the
nomad-consul-ami example for sample code). You can then deploy the AMI across an Auto
Scaling Group using the nomad-cluster module (see the
nomad-consul-separate-cluster examples for fully-working sample code).
Command line Arguments
install-nomad script accepts the following arguments:
version VERSION: Install Nomad version VERSION. Required.
path DIR: Install Nomad into folder DIR. Optional.
user USER: The install dirs will be owned by user USER. Optional.
install-nomad --version 0.5.4
How it works
install-nomad script does the following:
- Create a user and folders for Nomad
- Install Nomad binaries and scripts
- Install supervisord
- Follow-up tasks
Create a user and folders for Nomad
Create an OS user named
nomad. Create the following folders, all owned by user
/opt/nomad: base directory for Nomad data (configurable via the
/opt/nomad/bin: directory for Nomad binaries.
/opt/nomad/data: directory where the Nomad agent can store state.
/opt/nomad/config: directory where the Nomad agent looks up configuration.
/opt/nomad/log: directory where the Nomad agent will store log files.
Install Nomad binaries and scripts
Install the following:
nomad: Download the Nomad zip file from the downloads page (the version number is configurable via the
--versionargument), and extract the
/opt/nomad/bin. Add a symlink to the
run-nomad: Copy the run-nomad script into
Install supervisord. We use it as a cross-platform supervisor to ensure Nomad is started whenever the system boots and restarted if the Nomad process crashes.
install-nomad script finishes running, you may wish to do the following:
- If you have custom Nomad config (
.hcl) files, you may want to copy them into the config directory (default:
/usr/local/binisn't already part of
PATH, you should add it so you can run the
nomadcommand without specifying the full path.
Why use Git to install this code?
We needed an easy way to install these scripts that satisfied a number of requirements, including working on a variety
of operating systems and supported versioning. Our current solution is to use
git, but this may change in the future.
See Package Managers for
a full discussion of the requirements, trade-offs, and why we picked