Merge pull request #7615 from zmstone/0413-5.0-allow-space-in-path

5.0 allow space in path
This commit is contained in:
Zaiming (Stone) Shi 2022-04-14 16:49:44 +01:00 committed by GitHub
commit 2d0144b8c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 97 additions and 154 deletions

227
bin/emqx
View File

@ -9,9 +9,9 @@ if [ "$DEBUG" -eq 1 ]; then
set -x set -x
fi fi
ROOT_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"/..; pwd -P)" RUNNER_ROOT_DIR="$(cd "$(dirname "$(readlink "$0" || echo "$0")")"/..; pwd -P)"
# shellcheck disable=SC1090,SC1091 # shellcheck disable=SC1090,SC1091
. "$ROOT_DIR"/releases/emqx_vars . "$RUNNER_ROOT_DIR"/releases/emqx_vars
# defined in emqx_vars # defined in emqx_vars
export RUNNER_ROOT_DIR export RUNNER_ROOT_DIR
@ -31,12 +31,11 @@ mkdir -p "$RUNNER_LOG_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="$RUNNER_ROOT_DIR/erts-$ERTS_VSN"
export ERTS_DIR="$ROOTDIR/erts-$ERTS_VSN"
export BINDIR="$ERTS_DIR/bin" export BINDIR="$ERTS_DIR/bin"
export EMU="beam" export EMU="beam"
export PROGNAME="erl" export PROGNAME="erl"
export ERTS_LIB_DIR="$ERTS_DIR/../lib" export ERTS_LIB_DIR="$RUNNER_ROOT_DIR/lib"
DYNLIBS_DIR="$RUNNER_ROOT_DIR/dynlibs" DYNLIBS_DIR="$RUNNER_ROOT_DIR/dynlibs"
# Echo to stderr on errors # Echo to stderr on errors
@ -102,17 +101,18 @@ usage() {
echo "For example $REL_NAME escript /path/to/my/escript my_arg1 my_arg2" echo "For example $REL_NAME escript /path/to/my/escript my_arg1 my_arg2"
;; ;;
attach) attach)
echo "This command is applicable when EMQX is started in daemon" echo "This command is applicable when EMQX is started in daemon mode."
echo "mode. it attaches the current shell to EMQX's control console" echo "It attaches the current shell to EMQX's control console"
echo "through a named pipe" echo "through a named pipe."
echo "WARNING: try to use the safer alternative, remote_console command." echo "WARNING: try to use the safer alternative, remote_console command."
;; ;;
remote_console) remote_console)
echo "Start a dummy Erlang or Elixir node and hidden-connect EMQX to" echo "Start an interactive shell running an Erlang or Elixir node which "
echo "with an interactive Erlang or Elixir shell" echo "hidden-connects to the running EMQX node".
echo "This command is mostly used for troubleshooting."
;; ;;
ertspath) ertspath)
echo "Print path to Erlang runtime dir" echo "Print path to Erlang runtime bin dir"
;; ;;
rpc) rpc)
echo "Usge $REL_NAME rpc MODULE FUNCTION [ARGS, ...]" echo "Usge $REL_NAME rpc MODULE FUNCTION [ARGS, ...]"
@ -131,7 +131,7 @@ usage() {
echo "Print EMQX installation root dir" echo "Print EMQX installation root dir"
;; ;;
eval) eval)
echo "Evaluate an Erlang or Elxir expression in the EMQX node" echo "Evaluate an Erlang or Elixir expression in the EMQX node"
;; ;;
eval-erl) eval-erl)
echo "Evaluate an Erlang expression in the EMQX node, even on Elixir node" echo "Evaluate an Erlang expression in the EMQX node, even on Elixir node"
@ -194,7 +194,7 @@ usage() {
echo "More:" echo "More:"
echo " Shell attach: remote_console | attach" echo " Shell attach: remote_console | attach"
echo " Up/Down-grade: upgrade | downgrade | install | uninstall" echo " Up/Down-grade: upgrade | downgrade | install | uninstall"
echo " Install info: ertspath | root_dir | versions | root_dir" echo " Install info: ertspath | root_dir | versions"
echo " Runtime info: pid | ping | versions" echo " Runtime info: pid | ping | versions"
echo " Advanced: console_clean | escript | rpc | rpcterms | eval | eval-erl" echo " Advanced: console_clean | escript | rpc | rpcterms | eval | eval-erl"
echo '' echo ''
@ -206,8 +206,11 @@ usage() {
COMMAND="${1:-}" COMMAND="${1:-}"
if [ -z "$COMMAND" ]; then if [ -z "$COMMAND" ]; then
usage 'nil' usage 'help'
exit 1 exit 1
elif [ "$COMMAND" = 'help' ]; then
usage 'help'
exit 0
fi fi
if [ "${2:-}" = 'help' ]; then if [ "${2:-}" = 'help' ]; then
@ -269,9 +272,8 @@ if [ "$ES" -ne 0 ]; then
exit $ES exit $ES
fi fi
# EPMD_ARG="-start_epmd true $PROTO_DIST_ARG"
NO_EPMD="-start_epmd false -epmd_module ekka_epmd -proto_dist ekka" NO_EPMD="-start_epmd false -epmd_module ekka_epmd -proto_dist ekka"
EPMD_ARG="${EPMD_ARG:-${NO_EPMD}}" EPMD_ARGS="${EPMD_ARGS:-${NO_EPMD}}"
# Warn the user if ulimit -n is less than 1024 # Warn the user if ulimit -n is less than 1024
ULIMIT_F=$(ulimit -n) ULIMIT_F=$(ulimit -n)
@ -302,33 +304,34 @@ relx_get_pid() {
} }
# Connect to a remote node # Connect to a remote node
relx_rem_sh() { remsh() {
# Generate a unique id used to allow multiple remsh to the same node # Generate a unique id used to allow multiple remsh to the same node
# transparently # transparently
id="remsh$(relx_gen_id)-${NAME}" id="remsh$(relx_gen_id)-${NAME}"
# Get the node's ticktime so that we use the same thing. # Get the node's ticktime so that we use the same thing.
TICKTIME="$(relx_nodetool rpcterms net_kernel get_net_ticktime)" TICKTIME="$(relx_nodetool rpcterms net_kernel get_net_ticktime)"
# shellcheck disable=SC2086 # $EPMD_ARG is supposed to be split by whitespace # shellcheck disable=SC2086
# Setup remote shell command to control node # Setup remote shell command to control node
if [ "$IS_ELIXIR" = "yes" ] if [ "$IS_ELIXIR" = no ] || [ "${EMQX_CONSOLE_FLAVOR:-}" = 'erl' ] ; then
then set -- "$BINDIR/erl" "$NAME_TYPE" "$id" \
exec "$REL_DIR/iex" \ -remsh "$NAME" -boot "$REL_DIR/start_clean" \
--remsh "$NAME" \ -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
--boot-var RELEASE_LIB "$ERTS_LIB_DIR" \ -boot_var RELEASE_LIB "$ERTS_LIB_DIR" \
--cookie "$COOKIE" \ -setcookie "$COOKIE" -hidden -kernel net_ticktime "$TICKTIME" \
--hidden \ $EPMD_ARGS
--erl "-kernel net_ticktime $TICKTIME" \
--erl "$EPMD_ARG" \
--erl "$NAME_TYPE $id" \
--boot "$REL_DIR/start_clean"
else else
exec "$BINDIR/erl" "$NAME_TYPE" "$id" \ set -- "$REL_DIR/iex" \
-remsh "$NAME" -boot "$REL_DIR/start_clean" \ --remsh "$NAME" \
-boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \ --boot-var RELEASE_LIB "$ERTS_LIB_DIR" \
-setcookie "$COOKIE" -hidden -kernel net_ticktime "$TICKTIME" \ --cookie "$COOKIE" \
$EPMD_ARG --hidden \
--erl "-kernel net_ticktime $TICKTIME" \
--erl "$EPMD_ARGS" \
--erl "$NAME_TYPE $id" \
--boot "$REL_DIR/start_clean"
fi fi
exec "$@"
} }
# Generate a random id # Generate a random id
@ -337,13 +340,13 @@ relx_gen_id() {
} }
call_nodetool() { call_nodetool() {
"$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" "$@" "$ERTS_DIR/bin/escript" "$RUNNER_ROOT_DIR/bin/nodetool" "$@"
} }
# Control a node # Control a node
relx_nodetool() { relx_nodetool() {
command="$1"; shift command="$1"; shift
ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARG" \ ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARGS" \
call_nodetool "$NAME_TYPE" "$NAME" \ call_nodetool "$NAME_TYPE" "$NAME" \
-setcookie "$COOKIE" "$command" "$@" -setcookie "$COOKIE" "$command" "$@"
} }
@ -384,7 +387,7 @@ check_license() {
# 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
"$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" "$@" "$ERTS_DIR/bin/escript" "$RUNNER_ROOT_DIR/$scriptpath" "$@"
} }
# Output a start command for the last argument of run_erl # Output a start command for the last argument of run_erl
@ -403,6 +406,7 @@ CONFIGS_DIR="$DATA_DIR/configs"
mkdir -p "$CONFIGS_DIR" mkdir -p "$CONFIGS_DIR"
# Function to generate app.config and vm.args # Function to generate app.config and vm.args
# sets two environment variables CONF_FILE and ARGS_FILE
generate_config() { generate_config() {
local name_type="$1" local name_type="$1"
local node_name="$2" local node_name="$2"
@ -421,15 +425,8 @@ generate_config() {
call_hocon -v -t "$NOW_TIME" -s "$SCHEMA_MOD" -c "$EMQX_ETC_DIR"/emqx.conf -d "$DATA_DIR"/configs generate call_hocon -v -t "$NOW_TIME" -s "$SCHEMA_MOD" -c "$EMQX_ETC_DIR"/emqx.conf -d "$DATA_DIR"/configs generate
## filenames are per-hocon convention ## filenames are per-hocon convention
local CONF_FILE="$CONFIGS_DIR/app.$NOW_TIME.config" CONF_FILE="$CONFIGS_DIR/app.$NOW_TIME.config"
local HOCON_GEN_ARG_FILE="$CONFIGS_DIR/vm.$NOW_TIME.args" ARGS_FILE="$CONFIGS_DIR/vm.$NOW_TIME.args"
# This is needed by the Elixir scripts.
# Do NOT append `.config`.
RELEASE_SYS_CONFIG="$CONFIGS_DIR/app.$NOW_TIME"
export RELEASE_SYS_CONFIG
CONFIG_ARGS="-config $CONF_FILE -args_file $HOCON_GEN_ARG_FILE"
## Merge hocon generated *.args into the vm.args ## Merge hocon generated *.args into the vm.args
TMP_ARG_FILE="$CONFIGS_DIR/vm.args.tmp" TMP_ARG_FILE="$CONFIGS_DIR/vm.args.tmp"
@ -439,7 +436,7 @@ generate_config() {
## read lines from generated vm.<time>.args file ## read lines from generated vm.<time>.args file
## drop comment lines, and empty lines using sed ## drop comment lines, and empty lines using sed
## pipe the lines to a while loop ## pipe the lines to a while loop
sed '/^#/d' "$HOCON_GEN_ARG_FILE" | sed '/^$/d' | while IFS='' read -r ARG_LINE || [ -n "$ARG_LINE" ]; do sed '/^#/d' "$ARGS_FILE" | sed '/^$/d' | while IFS='' read -r ARG_LINE || [ -n "$ARG_LINE" ]; do
## in the loop, split the 'key[:space:]value' pair ## in the loop, split the 'key[:space:]value' pair
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}')
@ -450,7 +447,7 @@ generate_config() {
## if they are different ## if they are different
if [ -n "$TMP_ARG_VALUE" ]; then if [ -n "$TMP_ARG_VALUE" ]; then
## if the old value is present, replace it with generated value ## if the old value is present, replace it with generated value
sh -c "$SED_REPLACE 's|^$ARG_KEY.*$|$ARG_LINE|' $TMP_ARG_FILE" sh -c "$SED_REPLACE 's|^$ARG_KEY.*$|$ARG_LINE|' \"$TMP_ARG_FILE\""
else else
## otherwise append generated value to the end ## otherwise append generated value to the end
echo "$ARG_LINE" >> "$TMP_ARG_FILE" echo "$ARG_LINE" >> "$TMP_ARG_FILE"
@ -458,13 +455,9 @@ generate_config() {
fi fi
done done
echo "$name_type $node_name" >> "$TMP_ARG_FILE" echo "$name_type $node_name" >> "$TMP_ARG_FILE"
echo "-mnesia dir '\"$DATA_DIR/mnesia/$NAME\"'" >> "$TMP_ARG_FILE"
## rename the generated vm.<time>.args file ## rename the generated vm.<time>.args file
mv -f "$TMP_ARG_FILE" "$HOCON_GEN_ARG_FILE" mv -f "$TMP_ARG_FILE" "$ARGS_FILE"
# shellcheck disable=SC2086
if ! relx_nodetool chkconfig $CONFIG_ARGS; then
die "failed_to_check_config $CONFIG_ARGS"
fi
} }
# check if a PID is down # check if a PID is down
@ -585,7 +578,11 @@ maybe_log_to_console() {
# check if using an OTP version that has the mnesia_hook patch for use # check if using an OTP version that has the mnesia_hook patch for use
# in mria. # in mria.
is_otp_compatible() { is_otp_compatible() {
"$ERTS_DIR"/bin/erl -noshell -eval 'try mnesia_hook:module_info() of _ -> init:stop() catch _:_ -> init:stop(1) end.' 1>/dev/null 2>/dev/null "$BINDIR/$PROGNAME" \
-noshell \
-boot_var RELEASE_LIB "$ERTS_LIB_DIR/lib" \
-boot "$REL_DIR/start_clean" \
-eval 'try mnesia_hook:module_info() of _ -> init:stop() catch _:_ -> halt(1) end.' >/dev/null 2>&1
} }
## IS_BOOT_COMMAND is set for later to inspect node name and cookie from hocon config (or env variable) ## IS_BOOT_COMMAND is set for later to inspect node name and cookie from hocon config (or env variable)
@ -594,7 +591,7 @@ case "${COMMAND}" in
IS_BOOT_COMMAND='yes' IS_BOOT_COMMAND='yes'
;; ;;
ertspath) ertspath)
echo "$ERTS_PATH" echo "$ERTS_DIR"
exit 0 exit 0
;; ;;
*) *)
@ -625,7 +622,6 @@ fi
# force to use 'emqx' short name # force to use 'emqx' short name
[ -z "$NAME" ] && NAME='emqx' [ -z "$NAME" ] && NAME='emqx'
MNESIA_DATA_DIR="$DATA_DIR/mnesia/$NAME"
case "$NAME" in case "$NAME" in
*@*) *@*)
@ -672,7 +668,7 @@ if [[ "${EMQX_DB__BACKEND:-}" != "mnesia"
fi fi
fi fi
cd "$ROOTDIR" cd "$RUNNER_ROOT_DIR"
case "${COMMAND}" in case "${COMMAND}" in
start) start)
@ -722,7 +718,7 @@ case "${COMMAND}" in
else else
echo "$EMQX_DESCRIPTION $REL_VSN failed to start in ${WAIT_TIME} seconds." echo "$EMQX_DESCRIPTION $REL_VSN failed to start in ${WAIT_TIME} seconds."
echo "Please find more information in erlang.log.N" echo "Please find more information in erlang.log.N"
echo "Or run 'DEBUG=1 $0 console' to have logs printed to console." echo "Or run 'env DEBUG=1 $0 console' to have logs printed to console."
exit 1 exit 1
fi fi
;; ;;
@ -779,7 +775,7 @@ case "${COMMAND}" in
assert_node_alive assert_node_alive
shift shift
relx_rem_sh remsh
;; ;;
upgrade|downgrade|install|unpack|uninstall) upgrade|downgrade|install|unpack|uninstall)
@ -793,8 +789,8 @@ case "${COMMAND}" in
assert_node_alive assert_node_alive
ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARG" \ ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARGS" \
exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \ exec "$BINDIR/escript" "$RUNNER_ROOT_DIR/bin/install_upgrade.escript" \
"$COMMAND" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@" "$COMMAND" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@"
;; ;;
@ -803,17 +799,17 @@ case "${COMMAND}" in
shift shift
ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARG" \ ERL_FLAGS="${ERL_FLAGS:-} $EPMD_ARGS" \
exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \ exec "$BINDIR/escript" "$RUNNER_ROOT_DIR/bin/install_upgrade.escript" \
"versions" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@" "versions" "{'$REL_NAME', \"$NAME_TYPE\", '$NAME', '$COOKIE'}" "$@"
;; ;;
console|console_clean) console|console_clean|foreground)
# .boot file typically just $REL_NAME (ie, the app name) # .boot file typically just $REL_NAME (ie, the app name)
# however, for debugging, sometimes start_clean.boot is useful. # however, for debugging, sometimes start_clean.boot is useful.
# For e.g. 'setup', one may even want to name another boot script. # For e.g. 'setup', one may even want to name another boot script.
case "$COMMAND" in case "$COMMAND" in
console) console|foreground)
if [ -f "$REL_DIR/$REL_NAME.boot" ]; then if [ -f "$REL_DIR/$REL_NAME.boot" ]; then
BOOTFILE="$REL_DIR/$REL_NAME" BOOTFILE="$REL_DIR/$REL_NAME"
else else
@ -824,6 +820,14 @@ case "${COMMAND}" in
BOOTFILE="$REL_DIR/start_clean" BOOTFILE="$REL_DIR/start_clean"
;; ;;
esac esac
case "$COMMAND" in
foreground)
FOREGROUNDOPTIONS="-noshell -noinput +Bd"
;;
*)
FOREGROUNDOPTIONS=''
;;
esac
# set before generate_config # set before generate_config
if [ "${_EMQX_START_DAEMON_MODE:-}" = 1 ]; then if [ "${_EMQX_START_DAEMON_MODE:-}" = 1 ]; then
@ -847,25 +851,31 @@ case "${COMMAND}" in
# Store passed arguments since they will be erased by `set` # Store passed arguments since they will be erased by `set`
ARGS="$*" ARGS="$*"
# shellcheck disable=SC2086 # $CONFIG_ARGS $EPMD_ARG are supposed to be split by whitespace # shellcheck disable=SC2086
# Build an array of arguments to pass to exec later on # Build an array of arguments to pass to exec later on
# Build it here because this command will be used for logging. # Build it here because this command will be used for logging.
if [ "$IS_ELIXIR" = yes ] if [ "$IS_ELIXIR" = no ] || [ "${EMQX_CONSOLE_FLAVOR:-}" = 'erl' ] ; then
then # pass down RELEASE_LIB so we can switch to IS_ELIXIR=no
set -- "$REL_DIR/iex" \ # to boot an Erlang node from the elixir release
--boot "$BOOTFILE" \ set -- "$BINDIR/erlexec" \
--erl "-mode $CODE_LOADING_MODE" \ $FOREGROUNDOPTIONS \
--boot-var RELEASE_LIB "$ERTS_LIB_DIR" \ -boot "$BOOTFILE" \
--erl "-mnesia dir \"${MNESIA_DATA_DIR}\"" \ -boot_var RELEASE_LIB "$ERTS_LIB_DIR" \
--erl "$CONFIG_ARGS" \ -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
--erl "$EPMD_ARG" \ -mode "$CODE_LOADING_MODE" \
--werl -config "$CONF_FILE" \
-args_file "$ARGS_FILE" \
$EPMD_ARGS
else else
set -- "$BINDIR/erlexec" \ set -- "$REL_DIR/iex" \
-boot "$BOOTFILE" -mode "$CODE_LOADING_MODE" \ --boot "$BOOTFILE" \
-boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \ --boot-var RELEASE_LIB "${ERTS_LIB_DIR}" \
-mnesia dir "\"${MNESIA_DATA_DIR}\"" \ --erl-config "${CONF_FILE}" \
$CONFIG_ARGS $EPMD_ARG --vm-args "${ARGS_FILE}" \
--erl "$FOREGROUNDOPTIONS" \
--erl "-mode $CODE_LOADING_MODE" \
--erl "$EPMD_ARGS" \
--werl
fi fi
# Log the startup # Log the startup
@ -875,59 +885,6 @@ case "${COMMAND}" in
exec "$@" -- ${1+$ARGS} exec "$@" -- ${1+$ARGS}
;; ;;
foreground)
# start up the release in the foreground for use by runit
# or other supervision services
maybe_log_to_console
#generate app.config and vm.args
generate_config "$NAME_TYPE" "$NAME"
check_license
[ -f "$REL_DIR/$REL_NAME.boot" ] && BOOTFILE="$REL_NAME" || BOOTFILE=start
FOREGROUNDOPTIONS="-noshell -noinput +Bd"
# Setup beam-required vars
EMU=beam
PROGNAME="${0#*/}"
export EMU
export PROGNAME
# Store passed arguments since they will be erased by `set`
ARGS="$*"
# shellcheck disable=SC2086 # $CONFIG_ARGS $EPMD_ARG are supposed to be split by whitespace
# Build an array of arguments to pass to exec later on
# Build it here because this command will be used for logging.
if [ "$IS_ELIXIR" = yes ]
then
set -- "$REL_DIR/elixir" \
--boot "$REL_DIR/start" \
--erl "$FOREGROUNDOPTIONS" \
--erl "-mode $CODE_LOADING_MODE" \
--boot-var RELEASE_LIB "$ERTS_LIB_DIR" \
--boot-var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
--erl "-mnesia dir \"${MNESIA_DATA_DIR}\"" \
--erl "$CONFIG_ARGS" \
--erl "$EPMD_ARG" \
--no-halt
else
set -- "$BINDIR/erlexec" $FOREGROUNDOPTIONS \
-boot "$REL_DIR/$BOOTFILE" -mode "$CODE_LOADING_MODE" \
-boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
-mnesia dir "\"${MNESIA_DATA_DIR}\"" \
$CONFIG_ARGS $EPMD_ARG
fi
# Log the startup
logger -t "${REL_NAME}[$$]" "EXEC: $* -- ${1+$ARGS}"
# Start the VM
exec "$@" -- ${1+$ARGS}
;;
ctl) ctl)
assert_node_alive assert_node_alive

View File

@ -59,7 +59,7 @@ defmodule EMQXUmbrella.MixProject do
{:gen_rpc, github: "emqx/gen_rpc", tag: "2.8.1", override: true}, {:gen_rpc, github: "emqx/gen_rpc", tag: "2.8.1", override: true},
{:minirest, github: "emqx/minirest", tag: "1.2.12", override: true}, {:minirest, github: "emqx/minirest", tag: "1.2.12", override: true},
{:ecpool, github: "emqx/ecpool", tag: "0.5.2"}, {:ecpool, github: "emqx/ecpool", tag: "0.5.2"},
{:replayq, "0.3.3", override: true}, {:replayq, "0.3.4", override: true},
{:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4", override: true}, {:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4", override: true},
{:emqtt, github: "emqx/emqtt", tag: "1.5.0", override: true}, {:emqtt, github: "emqx/emqtt", tag: "1.5.0", override: true},
{:rulesql, github: "emqx/rulesql", tag: "0.1.4"}, {:rulesql, github: "emqx/rulesql", tag: "0.1.4"},
@ -531,13 +531,10 @@ defmodule EMQXUmbrella.MixProject do
defp template_vars(release, release_type, :bin = _package_type, edition_type) do defp template_vars(release, release_type, :bin = _package_type, edition_type) do
[ [
platform_bin_dir: "bin",
platform_data_dir: "data", platform_data_dir: "data",
platform_etc_dir: "etc", platform_etc_dir: "etc",
platform_lib_dir: "lib",
platform_log_dir: "log", platform_log_dir: "log",
platform_plugins_dir: "plugins", platform_plugins_dir: "plugins",
runner_root_dir: "$(cd $(dirname $(readlink $0 || echo $0))/..; pwd -P)",
runner_bin_dir: "$RUNNER_ROOT_DIR/bin", runner_bin_dir: "$RUNNER_ROOT_DIR/bin",
emqx_etc_dir: "$RUNNER_ROOT_DIR/etc", emqx_etc_dir: "$RUNNER_ROOT_DIR/etc",
runner_lib_dir: "$RUNNER_ROOT_DIR/lib", runner_lib_dir: "$RUNNER_ROOT_DIR/lib",
@ -557,13 +554,10 @@ defmodule EMQXUmbrella.MixProject do
defp template_vars(release, release_type, :pkg = _package_type, edition_type) do defp template_vars(release, release_type, :pkg = _package_type, edition_type) do
[ [
platform_bin_dir: "",
platform_data_dir: "/var/lib/emqx", platform_data_dir: "/var/lib/emqx",
platform_etc_dir: "/etc/emqx", platform_etc_dir: "/etc/emqx",
platform_lib_dir: "",
platform_log_dir: "/var/log/emqx", platform_log_dir: "/var/log/emqx",
platform_plugins_dir: "/var/lib/emqx/plugins", platform_plugins_dir: "/var/lib/emqx/plugins",
runner_root_dir: "/usr/lib/emqx",
runner_bin_dir: "/usr/bin", runner_bin_dir: "/usr/bin",
emqx_etc_dir: "/etc/emqx", emqx_etc_dir: "/etc/emqx",
runner_lib_dir: "$RUNNER_ROOT_DIR/lib", runner_lib_dir: "$RUNNER_ROOT_DIR/lib",

View File

@ -58,7 +58,7 @@
, {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.8.1"}}} , {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.8.1"}}}
, {minirest, {git, "https://github.com/emqx/minirest", {tag, "1.2.12"}}} , {minirest, {git, "https://github.com/emqx/minirest", {tag, "1.2.12"}}}
, {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.2"}}} , {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.2"}}}
, {replayq, "0.3.3"} , {replayq, "0.3.4"}
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}} , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.5.0"}}} , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.5.0"}}}
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}} , {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}}

View File

@ -267,13 +267,10 @@ overlay_vars_edition(ee) ->
%% vars per packaging type, bin(zip/tar.gz/docker) or pkg(rpm/deb) %% vars per packaging type, bin(zip/tar.gz/docker) or pkg(rpm/deb)
overlay_vars_pkg(bin) -> overlay_vars_pkg(bin) ->
[ {platform_bin_dir, "bin"} [ {platform_data_dir, "data"}
, {platform_data_dir, "data"}
, {platform_etc_dir, "etc"} , {platform_etc_dir, "etc"}
, {platform_lib_dir, "lib"}
, {platform_log_dir, "log"} , {platform_log_dir, "log"}
, {platform_plugins_dir, "plugins"} , {platform_plugins_dir, "plugins"}
, {runner_root_dir, "$(cd $(dirname $(readlink $0 || echo $0))/..; pwd -P)"}
, {runner_bin_dir, "$RUNNER_ROOT_DIR/bin"} , {runner_bin_dir, "$RUNNER_ROOT_DIR/bin"}
, {emqx_etc_dir, "$RUNNER_ROOT_DIR/etc"} , {emqx_etc_dir, "$RUNNER_ROOT_DIR/etc"}
, {runner_lib_dir, "$RUNNER_ROOT_DIR/lib"} , {runner_lib_dir, "$RUNNER_ROOT_DIR/lib"}
@ -282,13 +279,10 @@ overlay_vars_pkg(bin) ->
, {is_elixir, "no"} , {is_elixir, "no"}
]; ];
overlay_vars_pkg(pkg) -> overlay_vars_pkg(pkg) ->
[ {platform_bin_dir, ""} [ {platform_data_dir, "/var/lib/emqx"}
, {platform_data_dir, "/var/lib/emqx"}
, {platform_etc_dir, "/etc/emqx"} , {platform_etc_dir, "/etc/emqx"}
, {platform_lib_dir, ""}
, {platform_log_dir, "/var/log/emqx"} , {platform_log_dir, "/var/log/emqx"}
, {platform_plugins_dir, "/var/lib/emqx/plugins"} , {platform_plugins_dir, "/var/lib/emqx/plugins"}
, {runner_root_dir, "/usr/lib/emqx"}
, {runner_bin_dir, "/usr/bin"} , {runner_bin_dir, "/usr/bin"}
, {emqx_etc_dir, "/etc/emqx"} , {emqx_etc_dir, "/etc/emqx"}
, {runner_lib_dir, "$RUNNER_ROOT_DIR/lib"} , {runner_lib_dir, "$RUNNER_ROOT_DIR/lib"}

View File

@ -6,13 +6,12 @@
REL_VSN="{{ release_version }}" REL_VSN="{{ release_version }}"
ERTS_VSN="{{ erts_vsn }}" ERTS_VSN="{{ erts_vsn }}"
ERL_OPTS="{{ erl_opts }}" ERL_OPTS="{{ erl_opts }}"
RUNNER_ROOT_DIR="{{ runner_root_dir }}"
RUNNER_BIN_DIR="{{ runner_bin_dir }}" RUNNER_BIN_DIR="{{ runner_bin_dir }}"
RUNNER_LOG_DIR="{{ runner_log_dir }}" RUNNER_LOG_DIR="{{ runner_log_dir }}"
RUNNER_LIB_DIR="{{ runner_lib_dir }}" RUNNER_LIB_DIR="{{ runner_lib_dir }}"
EMQX_ETC_DIR="{{ emqx_etc_dir }}" EMQX_ETC_DIR="{{ emqx_etc_dir }}"
RUNNER_USER="{{ runner_user }}" RUNNER_USER="{{ runner_user }}"
IS_ELIXIR="{{ is_elixir }}" IS_ELIXIR="${IS_ELIXIR:-{{ is_elixir }}}"
SCHEMA_MOD="{{ emqx_schema_mod }}" SCHEMA_MOD="{{ emqx_schema_mod }}"
IS_ENTERPRISE="{{ is_enterprise }}" IS_ENTERPRISE="{{ is_enterprise }}"
@ -20,6 +19,5 @@ export EMQX_DESCRIPTION='{{ emqx_description }}'
## computed vars ## computed vars
REL_NAME="emqx" REL_NAME="emqx"
ERTS_PATH="$RUNNER_ROOT_DIR/erts-$ERTS_VSN/bin"
## updated vars here ## updated vars here