»Nomad

»Builders

Nomad uses Docker images for building, which are generated by these builders:

»nomad (platform)

Deploy to a nomad cluster as a service using docker.

»Interface

»Examples

deploy {
        use "nomad" {
          region = "global"
          datacenter = "dc1"
          auth {
            username = "username"
            password = "password"
          }
          static_environment = {
            "environment": "production",
            "LOG_LEVEL": "debug"
          }
          service_port = 3000
          replicas = 1
        }
}

»Required Parameters

These parameters are used in the use stanza for this plugin.

»auth

The credentials for docker registry.

  • Type: nomad.AuthConfig

»resources (category)

The amount of resources to allocate to the deployed allocation.

»resources.cpu

Amount of CPU in MHz to allocate to this task.

  • Type: int
  • Optional
  • Default: 100
»resources.memorymb

Amount of memory in MB to allocate to this task.

  • Type: int
  • Optional
  • Default: 300

»Optional Parameters

These parameters are used in the use stanza for this plugin.

»datacenter

The Nomad datacenter to deploy the job to.

  • Type: string
  • Optional
  • Default: dc1

»namespace

The Nomad namespace to deploy the job to.

  • Type: string
  • Optional

»region

The Nomad region to deploy the job to.

  • Type: string
  • Optional
  • Default: global

»replicas

The replica count for the job.

  • Type: int
  • Optional
  • Default: 1

»service_port

TCP port the job is listening on.

  • Type: uint
  • Optional

»static_environment

Environment variables to add to the job.

  • Type: map of string to string
  • Optional

»Output Attributes

Output attributes can be used in your waypoint.hcl as variables via artifact or deploy.

»id

  • Type: string

»name

  • Type: string

»nomad-jobspec (platform)

Deploy to a Nomad cluster from a pre-existing Nomad job specification file.

This plugin lets you use any pre-existing Nomad job specification file to deploy to Nomad. This deployment is able to support all the features of Waypoint. You may use Waypoint's templating features to template the Nomad jobspec with information such as the artifact from a previous build step, entrypoint environment variables, etc.

»Artifact Access

You may use Waypoint's templating features to access information such as the artifact from the build or push stages. An example below shows this by using templatefile mixed with variables such as artifact.image to dynamically configure the Docker image within the Nomad job specification.

»Entrypoint Functionality

Waypoint entrypoint functionality such as logs, exec, app configuration, and more require two properties to be true:

  1. The running image must already have the Waypoint entrypoint installed and configured as the entrypoint. This should happen in the build stage.

  2. Proper environment variables must be set so the entrypoint knows how to communicate to the Waypoint server. This step happens in this deployment stage.

Step 2 does not happen automatically. You must manually set the entrypoint environment variables using the templating feature. One of the examples below shows the entrypoint environment variables being injected.

»URL Service

If you want your workload to be accessible by the Waypoint URL service, you must set the PORT environment variable within your job and be using the Waypoint entrypoint (documented in the previous section).

The PORT environment variable should be the port that your web service is listening on that the URL service will connect to. See one of the examples below for more details.

»Interface

»Examples

// The waypoint.hcl file
deploy {
  use "nomad-jobspec" {
    // Templated to perhaps bring in the artifact from a previous
    // build/registry, entrypoint env vars, etc.
    jobspec = templatefile("${path.app}/app.nomad.tpl")
  }
}

// The app.nomad.tpl file
job "web" {
  datacenters = ["dc1"]

  group "app" {
    task "app" {
      driver = "docker"

      config {
        image = "${artifact.image}:${artifact.tag}"
      }

      env {
        %{ for k,v in entrypoint.env ~}
        ${k} = "${v}"
        %{ endfor ~}

        // Ensure we set PORT for the URL service. This is only necessary
        // if we want the URL service to function.
        PORT = 3000
      }
    }
  }
}

»Required Parameters

These parameters are used in the use stanza for this plugin.

»jobspec

Path to a Nomad job specification file.

  • Type: string

»Optional Parameters

This plugin has no optional parameters.

»Output Attributes

Output attributes can be used in your waypoint.hcl as variables via artifact or deploy.

»id

  • Type: string

»name

  • Type: string