75 lines
1.2 KiB
HCL
75 lines
1.2 KiB
HCL
job "consul-example" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
constraint {
|
|
attribute = "${attr.kernel.name}"
|
|
value = "linux"
|
|
}
|
|
|
|
update {
|
|
max_parallel = 1
|
|
min_healthy_time = "10s"
|
|
healthy_deadline = "3m"
|
|
progress_deadline = "10m"
|
|
auto_revert = false
|
|
canary = 0
|
|
}
|
|
|
|
migrate {
|
|
max_parallel = 1
|
|
health_check = "checks"
|
|
min_healthy_time = "10s"
|
|
healthy_deadline = "5m"
|
|
}
|
|
|
|
group "group" {
|
|
count = 3
|
|
|
|
network {
|
|
port "db" {}
|
|
}
|
|
|
|
restart {
|
|
attempts = 2
|
|
interval = "30m"
|
|
delay = "15s"
|
|
mode = "fail"
|
|
}
|
|
|
|
ephemeral_disk {
|
|
size = 300
|
|
}
|
|
|
|
task "example" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "busybox:1"
|
|
command = "nc"
|
|
args = ["-ll", "-p", "1234", "-e", "/bin/cat"]
|
|
|
|
ports = ["db"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 100
|
|
memory = 100
|
|
}
|
|
|
|
service {
|
|
name = "consul-example"
|
|
tags = ["global", "cache"]
|
|
port = "db"
|
|
|
|
check {
|
|
name = "alive"
|
|
type = "tcp"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|