chore(script): make emqx work with docker entrypoint

This commit is contained in:
zhanghongtong 2021-03-23 22:46:41 +08:00 committed by Rory Z
parent 78afdd8b57
commit 106b738a89
2 changed files with 3 additions and 1 deletions

View File

@ -46,7 +46,7 @@ services:
sed -i '/emqx_telemetry/d' /opt/emqx/data/loaded_plugins sed -i '/emqx_telemetry/d' /opt/emqx/data/loaded_plugins
/opt/emqx/bin/emqx foreground /opt/emqx/bin/emqx foreground
healthcheck: healthcheck:
test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"] test: ["CMD", "/opt/emqx/bin/emqx", "ping"]
interval: 5s interval: 5s
timeout: 25s timeout: 25s
retries: 5 retries: 5

View File

@ -262,6 +262,8 @@ fi
if [ -z "$NAME_ARG" ]; then if [ -z "$NAME_ARG" ]; then
NODENAME="${EMQX_NODE_NAME:-}" NODENAME="${EMQX_NODE_NAME:-}"
# compatible with docker entrypoint
[ -z "$NODENAME" ] && [ -n "$EMQX_NAME" ] && [ -n "$EMQX_HOST" ] && NODENAME="${EMQX_NAME}@${EMQX_HOST}"
[ -z "$NODENAME" ] && NODENAME=$(grep -E '^[ \t]*node.name[ \t]*=[ \t]*' "$RUNNER_ETC_DIR/emqx.conf" 2> /dev/null | tail -1 | cut -d = -f 2-) [ -z "$NODENAME" ] && NODENAME=$(grep -E '^[ \t]*node.name[ \t]*=[ \t]*' "$RUNNER_ETC_DIR/emqx.conf" 2> /dev/null | tail -1 | cut -d = -f 2-)
if [ -z "$NODENAME" ]; then if [ -z "$NODENAME" ]; then
echoerr "vm.args needs to have a -name parameter." echoerr "vm.args needs to have a -name parameter."