Skip to content

Commit

Permalink
Merge pull request #10043 from zmstone/0228-fix-ssl-dist-optfile
Browse files Browse the repository at this point in the history
0228 fix ssl dist optfile
  • Loading branch information
zmstone committed Feb 28, 2023
2 parents 9ccd5ab + a8d48bf commit a64f712
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions bin/emqx
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,11 @@ else
## only one emqx node is running, get running args from 'ps -ef' output
tmp_nodename=$(echo -e "$PS_LINE" | $GREP -oE "\s\-s?name.*" | awk '{print $2}' || true)
tmp_cookie=$(echo -e "$PS_LINE" | $GREP -oE "\s\-setcookie.*" | awk '{print $2}' || true)
tmp_dist="$(echo -e "$PS_LINE" | $GREP -oE '\-ssl_dist_optfile\s.+\s' | awk '{print $2}' || true)"
SSL_DIST_OPTFILE="$(echo -e "$PS_LINE" | $GREP -oE '\-ssl_dist_optfile\s.+\s' | awk '{print $2}' || true)"
tmp_ticktime="$(echo -e "$PS_LINE" | $GREP -oE '\s\-kernel\snet_ticktime\s.+\s' | awk '{print $3}' || true)"
# data_dir is actually not needed, but kept anyway
tmp_datadir="$(echo -e "$PS_LINE" | $GREP -oE "\-emqx_data_dir.*" | sed -E 's#.+emqx_data_dir[[:blank:]]##g' | sed -E 's#[[:blank:]]--$##g' || true)"
if [ -z "$tmp_dist" ]; then
if [ -z "$SSL_DIST_OPTFILE" ]; then
tmp_proto='inet_tcp'
else
tmp_proto='inet_tls'
Expand Down Expand Up @@ -945,7 +945,7 @@ if [ -n "${EMQX_NODE_COOKIE:-}" ]; then
fi
COOKIE="${EMQX_NODE__COOKIE:-}"
COOKIE_IN_USE="$(get_boot_config 'node.cookie')"
if [ -n "$COOKIE_IN_USE" ] && [ -n "$COOKIE" ] && [ "$COOKIE" != "$COOKIE_IN_USE" ]; then
if [ "$IS_BOOT_COMMAND" != 'yes' ] && [ -n "$COOKIE_IN_USE" ] && [ -n "$COOKIE" ] && [ "$COOKIE" != "$COOKIE_IN_USE" ]; then
die "EMQX_NODE__COOKIE is different from the cookie used by $NAME"
fi
[ -z "$COOKIE" ] && COOKIE="$COOKIE_IN_USE"
Expand Down
3 changes: 3 additions & 0 deletions changes/ce/fix-10043.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed two bugs introduced in v5.0.18.
* The environment varialbe `SSL_DIST_OPTFILE` was not set correctly for non-boot commands.
* When cookie is overridden from environment variable, EMQX node is unable to start.
3 changes: 3 additions & 0 deletions changes/ce/fix-10043.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
修复 v5.0.18 引入的 2 个bug。
* 环境变量 `SSL_DIST_OPTFILE` 的值设置错误导致节点无法为 Erlang distribution 启用 SSL。
* 当节点的 cookie 从环境变量重载 (而不是设置在配置文件中时),节点无法启动的问题。
8 changes: 4 additions & 4 deletions scripts/test/start-two-nodes-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -euo pipefail
## this is why a docker network is created, and the containers's names have a dot.

# ensure dir
cd -P -- "$(dirname -- "$0")/.."
cd -P -- "$(dirname -- "$0")/../../"

IMAGE1="${1}"
IMAGE2="${2:-${IMAGE1}}"
Expand Down Expand Up @@ -94,7 +94,7 @@ backend emqx_dashboard_back
# Must use a consistent dispatch when EMQX is running on different versions
# because the js files for the dashboard is chunked, having the backends sharing
# load randomly will cause the browser fail to GET some chunks (or get bad chunks if names clash)
balance first
balance source
mode http
server emqx-1 $NODE1:18083
server emqx-2 $NODE2:18083
Expand Down Expand Up @@ -146,7 +146,7 @@ wait_for_emqx() {
container="$1"
wait_limit="$2"
wait_sec=0
while ! docker exec "$container" emqx_ctl status >/dev/null 2>&1; do
while ! docker exec "$container" emqx ctl status; do
wait_sec=$(( wait_sec + 1 ))
if [ $wait_sec -gt "$wait_limit" ]; then
echo "timeout wait for EMQX"
Expand Down Expand Up @@ -182,4 +182,4 @@ wait_for_haproxy 10

echo

docker exec $NODE1 emqx_ctl cluster join "emqx@$NODE2"
docker exec $NODE1 emqx ctl cluster join "emqx@$NODE2"

0 comments on commit a64f712

Please sign in to comment.