Created
April 1, 2022 21:30
-
-
Save schmichael/91743344941283025394030d6e396ba8 to your computer and use it in GitHub Desktop.
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 "example" { | |
datacenters = ["dc1"] | |
group "cache" { | |
network { | |
port "db" { | |
to = 6379 | |
} | |
} | |
task "redis" { | |
driver = "docker" | |
config { | |
image = "redis:3.2" | |
ports = ["db"] | |
} | |
service { | |
provider = "nomad" | |
port = "db" | |
} | |
resources { | |
cpu = 500 | |
memory = 256 | |
} | |
} | |
} | |
} |
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 "example" { | |
datacenters = ["dc1"] | |
update { max_parallel = 0 } | |
group "logger" { | |
task "logger" { | |
driver = "docker" | |
config { | |
image = "redis:3.2" | |
command = "/bin/sh" | |
args = ["-c", "cat /local/out && sleep 9000"] | |
} | |
template { | |
data = <<EOF | |
Services: | |
{{ range nomadService "example-cache" }} | |
--> {{ .Address }}:{{ .Port }} | |
{{ end }} | |
The End | |
EOF | |
destination = "local/out" | |
} | |
} | |
} | |
group "cache" { | |
count = 2 | |
network { | |
port "db" { | |
to = 6379 | |
} | |
} | |
service { | |
port = "db" | |
provider = "nomad" | |
} | |
task "redis" { | |
driver = "docker" | |
config { | |
image = "redis:3.2" | |
ports = ["db"] | |
} | |
resources { | |
cpu = 500 | |
memory = 256 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment