diff --git a/apps/emqx_management/src/emqx_management.appup.src b/apps/emqx_management/src/emqx_management.appup.src index 1463334b4..17260b107 100644 --- a/apps/emqx_management/src/emqx_management.appup.src +++ b/apps/emqx_management/src/emqx_management.appup.src @@ -1,7 +1,10 @@ %% -*- mode: erlang -*- {VSN, [ {<<"4\\.3\\.[0-9]+">>, - [ {apply,{minirest,stop_http,['http:management']}}, + [ %% Stop the http listener to load the latest http handlers. + %% We can only stop these listeners here because we can't get the list of + %% currently started http listener via app-env during the hot upgrade. + {apply,{minirest,stop_http,['http:management']}}, {apply,{minirest,stop_http,['https:management']}}, {restart_application, emqx_management} ]}, diff --git a/apps/emqx_management/src/emqx_mgmt_http.erl b/apps/emqx_management/src/emqx_mgmt_http.erl index 473cec306..5ccc2cf5e 100644 --- a/apps/emqx_management/src/emqx_mgmt_http.erl +++ b/apps/emqx_management/src/emqx_mgmt_http.erl @@ -85,6 +85,8 @@ listeners() -> application:get_env(?APP, listeners, []). listener_name(Proto) -> + %% NOTE: this name has referenced by emqx_management.appup.src. + %% Please don't change it except you have got how to handle it in hot-upgrade list_to_atom(atom_to_list(Proto) ++ ":management"). http_handlers() -> diff --git a/lib-ce/emqx_dashboard/src/emqx_dashboard.appup.src b/lib-ce/emqx_dashboard/src/emqx_dashboard.appup.src index 902585ffb..cefe79ebd 100644 --- a/lib-ce/emqx_dashboard/src/emqx_dashboard.appup.src +++ b/lib-ce/emqx_dashboard/src/emqx_dashboard.appup.src @@ -5,12 +5,19 @@ %% NOTE: this depends on the fact that emqx_dashboard is always %% the last application gets upgraded [ {apply, {emqx_rule_engine, load_providers, []}} + %% Stop the http listener to load the latest http handlers. + %% We can only stop these listeners here because we can't get the list of + %% currently started http listener via app-env during the hot upgrade. + , {apply, {minirest, stop_http, ['http:dashboard']}} + , {apply, {minirest, stop_http, ['https:dashboard']}} , {restart_application, emqx_dashboard} , {apply, {emqx_plugins, load, []}} ]} ], [ {<<".*">>, [ {apply, {emqx_rule_engine, load_providers, []}} + , {apply, {minirest, stop_http, ['http:dashboard']}} + , {apply, {minirest, stop_http, ['https:dashboard']}} , {restart_application, emqx_dashboard} , {apply, {emqx_plugins, load, []}} ]} diff --git a/lib-ce/emqx_dashboard/src/emqx_dashboard.erl b/lib-ce/emqx_dashboard/src/emqx_dashboard.erl index 5d17c019e..c4a774072 100644 --- a/lib-ce/emqx_dashboard/src/emqx_dashboard.erl +++ b/lib-ce/emqx_dashboard/src/emqx_dashboard.erl @@ -80,6 +80,8 @@ listeners() -> application:get_env(?APP, listeners, []). listener_name(Proto) -> + %% NOTE: this name has referenced by emqx_dashboard.appup.src. + %% Please don't change it except you have got how to handle it in hot-upgrade list_to_atom(atom_to_list(Proto) ++ ":dashboard"). %%--------------------------------------------------------------------