Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
install-nomad
supervisor-initd-script.sh
supervisord.conf

README.md

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 Google Image that can be deployed in Google Cloud across a Managed Instance Group using the nomad-cluster module.

This script has been tested on the following operating systems:

  • Ubuntu 16.04
  • Ubuntu 18.04

There is a good chance it will work on other flavors of Debian as well.

Quick start

To install Nomad, use git to clone this repository at a specific tag (see the releases page for all available tags) and run the install-nomad script:

git clone --branch <VERSION> https://github.com/hashicorp/terraform-google-nomad.git
terraform-google-nomad/modules/install-nomad/install-nomad --version 0.6.3

The 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 Google Image (see the nomad-consul-image example for sample code). You can then deploy the Image across a Managed Instance Group using the nomad-cluster module (see the nomad-consul-colocated-cluster and nomad-consul-separate-cluster examples for fully-working sample code).

Command line Arguments

The 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.

Example:

install-nomad --version 0.6.3

How it works

The install-nomad script does the following:

  1. Create a user and folders for Nomad
  2. Install Nomad binaries and scripts
  3. Install supervisord
  4. Follow-up tasks

Create a user and folders for Nomad

Create an OS user named nomad. Create the following folders, all owned by user nomad:

  • /opt/nomad: base directory for Nomad data (configurable via the --path argument).
  • /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 --version argument), and extract the nomad binary into /opt/nomad/bin. Add a symlink to the nomad binary in /usr/local/bin.
  • run-nomad: Copy the run-nomad script into /opt/nomad/bin.

Install supervisord

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.

Follow-up tasks

After the install-nomad script finishes running, you may wish to do the following:

  1. If you have custom Nomad config (.hcl) files, you may want to copy them into the config directory (default: /opt/nomad/config).
  2. If /usr/local/bin isn't already part of PATH, you should add it so you can run the nomad command 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 git.

You can’t perform that action at this time.