Last active
January 28, 2023 04:03
-
-
Save Neutrollized/1494efb1bee437ba982058dd4d8250e0 to your computer and use it in GitHub Desktop.
Medium: Getting started with HashiCorp Nomad just got easier in v1.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
job "redis-client" { | |
datacenters = ["gcp-test"] | |
group "redis" { | |
count = 1 | |
task "client" { | |
driver = "docker" | |
template { | |
destination = "${NOMAD_SECRETS_DIR}/redis_password.vars" | |
env = true | |
change_mode = "restart" | |
data = <<EOF | |
{{- with nomadVar "nomad/jobs/redis-client" -}} | |
REDISCLI_AUTH = {{ .rediscli_password }} | |
{{- end -}} | |
EOF | |
} | |
template { | |
destination = "${NOMAD_TASK_DIR}/service.vars" | |
env = true | |
change_mode = "restart" | |
data = <<EOF | |
{{- range nomadService "redis-server" -}} | |
REDIS_SERVER_HOST={{ .Address }} | |
REDIS_SERVER_PORT={{ .Port }} | |
{{- end -}} | |
EOF | |
} | |
config { | |
image = "redis:7.0.7-alpine" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment