docker-minecraft-server/elasticsearch/start

72 lines
1.6 KiB
Plaintext
Raw Normal View History

#!/bin/sh
if [ -f /conf/env ]; then
. /conf/env
fi
if [ ! -e /conf/elasticsearch.* ]; then
cp $ES_HOME/config/elasticsearch.yml /conf
fi
if [ ! -e /conf/logging.* ]; then
cp $ES_HOME/config/logging.yml /conf
fi
2015-10-30 00:58:28 +00:00
OPTS="$OPTS -Des.path.conf=/conf \
2014-11-15 18:05:01 +00:00
-Des.path.data=/data \
-Des.path.logs=/data \
-Des.transport.tcp.port=9300 \
-Des.http.port=9200"
if [ -n "$CLUSTER" ]; then
OPTS="$OPTS -Des.cluster.name=$CLUSTER"
if [ -n "$CLUSTER_FROM" ]; then
if [ -d /data/$CLUSTER_FROM -a ! -d /data/$CLUSTER ]; then
echo "Performing cluster data migration from $CLUSTER_FROM to $CLUSTER"
mv /data/$CLUSTER_FROM /data/$CLUSTER
fi
fi
fi
2014-11-15 20:10:06 +00:00
if [ -n "$NODE_NAME" ]; then
OPTS="$OPTS -Des.node.name=$NODE_NAME"
fi
2014-11-15 20:10:06 +00:00
if [ -n "$MULTICAST" ]; then
OPTS="$OPTS -Des.discovery.zen.ping.multicast.enabled=$MULTICAST"
fi
if [ -n "$UNICAST_HOSTS" ]; then
OPTS="$OPTS -Des.discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS"
fi
2014-11-15 20:10:06 +00:00
2014-11-15 18:05:01 +00:00
if [ -n "$PUBLISH_AS" ]; then
OPTS="$OPTS -Des.transport.publish_host=$(echo $PUBLISH_AS | awk -F: '{print $1}')"
OPTS="$OPTS -Des.transport.publish_port=$(echo $PUBLISH_AS | awk -F: '{if ($2) print $2; else print 9300}')"
fi
OPTS="$OPTS --path.plugins=/conf/plugins"
2014-11-15 20:10:06 +00:00
if [ -n "$PLUGINS" ]; then
for p in $(echo $PLUGINS | awk -v RS=, '{print}')
do
echo "Installing the plugin $p"
$ES_HOME/bin/plugin install $p
2014-11-15 20:10:06 +00:00
done
else
mkdir -p /conf/plugins
2014-11-15 20:10:06 +00:00
fi
mkdir -p /conf/scripts
echo "Starting Elasticsearch with the options $OPTS"
CMD="$ES_HOME/bin/elasticsearch $OPTS"
if [ `id -u` = 0 ]; then
echo "Running as non-root..."
chown -R $DEFAULT_ES_USER /data
set -x
su -c "$CMD" $DEFAULT_ES_USER
else
$CMD
fi