Created
February 12, 2015 15:54
-
-
Save cgswong/cbca95f2cbe9ed0554be to your computer and use it in GitHub Desktop.
Elasticsearch service
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
[Unit] | |
Description=ElasticSearch service | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
TimeoutSec=180 | |
EnvironmentFile=/etc/environment | |
ExecStartPre=/usr/bin/mkdir -p /data/es | |
ExecStartPre=/usr/bin/docker pull cgswong/elasticsearch | |
ExecStart=/bin/bash -c '\ | |
curl -f ${COREOS_PRIVATE_IPV4}:4001/v2/keys/services/logging/es; \ | |
if [ "$?" = "0" ]; then \ | |
UNICAST_HOSTS=$(etcdctl ls --recursive /services/logging/es \ | |
| sed "s/\/services\/logging\/es\///g" \ | |
| sed "s/$/:9300/" \ | |
| paste -s -d","); \ | |
else \ | |
UNICAST_HOSTS=""; \ | |
fi; \ | |
/usr/bin/docker run \ | |
--name %p-%i \ | |
--publish 9200:9200 \ | |
--publish 9300:9300 \ | |
--volume /data/es:/data \ | |
cgswong/elasticsearch \ | |
/elasticsearch/bin/elasticsearch \ | |
--node.name=%p-%i \ | |
--cluster.name=elk01 \ | |
--network.publish_host=${COREOS_PRIVATE_IPV4} \ | |
--discovery.zen.ping.multicast.enabled=false \ | |
--discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS' | |
ExecStop=/usr/bin/docker stop %p-%i | |
ExecStop=/usr/bin/docker rm %p-%i | |
[X-Fleet] | |
Conflicts=%p@*.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment