Merge branch 'master' into dev-feng
This commit is contained in:
commit
35bc96807e
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -2,6 +2,20 @@
|
||||||
emqttd ChangeLog
|
emqttd ChangeLog
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
0.10.2-beta (2015-08-26)
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Improve: issue#257 - After the node name changed, the broker cannot restart for mnesia schema error.
|
||||||
|
|
||||||
|
|
||||||
|
0.10.1-beta (2015-08-25)
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Bugfix: issue#259 - when clustered the emqttd_dashboard port is close, and the 'emqttd' application cannot stop normally.
|
||||||
|
|
||||||
|
Feature: issue#262 - Add 'http://host:8083/mqtt/status' Page for health check
|
||||||
|
|
||||||
|
|
||||||
0.10.0-beta (2015-08-20)
|
0.10.0-beta (2015-08-20)
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c87d9c4580e568917b4b026c809becf2cccd469e
|
Subproject commit edbb6dc0862973137b056248efb5940d003d75be
|
|
@ -20,6 +20,7 @@ RUNNER_BASE_DIR={{runner_base_dir}}
|
||||||
RUNNER_ETC_DIR={{runner_etc_dir}}
|
RUNNER_ETC_DIR={{runner_etc_dir}}
|
||||||
RUNNER_LIB_DIR={{platform_lib_dir}}
|
RUNNER_LIB_DIR={{platform_lib_dir}}
|
||||||
RUNNER_LOG_DIR={{runner_log_dir}}
|
RUNNER_LOG_DIR={{runner_log_dir}}
|
||||||
|
RUNNER_DATA_DIR=$RUNNER_BASE_DIR/data
|
||||||
RUNNER_PLUGINS_DIR=$RUNNER_BASE_DIR/plugins
|
RUNNER_PLUGINS_DIR=$RUNNER_BASE_DIR/plugins
|
||||||
|
|
||||||
# Note the trailing slash on $PIPE_DIR/
|
# Note the trailing slash on $PIPE_DIR/
|
||||||
|
@ -72,6 +73,8 @@ if [ -z "$NAME_ARG" ]; then
|
||||||
echo "vm.args needs to have either -name or -sname parameter."
|
echo "vm.args needs to have either -name or -sname parameter."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
NAME_ARR=(${NAME_ARG// / })
|
||||||
|
NODE_NAME=${NAME_ARR[1]}
|
||||||
|
|
||||||
# Extract the target cookie
|
# Extract the target cookie
|
||||||
COOKIE_ARG=`grep '^\-setcookie' $RUNNER_ETC_DIR/vm.args`
|
COOKIE_ARG=`grep '^\-setcookie' $RUNNER_ETC_DIR/vm.args`
|
||||||
|
@ -264,9 +267,12 @@ case "$1" in
|
||||||
BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
|
BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
|
||||||
EMU=beam
|
EMU=beam
|
||||||
PROGNAME=`echo $0 | sed 's/.*\///'`
|
PROGNAME=`echo $0 | sed 's/.*\///'`
|
||||||
|
# Setup Mnesia Dir
|
||||||
|
MNESIA_DIR="$RUNNER_DATA_DIR/mnesia/$NODE_NAME"
|
||||||
CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$SCRIPT \
|
CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$SCRIPT \
|
||||||
-embedded -config $RUNNER_ETC_DIR/emqttd.config \
|
-embedded -config $RUNNER_ETC_DIR/emqttd.config \
|
||||||
-pa $RUNNER_LIB_DIR/basho-patches \
|
-pa $RUNNER_LIB_DIR/basho-patches \
|
||||||
|
-mnesia dir "\"${MNESIA_DIR}\"" \
|
||||||
-args_file $RUNNER_ETC_DIR/vm.args -- ${1+"$@"}"
|
-args_file $RUNNER_ETC_DIR/vm.args -- ${1+"$@"}"
|
||||||
export EMU
|
export EMU
|
||||||
export ROOTDIR
|
export ROOTDIR
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
@echo off
|
||||||
@setlocal
|
@setlocal
|
||||||
|
@setlocal enabledelayedexpansion
|
||||||
|
|
||||||
@set node_name=emqttd
|
@set node_name=emqttd
|
||||||
|
|
||||||
|
@ -69,7 +71,16 @@
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:console
|
:console
|
||||||
@start "%node_name% console" %werl% -boot "%node_boot_script%" -config "%sys_config%" -args_file "%vm_args%" -sname %node_name%
|
set dest_path=%~dp0
|
||||||
|
cd /d !dest_path!..\plugins
|
||||||
|
set current_path=%cd%
|
||||||
|
set plugins=
|
||||||
|
for /d %%P in (*) do (
|
||||||
|
set "plugins=!plugins!!current_path!\%%P\ebin "
|
||||||
|
)
|
||||||
|
cd /d %node_root%
|
||||||
|
|
||||||
|
@start "%node_name% console" %werl% -boot "%node_boot_script%" -config "%sys_config%" -args_file "%vm_args%" -sname %node_name% -pa %plugins%
|
||||||
@goto :EOF
|
@goto :EOF
|
||||||
|
|
||||||
:query
|
:query
|
||||||
|
|
|
@ -1,40 +1,50 @@
|
||||||
@setlocal
|
@setlocal
|
||||||
|
@echo off
|
||||||
@rem Parse arguments. erlsrv.exe prepends erl arguments prior to first ++.
|
@setlocal enabledelayedexpansion
|
||||||
@rem Other args are position dependent.
|
|
||||||
@set args="%*"
|
@rem Parse arguments. erlsrv.exe prepends erl arguments prior to first ++.
|
||||||
@for /F "delims=++ tokens=1,2,3" %%I in (%args%) do @(
|
@rem Other args are position dependent.
|
||||||
@set erl_args=%%I
|
@set args="%*"
|
||||||
@call :set_trim node_name %%J
|
@for /F "delims=++ tokens=1,2,3" %%I in (%args%) do @(
|
||||||
@rem Trim spaces from the left of %%K (node_root), which may have spaces inside
|
@set erl_args=%%I
|
||||||
@for /f "tokens=* delims= " %%a in ("%%K") do @set node_root=%%a
|
@call :set_trim node_name %%J
|
||||||
)
|
@rem Trim spaces from the left of %%K (node_root), which may have spaces inside
|
||||||
|
@for /f "tokens=* delims= " %%a in ("%%K") do @set node_root=%%a
|
||||||
@set releases_dir=%node_root%\releases
|
)
|
||||||
|
|
||||||
@rem parse ERTS version and release version from start_erl.dat
|
@set releases_dir=%node_root%\releases
|
||||||
@for /F "usebackq tokens=1,2" %%I in ("%releases_dir%\start_erl.data") do @(
|
|
||||||
@call :set_trim erts_version %%I
|
@rem parse ERTS version and release version from start_erl.dat
|
||||||
@call :set_trim release_version %%J
|
@for /F "usebackq tokens=1,2" %%I in ("%releases_dir%\start_erl.data") do @(
|
||||||
)
|
@call :set_trim erts_version %%I
|
||||||
|
@call :set_trim release_version %%J
|
||||||
@set erl_exe="%node_root%\erts-%erts_version%\bin\erl.exe"
|
)
|
||||||
@set boot_file="%releases_dir%\%release_version%\%node_name%"
|
|
||||||
|
@set erl_exe="%node_root%\erts-%erts_version%\bin\erl.exe"
|
||||||
@if exist "%releases_dir%\%release_version%\sys.config" (
|
@set boot_file="%releases_dir%\%release_version%\%node_name%"
|
||||||
@set app_config="%releases_dir%\%release_version%\sys.config"
|
|
||||||
) else (
|
@if exist "%releases_dir%\%release_version%\sys.config" (
|
||||||
@set app_config="%node_root%\etc\emqttd.config"
|
@set app_config="%releases_dir%\%release_version%\sys.config"
|
||||||
)
|
) else (
|
||||||
|
@set app_config="%node_root%\etc\emqttd.config"
|
||||||
@if exist "%releases_dir%\%release_version%\vm.args" (
|
)
|
||||||
@set vm_args="%releases_dir%\%release_version%\vm.args"
|
|
||||||
) else (
|
@if exist "%releases_dir%\%release_version%\vm.args" (
|
||||||
@set vm_args="%node_root%\etc\vm.args"
|
@set vm_args="%releases_dir%\%release_version%\vm.args"
|
||||||
)
|
) else (
|
||||||
|
@set vm_args="%node_root%\etc\vm.args"
|
||||||
@%erl_exe% %erl_args% -boot %boot_file% -config %app_config% -args_file %vm_args%
|
)
|
||||||
|
|
||||||
:set_trim
|
set dest_path=%~dp0
|
||||||
@set %1=%2
|
cd /d !dest_path!..\plugins
|
||||||
@goto :EOF
|
set current_path=%cd%
|
||||||
|
set plugins=
|
||||||
|
for /d %%P in (*) do (
|
||||||
|
set "plugins=!plugins!!current_path!\%%P\ebin "
|
||||||
|
)
|
||||||
|
cd /d %node_root%
|
||||||
|
@%erl_exe% %erl_args% -boot %boot_file% -config %app_config% -args_file %vm_args% -pa %plugins%
|
||||||
|
|
||||||
|
:set_trim
|
||||||
|
@set %1=%2
|
||||||
|
@goto :EOF
|
||||||
|
|
|
@ -6,11 +6,6 @@
|
||||||
## Cookie for distributed erlang
|
## Cookie for distributed erlang
|
||||||
-setcookie emqttdsecretcookie
|
-setcookie emqttdsecretcookie
|
||||||
|
|
||||||
##-------------------------------------------------------------------------
|
|
||||||
## Mnesia dir. NOTICE: quote the dir with '" "'
|
|
||||||
##-------------------------------------------------------------------------
|
|
||||||
-mnesia dir '"data/mnesia"'
|
|
||||||
|
|
||||||
##-------------------------------------------------------------------------
|
##-------------------------------------------------------------------------
|
||||||
## Flags
|
## Flags
|
||||||
##-------------------------------------------------------------------------
|
##-------------------------------------------------------------------------
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
{mkdir, "etc/"},
|
{mkdir, "etc/"},
|
||||||
{mkdir, "etc/ssl/"},
|
{mkdir, "etc/ssl/"},
|
||||||
{mkdir, "data/"},
|
{mkdir, "data/"},
|
||||||
|
{mkdir, "data/mnesia"},
|
||||||
{mkdir, "plugins/"},
|
{mkdir, "plugins/"},
|
||||||
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
|
{copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
|
||||||
{template, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
|
{template, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{application, emqttd,
|
{application, emqttd,
|
||||||
[
|
[
|
||||||
{description, "Erlang MQTT Broker"},
|
{description, "Erlang MQTT Broker"},
|
||||||
{vsn, "0.10.1"},
|
{vsn, "0.10.2"},
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [kernel,
|
{applications, [kernel,
|
||||||
|
|
|
@ -39,6 +39,17 @@
|
||||||
handle_request(Req) ->
|
handle_request(Req) ->
|
||||||
handle_request(Req:get(method), Req:get(path), Req).
|
handle_request(Req:get(method), Req:get(path), Req).
|
||||||
|
|
||||||
|
handle_request('GET', "/mqtt/status", Req) ->
|
||||||
|
{InternalStatus, _ProvidedStatus} = init:get_status(),
|
||||||
|
AppStatus =
|
||||||
|
case lists:keysearch(emqttd, 1, application:which_applications()) of
|
||||||
|
false -> not_running;
|
||||||
|
{value, _Ver} -> running
|
||||||
|
end,
|
||||||
|
Status = io_lib:format("Node ~s is ~s~nemqttd is ~s~n",
|
||||||
|
[node(), InternalStatus, AppStatus]),
|
||||||
|
Req:ok({"text/plain", iolist_to_binary(Status)});
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% HTTP Publish API
|
%% HTTP Publish API
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue