From f272495b8ee516e24c206781757a4630a75205f8 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Thu, 15 Sep 2022 09:56:15 +0200 Subject: [PATCH 1/2] fix(bin/emqx): ensure log dir is created by runner user --- bin/emqx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/emqx b/bin/emqx index 63aae6e70..36762f1b1 100755 --- a/bin/emqx +++ b/bin/emqx @@ -24,9 +24,6 @@ REL_DIR="$RUNNER_ROOT_DIR/releases/$REL_VSN" WHOAMI=$(whoami) -# Make sure log directory exists -mkdir -p "$RUNNER_LOG_DIR" - # hocon try to read environment variables starting with "EMQX_" export HOCON_ENV_OVERRIDE_PREFIX='EMQX_' @@ -262,6 +259,9 @@ if [ "$ES" -ne 0 ]; then exit $ES fi +# Make sure log directory exists +mkdir -p "$RUNNER_LOG_DIR" + COMPATIBILITY_CHECK=' io:format("BEAM_OK~n", []), try From 9bd9e2ecd8d8e0c90196946352c30bd3ca03dc49 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Thu, 15 Sep 2022 09:57:55 +0200 Subject: [PATCH 2/2] feat: add EMQX_LOG_DIR env --- rel/emqx_vars | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rel/emqx_vars b/rel/emqx_vars index 1ec95b4de..e3965d40c 100644 --- a/rel/emqx_vars +++ b/rel/emqx_vars @@ -9,9 +9,9 @@ ERL_OPTS="{{ erl_opts }}" RUNNER_BIN_DIR="{{ runner_bin_dir }}" RUNNER_LIB_DIR="{{ runner_lib_dir }}" IS_ELIXIR="${IS_ELIXIR:-{{ is_elixir }}}" -## Allow users to pre-set `RUNNER_LOG_DIR` because it only affects boot commands like `start` and `console`, +## Allow users to pre-set `EMQX_LOG_DIR` because it only affects boot commands like `start` and `console`, ## but not other commands such as `ping` and `ctl`. -RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-{{ runner_log_dir }}}" +RUNNER_LOG_DIR="${EMQX_LOG_DIR:-${RUNNER_LOG_DIR:-{{ runner_log_dir }}}}" EMQX_ETC_DIR="{{ emqx_etc_dir }}" RUNNER_USER="{{ runner_user }}" SCHEMA_MOD="{{ emqx_schema_mod }}"