-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathelastic
executable file
·56 lines (51 loc) · 1.87 KB
/
elastic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR/..";
MANIFOLD_ROOT=$(pwd);
ELASTIC_BIN="$MANIFOLD_ROOT/services/elasticsearch-5.6.5/bin/elasticsearch";
ES_PATH_CONF="$MANIFOLD_ROOT/config/elasticsearch";
PID_FILE="$MANIFOLD_ROOT/api/tmp/pids/elastic.pid";
ELASTIC_PORT=29200
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
bold=`tput bold`
ul=`tput smul`
if [[ ! -f $ELASTIC_BIN ]] ; then
echo "${red}${bold}#################################################################"
echo "${red}${bold}Oh dang. Elasticsearch hasn't been installed for this development${reset}"
echo "${red}${bold}environment.${reset}"
echo "${red}${bold}#################################################################"
echo ""
echo "${red}${ul}Solution #1:${reset}"
echo "${red} Run Manifold without it using the --no-elasticsearch flag.${reset}"
echo ""
echo "${red}${ul}Solution #2:${reset}"
echo "${red} Setup a manifold-specific instance of Elasticsearch by${reset}"
echo "${red} following the steps below.${reset}"
echo ""
echo "${red} 1. Install it into ./services:"
echo " m install elasticsearch"
echo ""
echo "${red} 2. Update .env to point at it:"
echo " ELASTICSEARCH_URL=http://127.0.0.1:29200"
echo ""
echo "${red} 3. Start Manifold:"
echo " m start"
echo ""
echo "${red} 4. Once Elasticsearch is running, reindex API models:"
echo " cd api && rails manifold:search:reindex${reset}"
echo ""
exit
fi
cd $MANIFOLD_ROOT;
echo "Checking for Elasticsearch pidfile at $PID_FILE"
if [ -f $PID_FILE ]
then
if ps -p $(cat $PID_FILE) > /dev/null 2>&1
then
echo "Elasticsearch is already running. Restarting."
kill -SIGTERM $(cat $PID_FILE)
fi
fi
$ELASTIC_BIN -E http.port=$ELASTIC_PORT -E path.conf=$ES_PATH_CONF -p $PID_FILE