-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
65 lines (56 loc) · 3.16 KB
/
Copy pathentrypoint.sh
File metadata and controls
65 lines (56 loc) · 3.16 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -e
# If EXPORT_CONF_TEMPLATE is set to true then export template.j2 files contained in /srv/springboard/mods to EXPORT_CONF_TEMPLATE_PATH
if [ "$EXPORT_CONF_TEMPLATE" = "true" ]; then
# If EXPORT_CONF_TEMPLATE_PATH is not set raise an error
if [ -z "$EXPORT_CONF_TEMPLATE_PATH" ]; then
echo "ERROR: EXPORT_CONF_TEMPLATE_PATH is not set. Please set it to the desired export path."
exit 1
fi
cd /srv/springboard
find ./mods -maxdepth 2 -mindepth 2 -type f -name "template.j2" | while read f; do \
relpath=$(echo "$f" | sed 's|^\./mods/||'); \
dir=$(dirname "$relpath"); \
mkdir -p "$EXPORT_CONF_TEMPLATE_PATH/$dir"; \
cp "$f" "$EXPORT_CONF_TEMPLATE_PATH/$relpath"; \
done
echo "The following templates were exported to $EXPORT_CONF_TEMPLATE_PATH"
find "$EXPORT_CONF_TEMPLATE_PATH" -type f -name "template.j2"
# If no template.j2 files were found, inform the user and exit
if [ "$(find "$EXPORT_CONF_TEMPLATE_PATH" -type f -name "template.j2" | wc -l)" -eq 0 ]; then
echo "No template.j2 files were found in /srv/springboard/mods."
exit 1
fi
exit 0
fi
# Generate logging.properties with environment variable support
LOG_LEVEL="${LOG_LEVEL:-INFO}"
VERTX_LOG_LEVEL="${VERTX_LOG_LEVEL:-INFO}"
HAZELCAST_LOG_LEVEL="${HAZELCAST_LOG_LEVEL:-SEVERE}"
NETTY_LOG_LEVEL="${NETTY_LOG_LEVEL:-SEVERE}"
ACCESS_LOG_LEVEL="${ACCESS_LOG_LEVEL:-FINEST}"
cat > /srv/springboard/conf/logging.properties <<EOF
handlers=com.opendigitaleducation.launcher.logger.ENTLogHandler
com.opendigitaleducation.launcher.logger.ENTLogHandler.level=${LOG_LEVEL}
.level=${LOG_LEVEL}
org.vertx.level=${VERTX_LOG_LEVEL}
com.hazelcast.level=${HAZELCAST_LOG_LEVEL}
io.netty.util.internal.PlatformDependent.level=${NETTY_LOG_LEVEL}
org.apache.zookeeper.level=${LOG_LEVEL}
ACCESS.level=${ACCESS_LOG_LEVEL}
ACCESS.handlers=com.opendigitaleducation.launcher.logger.AccessLogHandler
ACCESS.useParentHandlers=false
ACCESS.com.opendigitaleducation.launcher.logger.AccessLogHandler.level=${ACCESS_LOG_LEVEL}
ACCESS.com.opendigitaleducation.launcher.logger.AccessLogHandler.formatter=com.opendigitaleducation.launcher.logger.JsonAccessFormatter
EOF
REMOTE_DEBUG=""
if [ "$ENABLE_REMOTE_DEBUG" = "true" ]; then
REMOTE_DEBUG="-agentlib:jdwp=transport=dt_socket,address=5000,server=y,suspend=${DEBUG_SUSPEND:-n}"
fi
LOG_PROPS="-Djava.util.logging.config.file=/srv/springboard/conf/logging.properties"
final_vertx_conf_path="${VERTX_CONF_PATH:-/opt/conf/entcore.json}"
if [ "$MODE" = "cluster" ]; then
exec java $JAVA_TOOL_OPTIONS $REMOTE_DEBUG $LOG_PROPS -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dvertx.zookeeper.config=/srv/springboard/conf/zookeeper.json -jar /opt/vertx-service-launcher.jar -Dvertx.services.path=/srv/springboard/mods -Dvertx.disableFileCaching=true -conf $final_vertx_conf_path -cluster $VERTX_EXTRA_PARAMS
else
exec java $JAVA_TOOL_OPTIONS $REMOTE_DEBUG $LOG_PROPS -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -jar /opt/vertx-service-launcher.jar -Dvertx.services.path=/srv/springboard/mods -Dvertx.disableFileCaching=true -conf $final_vertx_conf_path $VERTX_EXTRA_PARAMS
fi