job "damienradtkecom" {
region = "global"
datacenters = ["ca-central"]
type = "service"
group "server" {
count = 2
constraint {
attribute = "${node.class}"
operator = "!="
value = "load-balancer"
}
update {
max_parallel = 1
}
task "server" {
driver = "exec"
config {
# Hugo needs to run from the blog directory.
# For now, this needs to be run via the shell.
# See https://github.com/hashicorp/nomad/issues/2224
command = "/bin/sh"
args = [
"-c",
"cd local/blog && exec ../hugo server --baseURL=https://damienradtke.com/ --appendPort=false --watch=false --bind=0.0.0.0 --port=${NOMAD_PORT_http}",
]
}
service {
name = "${JOB}-${TASK}"
port = "http"
check {
type = "http"
protocol = "http"
port = "http"
interval = "10s"
timeout = "2s"
path = "/"
}
tags = ["urlprefix-damienradtke.com/"]
}
resources {
cpu = 20 # MHz, the minimum value
memory = 50 # MB
network {
port "http" {}
}
}
artifact {
source = "github.com/dradtke/blog"
destination = "local/blog/"
options {
ref = "<%= ENV['REF'] || 'master' %>"
}
}
artifact {
source = "https://github.com/gohugoio/hugo/releases/download/v0.69.2/hugo_0.69.2_Linux-64bit.tar.gz"
options {
checksum = "sha256:167d8fb2db1728c0b24914030bab498e38d8ae1dcb01f792672b8a0085903ddf"
}
}
}
}
}
// vim: set tabstop=4 shiftwidth=4: