From 41808fc2a2481e3c7d61aaa3438d3788104c01ca Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Sat, 11 Jun 2022 14:41:01 +0200 Subject: [PATCH 1/2] chore: add a comment to describe why setting ESCRIPT_NAME --- bin/emqx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/emqx b/bin/emqx index 585dd583f..e5f33a2ae 100755 --- a/bin/emqx +++ b/bin/emqx @@ -368,7 +368,9 @@ remsh() { -remsh "$NAME" -boot "$REL_DIR/start_clean" \ -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \ -boot_var RELEASE_LIB "$ERTS_LIB_DIR" \ - -setcookie "$COOKIE" -hidden -kernel net_ticktime "$TICKTIME" \ + -setcookie "$COOKIE" \ + -hidden \ + -kernel net_ticktime "$TICKTIME" \ $EPMD_ARGS else set -- "$REL_DIR/iex" \ @@ -692,12 +694,13 @@ case "$NAME" in NAME_TYPE='-sname' esac SHORT_NAME="$(echo "$NAME" | awk -F'@' '{print $1}')" -export ESCRIPT_NAME="$SHORT_NAME" - if ! (echo "$SHORT_NAME" | grep -q '^[0-9A-Za-z_\-]\+$'); then echo "Invalid node name, should be of format '^[0-9A-Za-z_-]+$'." exit 1 fi +# This also changes the program name from 'beam.smp' to node name +# e.g. the 'ps' command output +export ESCRIPT_NAME="$SHORT_NAME" PIPE_DIR="${PIPE_DIR:-/$DATA_DIR/${WHOAMI}_erl_pipes/$NAME/}" From eaf071c4cf209cc3aa52b3d902993ba08fedd052 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Sat, 11 Jun 2022 14:51:11 +0200 Subject: [PATCH 2/2] chore: delete unused code --- deploy/docker/docker-entrypoint.sh | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/deploy/docker/docker-entrypoint.sh b/deploy/docker/docker-entrypoint.sh index cabe69ead..7d61a6fbb 100755 --- a/deploy/docker/docker-entrypoint.sh +++ b/deploy/docker/docker-entrypoint.sh @@ -17,11 +17,7 @@ shopt -s nullglob LOCAL_IP=$(hostname -i | grep -oE '((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])\.){3}(25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])' | head -n 1) if [[ -z "$EMQX_NODE_NAME" ]]; then - - if [[ -z "$EMQX_NAME" ]]; then - EMQX_NAME='emqx' - fi - + EMQX_NAME="${EMQX_NAME:-emqx}" if [[ -z "$EMQX_HOST" ]]; then if [[ "$EMQX_CLUSTER__K8S__ADDRESS_TYPE" == "dns" ]] && [[ -n "$EMQX_CLUSTER__K8S__NAMESPACE" ]]; then EMQX_CLUSTER__K8S__SUFFIX=${EMQX_CLUSTER__K8S__SUFFIX:-"pod.cluster.local"} @@ -38,25 +34,6 @@ if [[ -z "$EMQX_NODE_NAME" ]]; then unset EMQX_HOST fi -# fill tuples on specific file -# SYNOPSIS -# fill_tuples FILE [ELEMENTS ...] -fill_tuples() { - local file=$1 - local elements=${*:2} - for var in $elements; do - if grep -qE "\{\s*$var\s*,\s*(true|false)\s*\}\s*\." "$file"; then - sed -r "s/\{\s*($var)\s*,\s*(true|false)\s*\}\s*\./{\1, true}./1" "$file" > tmpfile && cat tmpfile > "$file" - elif grep -q "$var\s*\." "$file"; then - # backward compatible. - sed -r "s/($var)\s*\./{\1, true}./1" "$file" > tmpfile && cat tmpfile > "$file" - else - sed '$a'\\ "$file" > tmpfile && cat tmpfile > "$file" - echo "{$var, true}." >> "$file" - fi - done -} - # The default rpc port discovery 'stateless' is mostly for clusters # having static node names. So it's troulbe-free for multiple emqx nodes # running on the same host.