File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1
- PGDB = db :5432
1
+ PGDB = pgdb :5432
2
2
API_SERVER = morbo -l http://*:5000 -w app.psgi -w bin -w lib -w templates --verbose
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Courtesy of @fxdgear
4
+ # https://github.com/elastic/elasticsearch-py/issues/778#issuecomment-384389668
5
+
6
+ set -e
7
+
8
+ host=" $1 "
9
+ shift
10
+ cmd=" $@ "
11
+
12
+
13
+ until $( curl --output /dev/null --silent --head --fail " $host " ) ; do
14
+ printf ' .'
15
+ sleep 1
16
+ done
17
+
18
+ # First wait for ES to start...
19
+ response=$( curl $host )
20
+
21
+ until [ " $response " = " 200" ]; do
22
+ response=$( curl --write-out %{http_code} --silent --output /dev/null " $host " )
23
+ >&2 echo " Elastic Search is unavailable - sleeping"
24
+ sleep 1
25
+ done
26
+
27
+
28
+ # Wait for ES status to turn to yellow.
29
+ # TODO: Ideally we'd be waiting for green, but we need multiple nodes for that.
30
+
31
+ health=" $( curl -fsSL " $host /_cat/health?h=status" ) "
32
+ health=" $( echo " $health " | sed -r ' s/^[[:space:]]+|[[:space:]]+$//g' ) " # trim whitespace (otherwise we'll have "green ")
33
+
34
+ until [ " $health " = ' yellow' ]; do
35
+ health=" $( curl -fsSL " $host /_cat/health?h=status" ) "
36
+ health=" $( echo " $health " | sed -r ' s/^[[:space:]]+|[[:space:]]+$//g' ) " # trim whitespace (otherwise we'll have "green ")
37
+ >&2 echo " Elastic Search is unavailable ($health ) - sleeping"
38
+ sleep 1
39
+ done
40
+
41
+ >&2 echo " Elastic Search is up"
42
+ exec $cmd
You can’t perform that action at this time.
0 commit comments