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.
CONFIG_ARGS=" -config $RUNNER_ETC_DIR/app.config -args_file $RUNNER_ETC_DIR/vm.args -vm_args $RUNNER_ETC_DIR/vm.args "
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
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 }}"
LIB_EKKA_DIR="${RUNNER_LIB_DIR}/ekka-$(grep ekka "${RUNNER_ROOT_DIR}/releases/RELEASES" | awk -F '\"' '{print $2}')"
EMQX_LICENSE_CONF=''
## computed vars
REL_NAME="emqx"
ERTS_PATH="$RUNNER_ROOT_DIR/erts-$ERTS_VSN/bin"

View File

@ -1,7 +1,8 @@
{emqx_management, true}.
{emqx_recon, true}.
{emqx_retainer, 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_bridge_mqtt, {{enable_plugin_emqx_bridge_mqtt}}}.

View File

@ -87,7 +87,8 @@ listener_name(Proto) ->
http_handlers() ->
Plugins = lists:map(fun(Plugin) -> Plugin#plugin.name end, emqx_plugins:list()),
[{"/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}]}].
%%--------------------------------------------------------------------
@ -113,6 +114,7 @@ is_authorized(_Path, Req) ->
_ -> false
end.
filter(#{app := emqx_modules}) -> true;
filter(#{app := App}) ->
case emqx_plugins:find_plugin(App) of
false -> false;

View File

@ -164,8 +164,9 @@ relx_apps(ReleaseType) ->
, {mnesia, load}
, {ekka, load}
, {emqx_plugin_libs, load}
, emqx_modules
]
++ [emqx_modules || not is_enterprise()]
++ [emqx_license || is_enterprise()]
++ [bcrypt || provide_bcrypt_release(ReleaseType)]
++ relx_apps_per_rel(ReleaseType)
++ [{N, load} || N <- relx_plugin_apps(ReleaseType)].
@ -194,7 +195,6 @@ relx_plugin_apps(ReleaseType) ->
, emqx_recon
, emqx_rule_engine
, emqx_sasl
, emqx_modules
]
++ [emqx_telemetry || not is_enterprise()]
++ relx_plugin_apps_per_rel(ReleaseType)
@ -246,7 +246,7 @@ relx_overlay(ReleaseType) ->
, {copy, "_build/default/lib/cuttlefish/cuttlefish", "bin/cuttlefish"}
, {copy, "_build/default/lib/cuttlefish/cuttlefish", "bin/cuttlefish-{{release_version}}"}
, {copy, "priv/emqx.schema", "releases/{{release_version}}/"}
] ++ etc_overlay(ReleaseType).
] ++ ee_etc_overlay() ++ etc_overlay(ReleaseType).
etc_overlay(ReleaseType) ->
PluginApps = relx_plugin_apps(ReleaseType),
@ -394,3 +394,4 @@ list_dir(Dir) ->
%% ==== Enterprise supports below ==================================================================
ee_profiles(_Vsn) -> [].
ee_etc_overlay() -> [].

View File

@ -1,4 +1,8 @@
{enable_plugin_emqx_rule_engine, true}.
{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"}.
{emqx_description, "EMQ X Broker"}.

View File

@ -1,4 +1,8 @@
{enable_plugin_emqx_rule_engine, false}.
{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"}.
{emqx_description, "EMQ X Edge"}.