50 lines
1.1 KiB
HCL
50 lines
1.1 KiB
HCL
[[- /* vim: syntax=hcl
|
|
This is a generic, small and reusable valkey task
|
|
It provides no data persistance */ -]]
|
|
|
|
# Local valkey instance
|
|
task "valkey" {
|
|
driver = "docker"
|
|
user = 6379
|
|
|
|
lifecycle {
|
|
hook = "prestart"
|
|
sidecar = true
|
|
}
|
|
|
|
config {
|
|
image = "[[ .docker.base_images.valkey.image ]]"
|
|
readonly_rootfs = true
|
|
force_pull = true
|
|
args = ["/local/valkey.conf"]
|
|
}
|
|
|
|
template {
|
|
data =<<_EOT
|
|
bind 127.0.0.1
|
|
maxmemory {{ env "NOMAD_MEMORY_LIMIT" | parseInt | subtract 5 }}mb
|
|
databases 1
|
|
save ""
|
|
appendonly no
|
|
_EOT
|
|
destination = "local/valkey.conf"
|
|
}
|
|
|
|
resources {
|
|
[[- if and (has . "resources") (has .resources "cpu") ]]
|
|
cpu = [[ .resources.cpu ]]
|
|
[[- else ]]
|
|
cpu = 10
|
|
[[- end ]]
|
|
[[- if and (has . "resources") (has .resources "memory") ]]
|
|
memory = [[ .resources.memory ]]
|
|
[[- else ]]
|
|
memory = 20
|
|
[[- end ]]
|
|
[[- if and (has . "resources") (has .resources "memory_max") ]]
|
|
memory_max = [[ .resources.memory_max ]]
|
|
[[- end ]]
|
|
}
|
|
}
|
|
|