74 lines
1.4 KiB
HCL
74 lines
1.4 KiB
HCL
job "[[ .instance ]]" {
|
|
|
|
[[ template "common/job_start.tpl" . ]]
|
|
|
|
group "diagrams" {
|
|
[[- $c := merge .diagrams . ]]
|
|
[[ template "common/group_start" $c ]]
|
|
|
|
network {
|
|
mode = "bridge"
|
|
}
|
|
|
|
service {
|
|
name = "[[ .instance ]][[ .consul.suffix ]]"
|
|
port = 8282
|
|
|
|
[[ template "common/connect.tpl" $c ]]
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/health"
|
|
expose = true
|
|
interval = "[[ $c.consul.check.interval ]]"
|
|
timeout = "[[ $c.consul.check.timeout ]]"
|
|
|
|
check_restart {
|
|
limit = 4
|
|
grace = "1m"
|
|
}
|
|
}
|
|
|
|
tags = [
|
|
[[ template "common/traefik_tags" $c ]]
|
|
]
|
|
}
|
|
|
|
task "diagrams" {
|
|
driver = "[[ $c.nomad.driver ]]"
|
|
|
|
config {
|
|
[[ template "common/image" $c ]]
|
|
pids_limit = 200
|
|
volumes = [
|
|
"local/PreConfig.js:/opt/tomcat/webapps/draw/js/PreConfig.js",
|
|
"local/PostConfig.js:/opt/tomcat/webapps/draw/js/PostConfig.js"
|
|
]
|
|
}
|
|
|
|
env {
|
|
TMPDIR = "/local/tmp"
|
|
TOMCAT_ADDRESS = "127.0.0.1"
|
|
}
|
|
|
|
[[ template "common/file_env" $c ]]
|
|
|
|
template {
|
|
data =<<_EOT
|
|
[[ template "diagrams/PreConfig.js.tpl" $c ]]
|
|
_EOT
|
|
destination = "local/PreConfig.js"
|
|
}
|
|
|
|
template {
|
|
data =<<_EOT
|
|
[[ template "diagrams/PostConfig.js.tpl" $c ]]
|
|
_EOT
|
|
destination = "local/PostConfig.js"
|
|
}
|
|
|
|
[[ template "common/resources" $c ]]
|
|
}
|
|
}
|
|
}
|