Skip to content

Instantly share code, notes, and snippets.

View schmichael's full-sized avatar

Michael Schurter schmichael

View GitHub Profile
job "hello" {
datacenters = ["dc1"]
type = "batch"
periodic {
cron = "* * * * * *"
}
task "hello" {

nomad job restart RFC

While Nomad has the ability to restart individual allocations and tasks, it lack the ability to restart entire jobs.

A new `nomad job restart command will fill this gap by adding the ability to restart all allocations for a job.

Behavior

Functionally job restart will be as if the user scripted a rolling nomad alloc restart for all allocs of a given job. Importantly job restart will not reschedule any allocations. It can be thought of an inplace update with nothing being updated.

job "workdir" {
type = "batch"
datacenters = ["dc1"]
task "workdir" {
driver = "exec"
config {
work_dir = "/etc"
command = "/usr/bin/pwd"
@schmichael
schmichael / simple.hcl
Last active August 11, 2021 22:25
Simple Nomad Hello World Job
job "example" {
datacenters = ["dc1"]
group "hello" {
task "hello" {
driver = "docker"
config {
image = "redis:3.2"
command = "/bin/bash"
time="2021-08-10T18:35:26Z" level=info msg="Input arguments: /px-oci-mon -c px-cluster-nomadv1 -a -b --endpoint 0.0.0.0:9015"
time="2021-08-10T18:35:26Z" level=info msg="Updated arguments: /px-oci-mon -c px-cluster-nomadv1 -a -b" install-opts=--upgrade
time="2021-08-10T18:35:26Z" level=info msg="OCI-Monitor computed version v2.8.0-gd252e59e-dirty"
time="2021-08-10T18:35:26Z" level=info msg="REAPER: Starting ..."
time="2021-08-10T18:35:26Z" level=info msg="Service handler initialized via as DBus{type:dbus,svc:portworx.service,id:0xc000543440}"
time="2021-08-10T18:35:26Z" level=info msg="Setting up container handler"
time="2021-08-10T18:35:26Z" level=info msg="> run-host: /bin/sh -c cat /etc/crictl.yaml || cat /var/vcap/store/crictl.yaml"
time="2021-08-10T18:35:26Z" level=info msg="Locating my container handler"
time="2021-08-10T18:35:26Z" level=info msg="Negotiated Docker API version: 1.32"
time="2021-08-10T18:35:26Z" level=info msg="> Using Docker as container handler"
job "min" {
datacenters = ["dc1"]
update {
stagger = "30s"
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "10m"
progress_deadline = "15m"
auto_revert = false
package main
import (
"log"
"os"
"time"
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/jobspec"
)

IMPROVEMENTS:

  • api: Added NewSystemJob helper function to create base system job object. [GH-10861]
  • build: no longer use vendor directory [GH-10898]
  • cli: Added a -task flag to alloc restart and alloc signal for consistent UX with alloc exec and alloc logs [GH-10859]
  • consul/connect: automatically set CONSUL_TLS_SERVER_NAME for connect native tasks [GH-10804]
  • ui: Added new screen to dispatch a parameterized batch job [GH-10675]
  • ui: Handle ACL token when running behind a reverse proxy [GH-10563]
github.com/hashicorp/nomad cloud.google.com/go/storage@v1.0.0
github.com/hashicorp/nomad github.com/Azure/go-autorest/autorest@v0.11.4
github.com/hashicorp/nomad github.com/Azure/go-autorest/autorest/azure/auth@v0.5.1
github.com/hashicorp/nomad github.com/LK4D4/joincontext@v0.0.0-20171026170139-1724345da6d5
github.com/hashicorp/nomad github.com/Microsoft/go-winio@v0.4.15-0.20200113171025-3fe6c5262873
github.com/hashicorp/nomad github.com/Microsoft/hcsshim@v0.8.8-0.20200312192636-fd0797d766b1
github.com/hashicorp/nomad github.com/NVIDIA/gpu-monitoring-tools@v0.0.0-20180829222009-86f2a9fac6c5
github.com/hashicorp/nomad github.com/NYTimes/gziphandler@v1.0.1
github.com/hashicorp/nomad github.com/armon/circbuf@v0.0.0-20150827004946-bbbad097214e
github.com/hashicorp/nomad github.com/armon/go-metrics@v0.3.4
job "example" {
datacenters = ["dc1"]
group "cache" {
network {
port "db" {
to = 6379
}
}