-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-entrypoint.sh
executable file
·43 lines (31 loc) · 1.22 KB
/
docker-entrypoint.sh
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
#!/bin/bash
# Exit 1 if any script fails.
set -e
# Add logstash as command if needed
if [[ "${1:0:1}" = '-' ]]; then
set -- logstash "$@"
fi
# Change the ownership of the mounted volumes to user logstash at docker container runtime
chown -R logstash:logstash ${LS_CONFIG_VOL} ${LS_LOG_VOL}
ls -la ${LS_LOG_VOL}
ls -la ${LS_LOG_VOL}/..
env
LS_ENV_PATH=$( find "${LS_CONFIG_VOL}" -maxdepth 3 -iname "${LS_ENV}" )
cat ${LS_ENV_PATH}
# Get LS_CONF
LS_CONF_JINJA=$( find "${LS_CONFIG_VOL}" -maxdepth 3 -iname "${LS_CONF}.j2" )
cat ${LS_CONF_JINJA}
echo "python ${JINJA_SCRIPT} --verbose -f "${LS_ENV_PATH}" -e "LS_CONFIG_VOL" "LS_LOG_VOL" -t "${LS_CONF_JINJA}""
python ${JINJA_SCRIPT} --verbose -f "${LS_ENV_PATH}" -e "LS_CONFIG_VOL" "LS_LOG_VOL" -t "${LS_CONF_JINJA}"
echo "RENDERED: ${LS_CONF_JINJA}"
cat ${LS_CONF_JINJA}
LS_CONF_PATH=$( find "${LS_CONFIG_VOL}" -maxdepth 3 -iname "${LS_CONF}" )
echo "PATH: ${LS_CONF_PATH}"
cat ${LS_CONF_PATH}
# Start logstash agent
printf "\n\n%s\n\n" "=== Start logstash agent with logstash conf [${LS_CONF}] ==="
set -- gosu logstash "$@"
# As argument is not related to logstash,
# then assume that user wants to run his own process,
# for example a `bash` shell to explore this image
exec "$@"