refactor: stop releasing edge edition

Prior to EMQX 5.0, the edge edition's main difference comaring
to standard edition are:
* Less number of plugins in the release (smaller package size)
* Smaller number is vm.args (for lower memory usage)

Starting from 5.0 most of the plugins are included as features,
the tuned vm.args arguments does not justify a special release edition.

Also as nanomq is getting mature,
EMQ's recommendtation for MQTT broker in edge is https://nanomq.io/
This commit is contained in:
Zaiming (Stone) Shi 2022-05-26 14:30:38 +02:00
parent 4a8f74f913
commit ebe4d7c3fb
15 changed files with 46 additions and 122 deletions

View File

@ -47,14 +47,14 @@ jobs:
tag=${{ github.ref }} tag=${{ github.ref }}
case $tag in case $tag in
refs/tags/v*) refs/tags/v*)
echo "::set-output name=BUILD_PROFILES::[\"emqx\",\"emqx-edge\"]" echo "::set-output name=BUILD_PROFILES::[\"emqx\"]"
;; ;;
refs/tags/e*) refs/tags/e*)
echo "::set-output name=BUILD_PROFILES::[\"emqx-enterprise\"]" echo "::set-output name=BUILD_PROFILES::[\"emqx-enterprise\"]"
;; ;;
*) *)
# this is for testing ? # this is for testing ?
echo "::set-output name=BUILD_PROFILES::[\"emqx-edge\",\"emqx\",\"emqx-enterprise\"]" echo "::set-output name=BUILD_PROFILES::[\"emqx\",\"emqx-enterprise\"]"
;; ;;
esac esac
- name: get_all_deps - name: get_all_deps
@ -126,8 +126,6 @@ jobs:
os: os:
- macos-11 - macos-11
- macos-10.15 - macos-10.15
exclude:
- profile: emqx-edge
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
@ -638,8 +636,6 @@ jobs:
s3dir='emqx-ce' s3dir='emqx-ce'
elif [ $PROFILE = 'emqx-enterprise' ]; then elif [ $PROFILE = 'emqx-enterprise' ]; then
s3dir='emqx-ee' s3dir='emqx-ee'
elif [ $PROFILE = 'emqx-edge' ]; then
s3dir='emqx-edge'
else else
echo "unknown profile $PROFILE" echo "unknown profile $PROFILE"
exit 1 exit 1

View File

@ -29,7 +29,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
profile: profile:
- emqx-edge
- emqx - emqx
- emqx-enterprise - emqx-enterprise
otp: otp:
@ -227,7 +226,6 @@ jobs:
strategy: strategy:
matrix: matrix:
profile: profile:
- emqx-edge
- emqx - emqx
- emqx-enterprise - emqx-enterprise
runs-on: aws-amd64 runs-on: aws-amd64

View File

@ -15,20 +15,12 @@ jobs:
matrix: matrix:
release_type: release_type:
- cloud - cloud
- edge
package_type: package_type:
- bin - bin
- pkg - pkg
edition_type: edition_type:
- community - community
- enterprise - enterprise
exclude:
- release_type: edge
package_type: bin
edition_type: enterprise
- release_type: edge
package_type: pkg
edition_type: enterprise
steps: steps:
- name: fix_git_permission - name: fix_git_permission

View File

@ -11,7 +11,6 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
profile: profile:
- emqx-edge
- emqx - emqx
- emqx-enterprise - emqx-enterprise
@ -28,8 +27,6 @@ jobs:
s3dir='emqx-ce' s3dir='emqx-ce'
elif [ $PROFILE = 'emqx-enterprise' ]; then elif [ $PROFILE = 'emqx-enterprise' ]; then
s3dir='emqx-ee' s3dir='emqx-ee'
elif [ $PROFILE = 'emqx-edge' ]; then
s3dir='emqx-edge'
else else
echo "unknown profile $PROFILE" echo "unknown profile $PROFILE"
exit 1 exit 1

View File

@ -41,7 +41,6 @@ jobs:
matrix: matrix:
profile: profile:
- emqx - emqx
- emqx-edge
- emqx-enterprise - emqx-enterprise
- emqx-elixir - emqx-elixir
cluster_db_backend: cluster_db_backend:
@ -55,9 +54,6 @@ jobs:
- 1.13.3 - 1.13.3
arch: arch:
- amd64 - amd64
exclude:
- profile: emqx-edge
cluster_db_backend: rlog
steps: steps:
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:

View File

@ -18,8 +18,8 @@ else
endif endif
PROFILE ?= emqx PROFILE ?= emqx
REL_PROFILES := emqx emqx-edge emqx-enterprise REL_PROFILES := emqx emqx-enterprise
PKG_PROFILES := emqx-pkg emqx-edge-pkg emqx-enterprise-pkg PKG_PROFILES := emqx-pkg emqx-enterprise-pkg
PROFILES := $(REL_PROFILES) $(PKG_PROFILES) default PROFILES := $(REL_PROFILES) $(PKG_PROFILES) default
CT_NODE_NAME ?= 'test@127.0.0.1' CT_NODE_NAME ?= 'test@127.0.0.1'

View File

@ -26,14 +26,12 @@
-define(EMQX_DESCS, #{ -define(EMQX_DESCS, #{
ee => "EMQX Enterprise", ee => "EMQX Enterprise",
ce => "EMQX", ce => "EMQX"
edge => "EMQX Edge"
}). }).
-define(EMQX_REL_VSNS, #{ -define(EMQX_REL_VSNS, #{
ee => ?EMQX_RELEASE_EE, ee => ?EMQX_RELEASE_EE,
ce => ?EMQX_RELEASE_CE, ce => ?EMQX_RELEASE_CE
edge => ?EMQX_RELEASE_CE
}). }).
%% @doc Return EMQX description. %% @doc Return EMQX description.
@ -43,7 +41,7 @@ description() ->
%% @doc Return EMQX edition info. %% @doc Return EMQX edition info.
%% Read info from persistent_term at runtime. %% Read info from persistent_term at runtime.
%% Or meck this function to run tests for another edition. %% Or meck this function to run tests for another edition.
-spec edition() -> ce | ee | edge. -spec edition() -> ce | ee.
-ifdef(EMQX_RELEASE_EDITION). -ifdef(EMQX_RELEASE_EDITION).
edition() -> ?EMQX_RELEASE_EDITION. edition() -> ?EMQX_RELEASE_EDITION.
-else. -else.

View File

@ -10,7 +10,6 @@
warn_unused_import, warn_unused_import,
warn_obsolete_guard, warn_obsolete_guard,
no_debug_info, no_debug_info,
%% for edge
compressed, compressed,
{parse_transform} {parse_transform}
]}. ]}.

9
build
View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script helps to build release artifacts. # This script helps to build release artifacts.
# arg1: profile, e.g. emqx | emqx-edge | emqx-pkg | emqx-edge-pkg # arg1: profile, e.g. emqx | emqx-pkg
# arg2: artifact, e.g. rel | relup | tgz | pkg # arg2: artifact, e.g. rel | relup | tgz | pkg
if [[ -n "$DEBUG" ]]; then if [[ -n "$DEBUG" ]]; then
@ -237,10 +237,10 @@ function join {
export_release_vars() { export_release_vars() {
local profile="$1" local profile="$1"
case "$profile" in case "$profile" in
emqx|emqx-edge|emqx-enterprise) emqx|emqx-enterprise)
export ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-no} export ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-no}
;; ;;
emqx-pkg|emqx-edge-pkg|emqx-enterprise-pkg) emqx-pkg|emqx-enterprise-pkg)
export ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-yes} export ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-yes}
;; ;;
*) *)
@ -255,9 +255,6 @@ export_release_vars() {
*enterprise*) *enterprise*)
erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ee}" ) erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ee}" )
;; ;;
*edge*)
erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', edge}" )
;;
*) *)
erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ce}" ) erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ce}" )
;; ;;

50
mix.exs
View File

@ -16,10 +16,8 @@ defmodule EMQXUmbrella.MixProject do
The following profiles are valid: The following profiles are valid:
* `emqx` * `emqx`
* `emqx-edge`
* `emqx-enterprise` * `emqx-enterprise`
* `emqx-pkg` * `emqx-pkg`
* `emqx-edge-pkg`
* `emqx-enterprise-pkg` * `emqx-enterprise-pkg`
* `dev` -> same as `emqx`, for convenience * `dev` -> same as `emqx`, for convenience
@ -132,7 +130,7 @@ defmodule EMQXUmbrella.MixProject do
end end
[ [
applications: applications(release_type, edition_type), applications: applications(edition_type),
skip_mode_validation_for: [ skip_mode_validation_for: [
:emqx_gateway, :emqx_gateway,
:emqx_dashboard, :emqx_dashboard,
@ -156,7 +154,7 @@ defmodule EMQXUmbrella.MixProject do
] ]
end end
def applications(release_type, edition_type) do def applications(edition_type) do
[ [
crypto: :permanent, crypto: :permanent,
public_key: :permanent, public_key: :permanent,
@ -168,6 +166,7 @@ defmodule EMQXUmbrella.MixProject do
compiler: :permanent, compiler: :permanent,
runtime_tools: :permanent, runtime_tools: :permanent,
redbug: :permanent, redbug: :permanent,
xmerl: :permanent,
hocon: :load, hocon: :load,
emqx: :load, emqx: :load,
emqx_conf: :load, emqx_conf: :load,
@ -203,15 +202,15 @@ defmodule EMQXUmbrella.MixProject do
if(enable_quicer?(), do: [quicer: :permanent], else: []) ++ if(enable_quicer?(), do: [quicer: :permanent], else: []) ++
if(enable_bcrypt?(), do: [bcrypt: :permanent], else: []) ++ if(enable_bcrypt?(), do: [bcrypt: :permanent], else: []) ++
if(enable_jq?(), do: [jq: :permanent], else: []) ++ if(enable_jq?(), do: [jq: :permanent], else: []) ++
if(edition_type == :enterprise, if(is_app(:observer),
do: [ do: [observer: :load],
emqx_enterprise_conf: :load,
emqx_license: :permanent
],
else: [] else: []
) ++ ) ++
if(release_type == :cloud, if(edition_type == :enterprise,
do: [xmerl: :permanent, observer: :load], do: [
emqx_license: :permanent,
emqx_enterprise_conf: :load
],
else: [] else: []
) )
end end
@ -244,6 +243,19 @@ defmodule EMQXUmbrella.MixProject do
[] []
end end
defp is_app(name) do
case Application.load(name) do
:ok ->
true
{:error, {:already_loaded, _}} ->
true
_ ->
false
end
end
defp emqx_machine_boot_app_list(edition_type) do defp emqx_machine_boot_app_list(edition_type) do
edition_type edition_type
|> emqx_machine_boot_apps() |> emqx_machine_boot_apps()
@ -257,9 +269,7 @@ defmodule EMQXUmbrella.MixProject do
:emqx, :emqx,
:"emqx-pkg", :"emqx-pkg",
:"emqx-enterprise", :"emqx-enterprise",
:"emqx-enterprise-pkg", :"emqx-enterprise-pkg"
:"emqx-edge",
:"emqx-edge-pkg"
] ]
if Mix.env() not in valid_envs do if Mix.env() not in valid_envs do
@ -286,18 +296,12 @@ defmodule EMQXUmbrella.MixProject do
:emqx -> :emqx ->
{:cloud, :bin, :community} {:cloud, :bin, :community}
:"emqx-edge" ->
{:edge, :bin, :community}
:"emqx-enterprise" -> :"emqx-enterprise" ->
{:cloud, :bin, :enterprise} {:cloud, :bin, :enterprise}
:"emqx-pkg" -> :"emqx-pkg" ->
{:cloud, :pkg, :community} {:cloud, :pkg, :community}
:"emqx-edge-pkg" ->
{:edge, :pkg, :community}
:"emqx-enterprise-pkg" -> :"emqx-enterprise-pkg" ->
{:cloud, :pkg, :enterprise} {:cloud, :pkg, :enterprise}
end end
@ -390,9 +394,6 @@ defmodule EMQXUmbrella.MixProject do
case release_type do case release_type do
:cloud -> :cloud ->
"apps/emqx/etc/emqx_cloud/vm.args" "apps/emqx/etc/emqx_cloud/vm.args"
:edge ->
"apps/emqx/etc/emqx_edge/vm.args"
end end
render_template( render_template(
@ -594,9 +595,6 @@ defmodule EMQXUmbrella.MixProject do
{:cloud, :community} -> {:cloud, :community} ->
"EMQX" "EMQX"
{:edge, :community} ->
"EMQX Edge"
end end
end end

View File

@ -165,20 +165,6 @@ profiles_ce() ->
{overrides, prod_overrides()}, {overrides, prod_overrides()},
{project_app_dirs, project_app_dirs(ce)}, {project_app_dirs, project_app_dirs(ce)},
{post_hooks, [{compile, "bash build emqx-pkg doc"}]} {post_hooks, [{compile, "bash build emqx-pkg doc"}]}
]},
{'emqx-edge', [
{erl_opts, prod_compile_opts(edge, Vsn)},
{relx, relx(Vsn, edge, bin, ce)},
{overrides, prod_overrides()},
{project_app_dirs, project_app_dirs(ce)},
{post_hooks, [{compile, "bash build emqx-edge doc"}]}
]},
{'emqx-edge-pkg', [
{erl_opts, prod_compile_opts(edge, Vsn)},
{relx, relx(Vsn, edge, pkg, ce)},
{overrides, prod_overrides()},
{project_app_dirs, project_app_dirs(ce)},
{post_hooks, [{compile, "bash build emqx-edge-pkg doc"}]}
]} ]}
]. ].
@ -217,7 +203,7 @@ profiles_dev() ->
]} ]}
]. ].
%% RelType: cloud (full size) | edge (slim size) %% RelType: cloud (full size)
%% PkgType: bin | pkg %% PkgType: bin | pkg
%% Edition: ce (community) | ee (enterprise) %% Edition: ce (community) | ee (enterprise)
relx(Vsn, RelType, PkgType, Edition) -> relx(Vsn, RelType, PkgType, Edition) ->
@ -257,23 +243,15 @@ relform() ->
end. end.
emqx_description(cloud, ee) -> "EMQX Enterprise"; emqx_description(cloud, ee) -> "EMQX Enterprise";
emqx_description(cloud, ce) -> "EMQX"; emqx_description(cloud, ce) -> "EMQX".
emqx_description(edge, ce) -> "EMQX Edge".
overlay_vars(RelType, PkgType, Edition) -> overlay_vars(RelType, PkgType, Edition) ->
overlay_vars_rel(RelType) ++ overlay_vars_rel(RelType) ++
overlay_vars_pkg(PkgType) ++ overlay_vars_pkg(PkgType) ++
overlay_vars_edition(Edition). overlay_vars_edition(Edition).
%% vars per release type, cloud or edge overlay_vars_rel(cloud) ->
overlay_vars_rel(RelType) -> [{vm_args_file, "vm.args"}].
VmArgs =
case RelType of
cloud -> "vm.args";
edge -> "vm.args.edge"
end,
[{vm_args_file, VmArgs}].
overlay_vars_edition(ce) -> overlay_vars_edition(ce) ->
[ [
@ -330,6 +308,7 @@ relx_apps(ReleaseType, Edition) ->
compiler, compiler,
runtime_tools, runtime_tools,
redbug, redbug,
xmerl,
{hocon, load}, {hocon, load},
% started by emqx_machine % started by emqx_machine
{emqx, load}, {emqx, load},
@ -365,16 +344,8 @@ relx_apps(ReleaseType, Edition) ->
[quicer || is_quicer_supported()] ++ [quicer || is_quicer_supported()] ++
[bcrypt || provide_bcrypt_release(ReleaseType)] ++ [bcrypt || provide_bcrypt_release(ReleaseType)] ++
[jq || provide_jq()] ++ [jq || provide_jq()] ++
relx_apps_per_rel(ReleaseType) ++ [{observer, load} || is_app(observer)] ++
relx_additional_apps(ReleaseType, Edition). relx_apps_per_edition(Edition).
relx_apps_per_rel(cloud) ->
[
xmerl
| [{observer, load} || is_app(observer)]
];
relx_apps_per_rel(edge) ->
[].
is_app(Name) -> is_app(Name) ->
case application:load(Name) of case application:load(Name) of
@ -383,15 +354,6 @@ is_app(Name) ->
_ -> false _ -> false
end. end.
relx_additional_apps(ReleaseType, Edition) ->
relx_plugin_apps_per_rel(ReleaseType) ++
relx_apps_per_edition(Edition).
relx_plugin_apps_per_rel(cloud) ->
[];
relx_plugin_apps_per_rel(edge) ->
[].
relx_apps_per_edition(ee) -> relx_apps_per_edition(ee) ->
[ [
emqx_license, emqx_license,
@ -480,9 +442,7 @@ emqx_etc_overlay(ReleaseType, Edition) ->
emqx_etc_overlay_common(). emqx_etc_overlay_common().
emqx_etc_overlay_per_rel(cloud) -> emqx_etc_overlay_per_rel(cloud) ->
[{"{{base_dir}}/lib/emqx/etc/emqx_cloud/vm.args", "etc/vm.args"}]; [{"{{base_dir}}/lib/emqx/etc/emqx_cloud/vm.args", "etc/vm.args"}].
emqx_etc_overlay_per_rel(edge) ->
[{"{{base_dir}}/lib/emqx/etc/emqx_edge/vm.args", "etc/vm.args"}].
emqx_etc_overlay_common() -> emqx_etc_overlay_common() ->
[{"{{base_dir}}/lib/emqx/etc/ssl_dist.conf", "etc/ssl_dist.conf"}]. [{"{{base_dir}}/lib/emqx/etc/ssl_dist.conf", "etc/ssl_dist.conf"}].

View File

@ -16,7 +16,7 @@ set -euo pipefail
help() { help() {
echo echo
echo "-h|--help: To display this usage information" echo "-h|--help: To display this usage information"
echo "--profile <PROFILE>: EMQX profile to build (emqx|emqx-edge|emqx-enterprise)" echo "--profile <PROFILE>: EMQX profile to build (emqx|emqx-enterprise)"
echo "--pkgtype tgz|pkg: Specify which package to build, tgz for .tar.gz," echo "--pkgtype tgz|pkg: Specify which package to build, tgz for .tar.gz,"
echo " pkg for .rpm or .deb" echo " pkg for .rpm or .deb"
echo "--elixir: Specify if the release should be built with Elixir, " echo "--elixir: Specify if the release should be built with Elixir, "

View File

@ -22,7 +22,7 @@ defmodule CheckElixirApplications do
env: [{"DEBUG", "1"}] env: [{"DEBUG", "1"}]
) )
mix_apps = mix_applications(inputs.release_type, inputs.edition_type) mix_apps = mix_applications(inputs.edition_type)
rebar_apps = rebar_applications(profile) rebar_apps = rebar_applications(profile)
results = diff_apps(mix_apps, rebar_apps) results = diff_apps(mix_apps, rebar_apps)
@ -70,8 +70,8 @@ defmodule CheckElixirApplications do
end end
end end
defp mix_applications(release_type, edition_type) do defp mix_applications(edition_type) do
EMQXUmbrella.MixProject.applications(release_type, edition_type) EMQXUmbrella.MixProject.applications(edition_type)
end end
defp rebar_applications(profile) do defp rebar_applications(profile) do

View File

@ -9,9 +9,6 @@ case "${MAKE_TARGET}" in
emqx-enterprise-*) emqx-enterprise-*)
EMQX_NAME='emqx-enterprise' EMQX_NAME='emqx-enterprise'
;; ;;
emqx-edge-*)
EMQX_NAME='emqx-edge'
;;
emqx-*) emqx-*)
EMQX_NAME='emqx' EMQX_NAME='emqx'
;; ;;

View File

@ -21,10 +21,6 @@ case $PROFILE in
DIR='enterprise' DIR='enterprise'
EDITION='enterprise' EDITION='enterprise'
;; ;;
"emqx-edge")
DIR='edge'
EDITION='edge'
;;
*) *)
echo "Unknown profile $PROFILE" echo "Unknown profile $PROFILE"
exit 1 exit 1