66 lines
1018 B
HCL
66 lines
1018 B
HCL
job "redis" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
group "cache" {
|
|
count = 1
|
|
|
|
ephemeral_disk {
|
|
migrate = true
|
|
sticky = true
|
|
size = 300
|
|
}
|
|
|
|
network {
|
|
mode = "bridge"
|
|
|
|
port "main" {
|
|
host_network = "loopback"
|
|
to = 6379
|
|
}
|
|
}
|
|
|
|
service {
|
|
name = "redis"
|
|
port = "main"
|
|
|
|
connect {
|
|
sidecar_service {
|
|
proxy {
|
|
local_service_port = 6379
|
|
}
|
|
}
|
|
|
|
sidecar_task {
|
|
resources {
|
|
cpu = 50
|
|
memory = 50
|
|
}
|
|
}
|
|
}
|
|
|
|
# check {
|
|
# name = "alive"
|
|
# type = "tcp"
|
|
# interval = "10s"
|
|
# timeout = "2s"
|
|
# }
|
|
}
|
|
|
|
task "main" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "redis:6"
|
|
args = ["redis-server", "--save", "60", "1", "--loglevel", "warning"]
|
|
ports = ["main"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 100
|
|
memory = 1024
|
|
}
|
|
}
|
|
}
|
|
}
|