Created
November 4, 2016 19:06
-
-
Save smuthali/ef37415250138b8a10877572eb7f90a5 to your computer and use it in GitHub Desktop.
Zookeeper
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
# Zookeeper | |
job "zookeeper" { | |
# Specify Region | |
region = "uswest-fremont" | |
# Specify Datacenter | |
datacenters = [ "fremont-dc1"] | |
# Specify job type | |
type = "service" | |
# Run tasks in serial or parallel (1 for serial) | |
update { | |
max_parallel = 1 | |
} | |
# define group | |
group "zk-docker" { | |
# define the number of times the tasks need to be executed | |
count = 3 | |
# define job constraints | |
constraint { | |
attribute = "${attr.kernel.name}" | |
value = "linux" | |
} | |
constraint { | |
attribute = "${meta.zk_host_key}" | |
value = "zookeeper" | |
} | |
# specify the number of attemtps to run the job within the specified interval | |
restart { | |
attempts = 10 | |
interval = "5m" | |
delay = "25s" | |
mode = "delay" | |
} | |
task "zookeeper" { | |
driver = "docker" | |
artifact { | |
source = "https://gist.githubusercontent.com/smuthali/d267efdc67f269efefeebf7668618a69/raw/1b7c066deb1a9da44a455f9c72cf79455c7f256e/zoo.tpl" | |
destination = "local" | |
} | |
artifact { | |
source = "https://gist.githubusercontent.com/smuthali/82b5e39650f9a29032391c7e49b96ed2/raw/f8e90f17848d3538b0cb1d8ab527c37a128f2e8c/myid.tpl" | |
destination = "local" | |
} | |
template { | |
source = "local/zoo.tpl" | |
destination = "/opt/zookeeper/config/zoo.cfg" | |
change_mode = "noop" | |
} | |
template { | |
source = "local/myid.tpl" | |
destination = "/opt/zookeeper/datadir/myid" | |
change_mode = "noop" | |
} | |
config { | |
image = <REDACTED> | |
labels { | |
group = "zk-docker" | |
} | |
auth { | |
username = <REDACTED> | |
password = <REDACTED> | |
} | |
port_map { | |
zoo_port = 2181/tcp | |
zoo_peer1 = 2888/tcp | |
zoo_peer2 = 3888/tcp | |
} | |
volumes = [ | |
"/opt/zookeeper/config:/opt/zookeeper/conf", | |
"/opt/zookeeper/datadir:/tmp/zookeeper" | |
] | |
} | |
resources { | |
cpu = 100 | |
memory = 128 | |
network { | |
mbits = 10 | |
port "zoo_port" { static = 2181 } | |
port "zoo_peer1" { static = 2888 } | |
port "zoo_peer2" { static = 3888 } | |
} | |
} | |
service { | |
tags = ["zookeeper"] | |
check { | |
type = "script" | |
name = "zookeeper_docker_check" | |
command = "/etc/consul.d/config/zk_check.sh" | |
interval = "60s" | |
timeout = "5s" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment