Преглед на файлове

feat: change node.applications default to []

Zhongwen Deng преди 3 години
родител
ревизия
eb2a4df4af
променени са 4 файла, в които са добавени 34 реда и са изтрити 76 реда
  1. 0 1
      apps/emqx_conf/etc/emqx_conf.conf
  2. 32 3
      apps/emqx_machine/src/emqx_machine_boot.erl
  3. 0 37
      mix.exs
  4. 2 35
      rebar.config.erl

+ 0 - 1
apps/emqx_conf/etc/emqx_conf.conf

@@ -13,7 +13,6 @@ node {
   cookie: emqxsecretcookie
   data_dir: "{{ platform_data_dir }}"
   etc_dir: "{{ platform_etc_dir }}"
-  applications: "{{ emqx_machine_boot_apps }}"
 }
 
 log {

+ 32 - 3
apps/emqx_machine/src/emqx_machine_boot.erl

@@ -102,10 +102,39 @@ restart_type(App) ->
 %% 2. after join a cluster
 
 %% the list of (re)started apps depends on release type/edition
-%% and is configured in rebar.config.erl/mix.exs
 reboot_apps() ->
-    {ok, Apps} = application:get_env(emqx_machine, applications),
-    ?BASIC_REBOOT_APPS ++ Apps.
+    {ok, ConfigApps0} = application:get_env(emqx_machine, applications),
+    BaseRebootApps = basic_reboot_apps(),
+    ConfigApps = lists:filter(fun(App) -> not lists:member(App, BaseRebootApps) end, ConfigApps0),
+    BaseRebootApps ++ ConfigApps.
+
+basic_reboot_apps() ->
+    CE =
+        ?BASIC_REBOOT_APPS ++
+            [
+                emqx_prometheus,
+                emqx_modules,
+                emqx_dashboard,
+                emqx_connector,
+                emqx_gateway,
+                emqx_statsd,
+                emqx_resource,
+                emqx_rule_engine,
+                emqx_bridge,
+                emqx_plugin_libs,
+                emqx_management,
+                emqx_retainer,
+                emqx_exhook,
+                emqx_authn,
+                emqx_authz,
+                emqx_slow_subs,
+                emqx_auto_subscribe,
+                emqx_plugins
+            ],
+    case emqx_release:edition() of
+        ce -> CE;
+        ee -> CE ++ []
+    end.
 
 sorted_reboot_apps() ->
     Apps = [{App, app_deps(App)} || App <- reboot_apps()],

+ 0 - 37
mix.exs

@@ -215,34 +215,6 @@ defmodule EMQXUmbrella.MixProject do
       )
   end
 
-  def emqx_machine_boot_apps(:community) do
-    [
-      :emqx_prometheus,
-      :emqx_modules,
-      :emqx_dashboard,
-      :emqx_connector,
-      :emqx_gateway,
-      :emqx_statsd,
-      :emqx_resource,
-      :emqx_rule_engine,
-      :emqx_bridge,
-      :emqx_plugin_libs,
-      :emqx_management,
-      :emqx_retainer,
-      :emqx_exhook,
-      :emqx_authn,
-      :emqx_authz,
-      :emqx_auto_subscribe,
-      :emqx_slow_subs,
-      :emqx_plugins
-    ]
-  end
-
-  def emqx_machine_boot_apps(:enterprise) do
-    emqx_machine_boot_apps(:community) ++
-      []
-  end
-
   defp is_app(name) do
     case Application.load(name) do
       :ok ->
@@ -256,13 +228,6 @@ defmodule EMQXUmbrella.MixProject do
     end
   end
 
-  defp emqx_machine_boot_app_list(edition_type) do
-    edition_type
-    |> emqx_machine_boot_apps()
-    |> Enum.map(&Atom.to_string/1)
-    |> Enum.join(", ")
-  end
-
   def check_profile!() do
     valid_envs = [
       :dev,
@@ -559,7 +524,6 @@ defmodule EMQXUmbrella.MixProject do
       erl_opts: "",
       emqx_description: emqx_description(release_type, edition_type),
       emqx_schema_mod: emqx_schema_mod(edition_type),
-      emqx_machine_boot_apps: emqx_machine_boot_app_list(edition_type),
       is_elixir: "yes",
       is_enterprise: if(edition_type == :enterprise, do: "yes", else: "no")
     ] ++ build_info()
@@ -582,7 +546,6 @@ defmodule EMQXUmbrella.MixProject do
       erl_opts: "",
       emqx_description: emqx_description(release_type, edition_type),
       emqx_schema_mod: emqx_schema_mod(edition_type),
-      emqx_machine_boot_apps: emqx_machine_boot_app_list(edition_type),
       is_elixir: "yes",
       is_enterprise: if(edition_type == :enterprise, do: "yes", else: "no")
     ] ++ build_info()

+ 2 - 35
rebar.config.erl

@@ -256,14 +256,12 @@ overlay_vars_rel(cloud) ->
 overlay_vars_edition(ce) ->
     [
         {emqx_schema_mod, emqx_conf_schema},
-        {is_enterprise, "no"},
-        {emqx_machine_boot_apps, emqx_machine_boot_app_list(ce)}
+        {is_enterprise, "no"}
     ];
 overlay_vars_edition(ee) ->
     [
         {emqx_schema_mod, emqx_enterprise_conf_schema},
-        {is_enterprise, "yes"},
-        {emqx_machine_boot_apps, emqx_machine_boot_app_list(ee)}
+        {is_enterprise, "yes"}
     ].
 
 %% vars per packaging type, bin(zip/tar.gz/docker) or pkg(rpm/deb)
@@ -362,37 +360,6 @@ relx_apps_per_edition(ee) ->
 relx_apps_per_edition(ce) ->
     [].
 
-emqx_machine_boot_apps(ce) ->
-    [
-        emqx_prometheus,
-        emqx_modules,
-        emqx_dashboard,
-        emqx_connector,
-        emqx_gateway,
-        emqx_statsd,
-        emqx_resource,
-        emqx_rule_engine,
-        emqx_bridge,
-        emqx_plugin_libs,
-        emqx_management,
-        emqx_retainer,
-        emqx_exhook,
-        emqx_authn,
-        emqx_authz,
-        emqx_slow_subs,
-        emqx_auto_subscribe,
-        emqx_plugins
-    ];
-emqx_machine_boot_apps(ee) ->
-    emqx_machine_boot_apps(ce) ++
-        [].
-
-emqx_machine_boot_app_list(Edition) ->
-    string:join(
-        [atom_to_list(AppName) || AppName <- emqx_machine_boot_apps(Edition)],
-        ", "
-    ).
-
 relx_overlay(ReleaseType, Edition) ->
     [
         {mkdir, "log/"},