# to 1.
count = 1
+ # https://www.nomadproject.io/docs/job-specification/volume
+ %{ if use_host_volume }
+ volume "prod-volume1-nginx" {
+ type = "host"
+ read_only = false
+ source = "${host_volume}"
+ }
+ %{ endif }
+
# The restart stanza configures a tasks's behavior on task failure. Restarts
# happen on the client that is running the task.
+ #
+ # https://www.nomadproject.io/docs/job-specification/restart
+ #
restart {
- interval = "10m"
- attempts = 2
+ interval = "30m"
+ attempts = 40
delay = "15s"
- mode = "fail"
+ mode = "delay"
}
# The "task" stanza creates an individual unit of work, such as a Docker
# documentation for more information.
config {
image = "nginx:stable"
- dns_servers = [ "$${attr.unique.network.ip-address}" ]
port_map {
https = 443
}
template {
data = <<EOH
upstream storage {
- server storage0.storage.service.consul:9000;
- server storage1.storage.service.consul:9000;
- server storage2.storage.service.consul:9000;
- server storage3.storage.service.consul:9000;
+ {{ range service "storage" }}
+ server {{ .Address }}:{{ .Port }};
+ {{ end }}
}
EOH
destination = "custom/upstream.conf"
# https://www.nomadproject.io/docs/job-specification/resources.html
#
resources {
- cpu = 1000
- memory = 1024
+ cpu = 2000
+ memory = 4096
network {
mode = "bridge"
port "https" {