forked from sscarduzio/elasticsearch-readonlyrest-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathror-entrypoint.sh
More file actions
executable file
·37 lines (31 loc) · 1.64 KB
/
ror-entrypoint.sh
File metadata and controls
executable file
·37 lines (31 loc) · 1.64 KB
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
#!/bin/bash -e
INVOKE_ROR_TOOLS="/usr/share/elasticsearch/jdk/bin/java -jar /usr/share/elasticsearch/plugins/readonlyrest/ror-tools.jar"
if $INVOKE_ROR_TOOLS verify | grep -q "Elasticsearch is NOT patched"; then
if [ -n "$I_UNDERSTAND_AND_ACCEPT_ES_PATCHING" ]; then
CONFIRMATION="$I_UNDERSTAND_AND_ACCEPT_ES_PATCHING"
elif [ -n "$I_UNDERSTAND_IMPLICATION_OF_ES_PATCHING" ]; then
CONFIRMATION="$I_UNDERSTAND_IMPLICATION_OF_ES_PATCHING"
else
CONFIRMATION=""
fi
if [[ "${CONFIRMATION,,}" == *"yes"* ]]; then
if [ "$(id -u)" -ne 0 ]; then
echo "Elasticsearch needs to be patched to work with ReadonlyREST. You can read about patching in our documentation:" \
"https://docs.readonlyrest.com/elasticsearch#id-3.-patch-elasticsearch. To patch Elasticsearch the container " \
"has to be run as root. Then, after the patching step, the Elasticsearch process will be run as 'elasticsearch' " \
"user. "
exit 1
else
$INVOKE_ROR_TOOLS patch --I_UNDERSTAND_AND_ACCEPT_ES_PATCHING yes
fi
else
echo "Elasticsearch needs to be patched to work with ReadonlyREST. You can read about patching in our documentation:" \
"https://docs.readonlyrest.com/elasticsearch#id-3.-patch-elasticsearch. In this Docker image, the patching step" \
"is done automatically, but you must agree to have it done for you. You can do this by setting" \
"I_UNDERSTAND_AND_ACCEPT_ES_PATCHING=yes environment variable when running the container."
exit 2
fi
else
echo "Elasticsearch is already patched. We can continue ..."
fi
gosu elasticsearch /usr/local/bin/docker-entrypoint.sh "$@"