Skip to content

Instantly share code, notes, and snippets.

@robbat2
Created February 20, 2018 06:08
Show Gist options
  • Select an option

  • Save robbat2/48deb7024c12aed8f8a6525f2c70deed to your computer and use it in GitHub Desktop.

Select an option

Save robbat2/48deb7024c12aed8f8a6525f2c70deed to your computer and use it in GitHub Desktop.
#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
image="docker.elastic.co/elasticsearch/elasticsearch"
image_tag="6.0.1"
volume="/var/lib/elasticsearch/data/:/usr/share/elasticsearch/data/"
publish="127.0.0.1:9200:9200"
env="discovery.type=single-node"
command="docker"
# no -d, we want to track it ourselves, since upstream docker refuses to export
# a PID for us: https://github.com/moby/moby/issues/25380
command_args="run --restart unless-stopped"
for k in volume publish env ; do
for _ in ${!k}; do
command_args="${command_args} --${k}=$_"
done
done
command_args="${command_args} ${image}:${image_tag}"
start_stop_daemon_args="--stdout /dev/null"
command_background=true
pidfile="/var/run/elasticsearch-packages.pid"
description="Starts elasticsearch docker container for p.g.o"
depend() {
need net.lo docker
# Try to start ES before thin
before thin.packages
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment