Move redis commander
This commit is contained in:
parent
47da10febf
commit
440c0b0c4c
@ -36,11 +36,3 @@ resource "nomad_job" "redis" {
|
||||
# Block until deployed as there are servics dependent on this one
|
||||
detach = false
|
||||
}
|
||||
|
||||
resource "nomad_job" "rediscommander" {
|
||||
hcl2 {
|
||||
enabled = true
|
||||
}
|
||||
|
||||
jobspec = file("${path.module}/rediscommander.nomad")
|
||||
}
|
||||
|
@ -1,99 +0,0 @@
|
||||
job "rediscommander" {
|
||||
datacenters = ["dc1"]
|
||||
type = "service"
|
||||
|
||||
group "rediscommander" {
|
||||
count = 1
|
||||
|
||||
network {
|
||||
mode = "bridge"
|
||||
|
||||
port "main" {
|
||||
host_network = "wesher"
|
||||
to = 8081
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
name = "rediscommander"
|
||||
provider = "nomad"
|
||||
port = "main"
|
||||
|
||||
tags = [
|
||||
"traefik.enable=true",
|
||||
"traefik.http.routers.rediscommander.entryPoints=websecure",
|
||||
]
|
||||
}
|
||||
|
||||
task "rediscommander" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "rediscommander/redis-commander:latest"
|
||||
ports = ["main"]
|
||||
}
|
||||
|
||||
template {
|
||||
data = <<EOH
|
||||
REDIS_HOSTS=stunnel:127.0.0.1:6379
|
||||
EOH
|
||||
env = true
|
||||
destination = "env"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 50
|
||||
memory = 50
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
16
services/rediscommander.tf
Normal file
16
services/rediscommander.tf
Normal file
@ -0,0 +1,16 @@
|
||||
# module "rediscommander" {
|
||||
# source = "./service"
|
||||
#
|
||||
# name = "rediscommander"
|
||||
# image = "rediscommander/redis-commander:latest"
|
||||
#
|
||||
# ingress = true
|
||||
# service_port = 8081
|
||||
#
|
||||
# use_redis = true
|
||||
#
|
||||
# resources = {
|
||||
# cpu = 50
|
||||
# memory = 50
|
||||
# }
|
||||
# }
|
Loading…
Reference in New Issue
Block a user