Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
Automatic plugin install
Browse files Browse the repository at this point in the history
  • Loading branch information
caruccio committed Jan 15, 2014
1 parent 5174f63 commit 5a89276
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
31 changes: 31 additions & 0 deletions bin/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@ source $OPENSHIFT_CARTRIDGE_SDK_BASH

PID_FILE=$OPENSHIFT_ELASTICSEARCH_DIR/run/elasticsearch.pid

function _install_plugins()
{
local PLUGIN_CMD="$OPENSHIFT_ELASTICSEARCH_DIR/usr/bin/plugin -Des.path.plugins=$OPENSHIFT_DATA_DIR/elasticsearch-plugins"

old_plugins=$($PLUGIN_CMD --list | awk '/-/{print $2}' | xargs)
if [ -n "$old_plugins" -a "$old_plugins" != "No" ]; then #ARGH!
echo "Removing old ElasticSearch plugins..."
for plugin in $old_plugins; do
$PLUGIN_CMD --remove $plugin
done
fi

echo "Installing ElasticSearch plugins..."

plugins="$(grep -v '^#' $OPENSHIFT_REPO_DIR/plugins.txt 2>/dev/null | xargs)"

if [ "${plugins}" ]; then
for plugin in ${plugins}; do
name=$(echo $plugin | cut -f 1 -d =)
url=$(echo $plugin | cut -f 2 -d =)
if [ "$name" == "$url" ]; then
$PLUGIN_CMD --install $name
else
$PLUGIN_CMD --url $url --install $name
fi
done
fi
}

function _is_running() {
if [ -f $PID_FILE ]; then
zpid=$(cat $PID_FILE 2> /dev/null)
Expand All @@ -25,6 +54,8 @@ function start() {
export PUBLISH_HOST=$(python -c "import socket; print socket.gethostbyname('$OPENSHIFT_GEAR_DNS')")

$OPENSHIFT_ELASTICSEARCH_DIR/usr/bin/elasticsearch -p $PID_FILE

_install_plugins
}

function stop() {
Expand Down
2 changes: 1 addition & 1 deletion bin/install
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -e

mkdir -p $OPENSHIFT_ELASTICSEARCH_DIR/run $OPENSHIFT_DATA_DIR/elasticsearch
mkdir -p $OPENSHIFT_ELASTICSEARCH_DIR/run $OPENSHIFT_DATA_DIR/{elasticsearch,elasticsearch-plugins}

touch $OPENSHIFT_ELASTICSEARCH_DIR/env/OPENSHIFT_ELASTICSEARCH_CLUSTER
2 changes: 1 addition & 1 deletion conf/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ path.logs: ${OPENSHIFT_ELASTICSEARCH_DIR}/logs

# Path to where plugins are installed:
#
# path.plugins: /path/to/plugins
path.plugins: ${OPENSHIFT_DATA_DIR}/elasticsearch-plugins


#################################### Plugin ###################################
Expand Down
52 changes: 52 additions & 0 deletions template/plugins.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
##
## ElasticSearch plugins to install, one per line.
## Edit this file, commit and push. All plugins will be
## installed inside all gears.
##
## To use a specific URL to download plugin code from, use:
## [PLUGIN_NAME]=[URL]
## Ex:
## myplugin=https://mysite.com/elasticsearch/my-awesome-plugin.zip
##

## Description:
## ElasticSearch-head is a web front end for browsing and
## interacting with an Elastic Search cluster.
##
## URL:
## http://mobz.github.io/elasticsearch-head

## Uncomment line below to install this plugin
#mobz/elasticsearch-head

## Description:
## Paramedic is a simple yet sexy tool to monitor and inspect
## ElasticSearch clusters. It displays real-time statistics and
## information about your nodes and indices, as well as shard
## allocation within the cluster.
##
## URL:
## https://github.com/karmi/elasticsearch-paramedic

## Uncomment line below to install this plugin
#karmi/elasticsearch-paramedic

## Description:
## Site plugin for Elasticsearch to help understand and debug queries.
##
## URL:
## https://github.com/polyfractal/elasticsearch-inquisitor

## Uncomment line below to install this plugin
#polyfractal/elasticsearch-inquisitor

## Description:
## SegmentSpy is a tool to watch the segments in your indices.
## Segment graphs update in real-time, allowing you to watch as
## ElasticSearch (Lucene) merges your segments
##
## URL:
## https://github.com/polyfractal/elasticsearch-segmentspy

## Uncomment line below to install this plugin
#polyfractal/elasticsearch-segmentspy

0 comments on commit 5a89276

Please sign in to comment.