浏览代码

chore(script): make emqx work with docker entrypoint

zhanghongtong 5 年之前
父节点
当前提交
106b738a89
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 1
      .ci/fvt_tests/docker-compose.yaml
  2. 2 0
      bin/emqx

+ 1 - 1
.ci/fvt_tests/docker-compose.yaml

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

+ 2 - 0
bin/emqx

@@ -262,6 +262,8 @@ fi
 
 if [ -z "$NAME_ARG" ]; then
     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-)
     if [ -z "$NODENAME" ]; then
         echoerr "vm.args needs to have a -name parameter."