2022-03-14 22:56:06 +00:00
|
|
|
job "rediscommander" {
|
|
|
|
datacenters = ["dc1"]
|
|
|
|
type = "service"
|
|
|
|
|
|
|
|
group "rediscommander" {
|
|
|
|
count = 1
|
|
|
|
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
|
|
|
|
port "main" {
|
2023-03-24 23:32:37 +00:00
|
|
|
host_network = "wesher"
|
2022-03-14 22:56:06 +00:00
|
|
|
to = 8081
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "rediscommander"
|
2023-03-24 23:32:37 +00:00
|
|
|
provider = "nomad"
|
2022-03-14 22:56:06 +00:00
|
|
|
port = "main"
|
|
|
|
|
|
|
|
tags = [
|
|
|
|
"traefik.enable=true",
|
2022-03-15 19:02:55 +00:00
|
|
|
"traefik.http.routers.rediscommander.entryPoints=websecure",
|
2022-03-14 22:56:06 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
task "rediscommander" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
|
|
|
image = "rediscommander/redis-commander:latest"
|
|
|
|
ports = ["main"]
|
|
|
|
}
|
|
|
|
|
2022-11-21 00:24:00 +00:00
|
|
|
template {
|
|
|
|
data = <<EOH
|
2023-03-24 23:32:37 +00:00
|
|
|
REDIS_HOSTS=stunnel:127.0.0.1:6379
|
2022-11-21 00:24:00 +00:00
|
|
|
EOH
|
|
|
|
env = true
|
|
|
|
destination = "env"
|
2022-03-14 22:56:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 50
|
|
|
|
memory = 50
|
|
|
|
}
|
|
|
|
}
|
2023-03-24 23:32:37 +00:00
|
|
|
|
|
|
|
task "redis-stunnel" {
|
|
|
|
driver = "docker"
|
|
|
|
|
|
|
|
config {
|
|
|
|
image = "alpine:3.17"
|
|
|
|
args = ["/bin/sh", "${NOMAD_TASK_DIR}/start.sh"]
|
|
|
|
}
|
|
|
|
|
|
|
|
resources {
|
|
|
|
cpu = 100
|
|
|
|
memory = 100
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
set -e
|
|
|
|
apk add stunnel
|
|
|
|
exec stunnel {{ env "NOMAD_TASK_DIR" }}/stunnel.conf
|
|
|
|
EOF
|
|
|
|
destination = "${NOMAD_TASK_DIR}/start.sh"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
syslog = no
|
|
|
|
foreground = yes
|
|
|
|
delay = yes
|
|
|
|
|
|
|
|
[redis_client]
|
|
|
|
client = yes
|
|
|
|
accept = 127.0.0.1:6379
|
|
|
|
{{ range nomadService 1 (env "NOMAD_ALLOC_ID") "redis-tls" -}}
|
|
|
|
connect = {{ .Address }}:{{ .Port }}
|
|
|
|
{{- end }}
|
|
|
|
PSKsecrets = {{ env "NOMAD_SECRETS_DIR" }}/stunnel_psk.txt
|
|
|
|
EOF
|
|
|
|
destination = "${NOMAD_TASK_DIR}/stunnel.conf"
|
|
|
|
}
|
|
|
|
|
|
|
|
template {
|
|
|
|
data = <<EOF
|
|
|
|
{{ with nomadVar "nomad/jobs/rediscommander" -}}
|
|
|
|
{{ .redis_stunnel_psk }}
|
|
|
|
{{- end }}
|
|
|
|
EOF
|
|
|
|
destination = "${NOMAD_SECRETS_DIR}/stunnel_psk.txt"
|
|
|
|
}
|
|
|
|
}
|
2022-03-14 22:56:06 +00:00
|
|
|
}
|
|
|
|
}
|