fix(boot): boot exit on config error (#5200)
* fix(hocon): fail on hocon command errors call_hocon bash function respects exit code * fix(bin/emax): get dist_port config from hocon after config file refactoring (to hocon format) the grep pattern no longer works * fix(bin/emqx): set -o pipefail * feat(bin/emqx): add a DEBUG option
This commit is contained in:
parent
3195561a79
commit
6b3cfd7c5d
|
@ -16,7 +16,7 @@
|
||||||
, {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.10.2"}}}
|
, {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.10.2"}}}
|
||||||
, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.1"}}}
|
, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.1"}}}
|
||||||
, {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v4.0.1"}}} %% todo delete when plugins use hocon
|
, {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v4.0.1"}}} %% todo delete when plugins use hocon
|
||||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.9.0"}}}
|
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.9.6"}}}
|
||||||
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.4"}}}
|
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.4"}}}
|
||||||
, {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
|
, {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}}
|
||||||
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.13.0"}}}
|
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.13.0"}}}
|
||||||
|
|
10
bin/emqx
10
bin/emqx
|
@ -3,6 +3,11 @@
|
||||||
# ex: ts=4 sw=4 et
|
# ex: ts=4 sw=4 et
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
if [ -n "$DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
ROOT_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"/..; pwd -P)"
|
ROOT_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"/..; pwd -P)"
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
|
@ -196,6 +201,7 @@ call_hocon() {
|
||||||
export RUNNER_ROOT_DIR
|
export RUNNER_ROOT_DIR
|
||||||
export REL_VSN
|
export REL_VSN
|
||||||
"$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" hocon "$@"
|
"$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" hocon "$@"
|
||||||
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run an escript in the node's environment
|
# Run an escript in the node's environment
|
||||||
|
@ -251,7 +257,7 @@ generate_config() {
|
||||||
ARG_KEY=$(echo "$ARG_LINE" | awk '{$NF="";print}')
|
ARG_KEY=$(echo "$ARG_LINE" | awk '{$NF="";print}')
|
||||||
ARG_VALUE=$(echo "$ARG_LINE" | awk '{print $NF}')
|
ARG_VALUE=$(echo "$ARG_LINE" | awk '{print $NF}')
|
||||||
## use the key to look up in vm.args file for the value
|
## use the key to look up in vm.args file for the value
|
||||||
TMP_ARG_VALUE=$(grep "^$ARG_KEY" "$TMP_ARG_FILE" | awk '{print $NF}')
|
TMP_ARG_VALUE=$(grep "^$ARG_KEY" "$TMP_ARG_FILE" || true | awk '{print $NF}')
|
||||||
## compare generated (to override) value to original (to be overriden) value
|
## compare generated (to override) value to original (to be overriden) value
|
||||||
if [ "$ARG_VALUE" != "$TMP_ARG_VALUE" ] ; then
|
if [ "$ARG_VALUE" != "$TMP_ARG_VALUE" ] ; then
|
||||||
## if they are different
|
## if they are different
|
||||||
|
@ -365,7 +371,7 @@ if [ -z "$COOKIE" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Support for IPv6 Dist. See: https://github.com/emqtt/emqttd/issues/1460
|
# Support for IPv6 Dist. See: https://github.com/emqtt/emqttd/issues/1460
|
||||||
PROTO_DIST=$(grep -E '^[ \t]*cluster.proto_dist[ \t]*=[ \t]*' "$RUNNER_ETC_DIR/emqx.conf" 2> /dev/null | tail -1 | awk -F"= " '{print $NF}')
|
PROTO_DIST="$(call_hocon -s emqx_schema -c "$RUNNER_ETC_DIR"/emqx.conf get cluster.proto_dist | tr -d \")"
|
||||||
if [ -z "$PROTO_DIST" ]; then
|
if [ -z "$PROTO_DIST" ]; then
|
||||||
PROTO_DIST_ARG=""
|
PROTO_DIST_ARG=""
|
||||||
else
|
else
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
, {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1
|
, {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.1
|
||||||
, {getopt, "1.0.1"}
|
, {getopt, "1.0.1"}
|
||||||
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.13.0"}}}
|
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.13.0"}}}
|
||||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.9.0"}}}
|
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.9.6"}}}
|
||||||
, {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.2.1"}}}
|
, {emqx_http_lib, {git, "https://github.com/emqx/emqx_http_lib.git", {tag, "0.2.1"}}}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue