chore(build): add more enterprise build support (#4302)

This commit is contained in:
turtleDeng 2021-03-08 20:47:31 +08:00 committed by GitHub
parent 72f5468001
commit 115397523d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 27 deletions

View File

@ -209,7 +209,12 @@ generate_config() {
# the vm, we need to pass it in twice. # the vm, we need to pass it in twice.
CONFIG_ARGS=" -config $RUNNER_ETC_DIR/app.config -args_file $RUNNER_ETC_DIR/vm.args -vm_args $RUNNER_ETC_DIR/vm.args " CONFIG_ARGS=" -config $RUNNER_ETC_DIR/app.config -args_file $RUNNER_ETC_DIR/vm.args -vm_args $RUNNER_ETC_DIR/vm.args "
else else
CONFIG_ARGS=$("$ERTS_PATH"/escript "$RUNNER_ROOT_DIR"/bin/cuttlefish -i "$REL_DIR"/emqx.schema -c "$RUNNER_ETC_DIR"/emqx.conf -d "$RUNNER_DATA_DIR"/configs generate) EMQX_LICENSE_CONF_OPTION=""
if [ "${EMQX_LICENSE_CONF:-}" != "" ]; then
EMQX_LICENSE_CONF_OPTION="-i ${EMQX_LICENSE_CONF}"
fi
# shellcheck disable=SC2086
CONFIG_ARGS=$("$ERTS_PATH"/escript "$RUNNER_ROOT_DIR"/bin/cuttlefish -i "$REL_DIR"/emqx.schema $EMQX_LICENSE_CONF_OPTION -c "$RUNNER_ETC_DIR"/emqx.conf -d "$RUNNER_DATA_DIR"/configs generate)
## Merge cuttlefish generated *.args into the vm.args ## Merge cuttlefish generated *.args into the vm.args
CUTTLE_GEN_ARG_FILE=$(echo "$CONFIG_ARGS" | sed -n 's/^.*\(vm_args[[:space:]]\)//p' | awk '{print $1}') CUTTLE_GEN_ARG_FILE=$(echo "$CONFIG_ARGS" | sed -n 's/^.*\(vm_args[[:space:]]\)//p' | awk '{print $1}')

View File

@ -16,6 +16,7 @@ RUNNER_USER="{{ runner_user }}"
EMQX_DISCR="{{ emqx_description }}" EMQX_DISCR="{{ emqx_description }}"
LIB_EKKA_DIR="${RUNNER_LIB_DIR}/ekka-$(grep ekka "${RUNNER_ROOT_DIR}/releases/RELEASES" | awk -F '\"' '{print $2}')" LIB_EKKA_DIR="${RUNNER_LIB_DIR}/ekka-$(grep ekka "${RUNNER_ROOT_DIR}/releases/RELEASES" | awk -F '\"' '{print $2}')"
EMQX_LICENSE_CONF=''
## computed vars ## computed vars
REL_NAME="emqx" REL_NAME="emqx"
ERTS_PATH="$RUNNER_ROOT_DIR/erts-$ERTS_VSN/bin" ERTS_PATH="$RUNNER_ROOT_DIR/erts-$ERTS_VSN/bin"

View File

@ -1,7 +1,8 @@
{emqx_management, true}. {emqx_management, true}.
{emqx_recon, true}.
{emqx_retainer, true}.
{emqx_dashboard, true}. {emqx_dashboard, true}.
{emqx_telemetry, true}. {emqx_modules, {{enable_plugin_emqx_modules}}}.
{emqx_recon, {{enable_plugin_emqx_recon}}}.
{emqx_retainer, {{enable_plugin_emqx_retainer}}}.
{emqx_telemetry, {{enable_plugin_emqx_telemetry}}}.
{emqx_rule_engine, {{enable_plugin_emqx_rule_engine}}}. {emqx_rule_engine, {{enable_plugin_emqx_rule_engine}}}.
{emqx_bridge_mqtt, {{enable_plugin_emqx_bridge_mqtt}}}. {emqx_bridge_mqtt, {{enable_plugin_emqx_bridge_mqtt}}}.

View File

@ -87,7 +87,8 @@ listener_name(Proto) ->
http_handlers() -> http_handlers() ->
Plugins = lists:map(fun(Plugin) -> Plugin#plugin.name end, emqx_plugins:list()), Plugins = lists:map(fun(Plugin) -> Plugin#plugin.name end, emqx_plugins:list()),
[{"/api/v4/", [{"/api/v4/",
minirest:handler(#{apps => Plugins, filter => fun ?MODULE:filter/1}), minirest:handler(#{apps => Plugins ++ [emqx_modules],
filter => fun ?MODULE:filter/1}),
[{authorization, fun ?MODULE:is_authorized/1}]}]. [{authorization, fun ?MODULE:is_authorized/1}]}].
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
@ -113,6 +114,7 @@ is_authorized(_Path, Req) ->
_ -> false _ -> false
end. end.
filter(#{app := emqx_modules}) -> true;
filter(#{app := App}) -> filter(#{app := App}) ->
case emqx_plugins:find_plugin(App) of case emqx_plugins:find_plugin(App) of
false -> false; false -> false;

View File

@ -164,8 +164,9 @@ relx_apps(ReleaseType) ->
, {mnesia, load} , {mnesia, load}
, {ekka, load} , {ekka, load}
, {emqx_plugin_libs, load} , {emqx_plugin_libs, load}
, emqx_modules
] ]
++ [emqx_modules || not is_enterprise()]
++ [emqx_license || is_enterprise()]
++ [bcrypt || provide_bcrypt_release(ReleaseType)] ++ [bcrypt || provide_bcrypt_release(ReleaseType)]
++ relx_apps_per_rel(ReleaseType) ++ relx_apps_per_rel(ReleaseType)
++ [{N, load} || N <- relx_plugin_apps(ReleaseType)]. ++ [{N, load} || N <- relx_plugin_apps(ReleaseType)].
@ -194,7 +195,6 @@ relx_plugin_apps(ReleaseType) ->
, emqx_recon , emqx_recon
, emqx_rule_engine , emqx_rule_engine
, emqx_sasl , emqx_sasl
, emqx_modules
] ]
++ [emqx_telemetry || not is_enterprise()] ++ [emqx_telemetry || not is_enterprise()]
++ relx_plugin_apps_per_rel(ReleaseType) ++ relx_plugin_apps_per_rel(ReleaseType)
@ -225,28 +225,28 @@ relx_plugin_apps_extra() ->
[Plugin || {Plugin, _} <- extra_deps()]. [Plugin || {Plugin, _} <- extra_deps()].
relx_overlay(ReleaseType) -> relx_overlay(ReleaseType) ->
[ {mkdir,"log/"} [ {mkdir, "log/"}
, {mkdir,"data/"} , {mkdir, "data/"}
, {mkdir,"data/mnesia"} , {mkdir, "data/mnesia"}
, {mkdir,"data/configs"} , {mkdir, "data/configs"}
, {mkdir,"data/scripts"} , {mkdir, "data/scripts"}
, {template, "data/loaded_plugins.tmpl", "data/loaded_plugins"} , {template, "data/loaded_plugins.tmpl", "data/loaded_plugins"}
, {template, "data/loaded_modules.tmpl", "data/loaded_modules"} , {template, "data/loaded_modules.tmpl", "data/loaded_modules"}
, {template,"data/emqx_vars","releases/emqx_vars"} , {template, "data/emqx_vars", "releases/emqx_vars"}
, {copy,"bin/emqx","bin/emqx"} , {copy, "bin/emqx", "bin/emqx"}
, {copy,"bin/emqx_ctl","bin/emqx_ctl"} , {copy, "bin/emqx_ctl", "bin/emqx_ctl"}
, {copy,"bin/install_upgrade.escript", "bin/install_upgrade.escript"} , {copy, "bin/install_upgrade.escript", "bin/install_upgrade.escript"}
, {copy,"bin/emqx","bin/emqx-{{release_version}}"} %% for relup , {copy, "bin/emqx", "bin/emqx-{{release_version}}"} %% for relup
, {copy,"bin/emqx_ctl","bin/emqx_ctl-{{release_version}}"} %% for relup , {copy, "bin/emqx_ctl", "bin/emqx_ctl-{{release_version}}"} %% for relup
, {copy,"bin/install_upgrade.escript", "bin/install_upgrade.escript-{{release_version}}"} %% for relup , {copy, "bin/install_upgrade.escript", "bin/install_upgrade.escript-{{release_version}}"} %% for relup
, {template,"bin/emqx.cmd","bin/emqx.cmd"} , {template, "bin/emqx.cmd", "bin/emqx.cmd"}
, {template,"bin/emqx_ctl.cmd","bin/emqx_ctl.cmd"} , {template, "bin/emqx_ctl.cmd", "bin/emqx_ctl.cmd"}
, {copy,"bin/nodetool","bin/nodetool"} , {copy, "bin/nodetool", "bin/nodetool"}
, {copy,"bin/nodetool","bin/nodetool-{{release_version}}"} , {copy, "bin/nodetool", "bin/nodetool-{{release_version}}"}
, {copy,"_build/default/lib/cuttlefish/cuttlefish","bin/cuttlefish"} , {copy, "_build/default/lib/cuttlefish/cuttlefish", "bin/cuttlefish"}
, {copy,"_build/default/lib/cuttlefish/cuttlefish","bin/cuttlefish-{{release_version}}"} , {copy, "_build/default/lib/cuttlefish/cuttlefish", "bin/cuttlefish-{{release_version}}"}
, {copy,"priv/emqx.schema","releases/{{release_version}}/"} , {copy, "priv/emqx.schema", "releases/{{release_version}}/"}
] ++ etc_overlay(ReleaseType). ] ++ ee_etc_overlay() ++ etc_overlay(ReleaseType).
etc_overlay(ReleaseType) -> etc_overlay(ReleaseType) ->
PluginApps = relx_plugin_apps(ReleaseType), PluginApps = relx_plugin_apps(ReleaseType),
@ -394,3 +394,4 @@ list_dir(Dir) ->
%% ==== Enterprise supports below ================================================================== %% ==== Enterprise supports below ==================================================================
ee_profiles(_Vsn) -> []. ee_profiles(_Vsn) -> [].
ee_etc_overlay() -> [].

View File

@ -1,4 +1,8 @@
{enable_plugin_emqx_rule_engine, true}. {enable_plugin_emqx_rule_engine, true}.
{enable_plugin_emqx_bridge_mqtt, false}. {enable_plugin_emqx_bridge_mqtt, false}.
{enable_plugin_emqx_modules, false}.
{enable_plugin_emqx_recon, true}.
{enable_plugin_emqx_retainer, true}.
{enable_plugin_emqx_telemetry, true}.
{vm_args_file, "vm.args"}. {vm_args_file, "vm.args"}.
{emqx_description, "EMQ X Broker"}. {emqx_description, "EMQ X Broker"}.

View File

@ -1,4 +1,8 @@
{enable_plugin_emqx_rule_engine, false}. {enable_plugin_emqx_rule_engine, false}.
{enable_plugin_emqx_bridge_mqtt, true}. {enable_plugin_emqx_bridge_mqtt, true}.
{enable_plugin_emqx_modules, false}.
{enable_plugin_emqx_recon, true}.
{enable_plugin_emqx_retainer, true}.
{enable_plugin_emqx_telemetry, true}.
{vm_args_file, "vm.args.edge"}. {vm_args_file, "vm.args.edge"}.
{emqx_description, "EMQ X Edge"}. {emqx_description, "EMQ X Edge"}.