|
@@ -27,6 +27,15 @@ mkdir -p "$CONFIGS_DIR"
|
|
|
# hocon try to read environment variables starting with "EMQX_"
|
|
# hocon try to read environment variables starting with "EMQX_"
|
|
|
export HOCON_ENV_OVERRIDE_PREFIX='EMQX_'
|
|
export HOCON_ENV_OVERRIDE_PREFIX='EMQX_'
|
|
|
|
|
|
|
|
|
|
+export ROOTDIR="$RUNNER_ROOT_DIR"
|
|
|
|
|
+export ERTS_DIR="$ROOTDIR/erts-$ERTS_VSN"
|
|
|
|
|
+export BINDIR="$ERTS_DIR/bin"
|
|
|
|
|
+export EMU="beam"
|
|
|
|
|
+export PROGNAME="erl"
|
|
|
|
|
+export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH"
|
|
|
|
|
+export ERTS_LIB_DIR="$ERTS_DIR/../lib"
|
|
|
|
|
+MNESIA_DATA_DIR="$RUNNER_DATA_DIR/mnesia/$NAME"
|
|
|
|
|
+
|
|
|
relx_usage() {
|
|
relx_usage() {
|
|
|
command="$1"
|
|
command="$1"
|
|
|
|
|
|
|
@@ -183,6 +192,12 @@ relx_nodetool() {
|
|
|
-setcookie "$COOKIE" "$command" "$@"
|
|
-setcookie "$COOKIE" "$command" "$@"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+call_hocon() {
|
|
|
|
|
+ export RUNNER_ROOT_DIR
|
|
|
|
|
+ export REL_VSN
|
|
|
|
|
+ "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" hocon "$@"
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
# Run an escript in the node's environment
|
|
# Run an escript in the node's environment
|
|
|
relx_escript() {
|
|
relx_escript() {
|
|
|
shift; scriptpath="$1"; shift
|
|
shift; scriptpath="$1"; shift
|
|
@@ -210,12 +225,12 @@ generate_config() {
|
|
|
|
|
|
|
|
## timestamp for each generation
|
|
## timestamp for each generation
|
|
|
local NOW_TIME
|
|
local NOW_TIME
|
|
|
- NOW_TIME="$("$ERTS_PATH"/escript "$RUNNER_ROOT_DIR"/bin/hocon now_time)"
|
|
|
|
|
|
|
+ NOW_TIME="$(call_hocon now_time)"
|
|
|
|
|
|
|
|
## ths command populates two files: app.<time>.config and vm.<time>.args
|
|
## ths command populates two files: app.<time>.config and vm.<time>.args
|
|
|
## disable SC2086 to allow EMQX_LICENSE_CONF_OPTION to split
|
|
## disable SC2086 to allow EMQX_LICENSE_CONF_OPTION to split
|
|
|
# shellcheck disable=SC2086
|
|
# shellcheck disable=SC2086
|
|
|
- "$ERTS_PATH"/escript "$RUNNER_ROOT_DIR"/bin/hocon -t "$NOW_TIME" -s emqx_schema -c "$RUNNER_ETC_DIR"/emqx.conf $EMQX_LICENSE_CONF_OPTION -d "$RUNNER_DATA_DIR"/configs generate
|
|
|
|
|
|
|
+ call_hocon -t "$NOW_TIME" -s emqx_schema -c "$RUNNER_ETC_DIR"/emqx.conf $EMQX_LICENSE_CONF_OPTION -d "$RUNNER_DATA_DIR"/configs generate
|
|
|
|
|
|
|
|
## filenames are per-hocon convention
|
|
## filenames are per-hocon convention
|
|
|
local CONF_FILE="$CONFIGS_DIR/app.$NOW_TIME.config"
|
|
local CONF_FILE="$CONFIGS_DIR/app.$NOW_TIME.config"
|
|
@@ -306,7 +321,7 @@ if [ -z "$NAME_ARG" ]; then
|
|
|
else
|
|
else
|
|
|
# for boot commands, inspect emqx.conf for node name
|
|
# for boot commands, inspect emqx.conf for node name
|
|
|
# todo: use get command from hocon escript
|
|
# todo: use get command from hocon escript
|
|
|
- NODENAME="$("$ERTS_PATH"/escript "$RUNNER_ROOT_DIR"/bin/hocon -s emqx_schema -c "$RUNNER_ETC_DIR"/emqx.conf get node.name | tr -d \")"
|
|
|
|
|
|
|
+ NODENAME="$(call_hocon -s emqx_schema -c "$RUNNER_ETC_DIR"/emqx.conf get node.name | tr -d \")"
|
|
|
fi
|
|
fi
|
|
|
fi
|
|
fi
|
|
|
if [ -z "$NODENAME" ]; then
|
|
if [ -z "$NODENAME" ]; then
|
|
@@ -332,7 +347,7 @@ PIPE_DIR="${PIPE_DIR:-/$RUNNER_DATA_DIR/${WHOAMI}_erl_pipes/$NAME/}"
|
|
|
COOKIE="${EMQX_NODE_COOKIE:-}"
|
|
COOKIE="${EMQX_NODE_COOKIE:-}"
|
|
|
if [ -z "$COOKIE" ]; then
|
|
if [ -z "$COOKIE" ]; then
|
|
|
if [ "$IS_BOOT_COMMAND" = 'yes' ]; then
|
|
if [ "$IS_BOOT_COMMAND" = 'yes' ]; then
|
|
|
- COOKIE="$("$ERTS_PATH"/escript "$RUNNER_ROOT_DIR"/bin/hocon -s emqx_schema -c "$RUNNER_ETC_DIR"/emqx.conf get node.cookie | tr -d \")"
|
|
|
|
|
|
|
+ COOKIE="$(call_hocon -s emqx_schema -c "$RUNNER_ETC_DIR"/emqx.conf get node.cookie | tr -d \")"
|
|
|
else
|
|
else
|
|
|
# shellcheck disable=SC2012,SC2086
|
|
# shellcheck disable=SC2012,SC2086
|
|
|
LATEST_VM_ARGS="$(ls -t $CONFIGS_DIR/vm.*.args | head -1)"
|
|
LATEST_VM_ARGS="$(ls -t $CONFIGS_DIR/vm.*.args | head -1)"
|
|
@@ -357,15 +372,6 @@ else
|
|
|
PROTO_DIST_ARG="-proto_dist $PROTO_DIST"
|
|
PROTO_DIST_ARG="-proto_dist $PROTO_DIST"
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-export ROOTDIR="$RUNNER_ROOT_DIR"
|
|
|
|
|
-export ERTS_DIR="$ROOTDIR/erts-$ERTS_VSN"
|
|
|
|
|
-export BINDIR="$ERTS_DIR/bin"
|
|
|
|
|
-export EMU="beam"
|
|
|
|
|
-export PROGNAME="erl"
|
|
|
|
|
-export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH"
|
|
|
|
|
-export ERTS_LIB_DIR="$ERTS_DIR/../lib"
|
|
|
|
|
-MNESIA_DATA_DIR="$RUNNER_DATA_DIR/mnesia/$NAME"
|
|
|
|
|
-
|
|
|
|
|
cd "$ROOTDIR"
|
|
cd "$ROOTDIR"
|
|
|
|
|
|
|
|
# User can specify an sname without @hostname
|
|
# User can specify an sname without @hostname
|