Merge pull request #6574 from zmstone/add-scripts-buildx

fix(bin/emqx): add boot wait time to 150 seconds
This commit is contained in:
tigercl 2021-12-30 09:32:39 +08:00 committed by GitHub
commit b85ed8cc64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 97 additions and 10 deletions

View File

@ -4,27 +4,39 @@
### Important changes ### Important changes
- **For Debian/Ubuntu users**, Debian/Ubuntu package (deb) installed EMQ X now now run on systemd. This is to use systemd's supervision functionality to ensure that EMQ X service restarts after a crash. The package installation service upgrade from init.d to systemd has been verified, but it is still recommended that you verify and confirm again before deploying to the production environment, at least to ensure that systemd is available in your system - **For Debian/Ubuntu users**, Debian/Ubuntu package (deb) installed EMQ X is now started from systemd.
This is to use systemd's supervision functionality to ensure that EMQ X service restarts after a crash.
The package installation service upgrade from init.d to systemd has been verified,
it is still recommended that you verify and confirm again before deploying to the production environment,
at least to ensure that systemd is available in your system
- MongoDB authentication supports DNS SRV and TXT Records resolution, which can seamlessly connect with MongoDB Altas - MongoDB authentication supports DNS SRV and TXT Records resolution, which can seamlessly connect with MongoDB Altas
- Support dynamic modification of MQTT Keep Alive to adapt to different energy consumption strategies - Support dynamic modification of MQTT Keep Alive to adapt to different energy consumption strategies.
### Minor changes ### Minor changes
- Bumpped default boot wait time from 15 seconds to 150 seconds
because in some simulated environments it may take up to 70 seconds to boot in build CI
- Dashboard supports relative paths and custom access paths - Dashboard supports relative paths and custom access paths
- Supports configuring whether to forward retained messages with empty payload to suit users who are still using MQTT v3.1. The relevant configurable item is `retainer.stop_publish_clear_msg` - Supports configuring whether to forward retained messages with empty payload to suit users
who are still using MQTT v3.1. The relevant configurable item is `retainer.stop_publish_clear_msg`
- Multi-language hook extension (ExHook) supports dynamic cancellation of subsequent forwarding of client messages - Multi-language hook extension (ExHook) supports dynamic cancellation of subsequent forwarding of client messages
- Rule engine SQL supports the use of single quotes in FROM clause, for example: `SELECT * FROM't/#'` - Rule engine SQL supports the use of single quotes in `FROM` clauses, for example: `SELECT * FROM 't/#'`
- Change the default value of the `max_topic_levels` configurable item to 128. Previously, it had no limit (configured to 0), which may be a potential DoS threat - Change the default value of the `max_topic_levels` configurable item to 128.
Previously, it had no limit (configured to 0), which may be a potential DoS threat
- Improve the error log content when the Proxy Protocol message is received but the `proxy_protocol` configuration is not turned on - Improve the error log content when the Proxy Protocol message is received without `proxy_protocol` configured.
- Add additional message attributes to the message reported by the gateway. Messages from gateways such as CoAP, LwM2M, Stomp, ExProto, etc., when converted to EMQ X messages, add fields such as protocol name, protocol version, user name, client IP, etc., which can be used for multi-language hook extension (ExHook) - Add additional message attributes to the message reported by the gateway.
Messages from gateways such as CoAP, LwM2M, Stomp, ExProto, etc., when converted to EMQ X messages,
add fields such as protocol name, protocol version, user name, client IP, etc.,
which can be used for multi-language hook extension (ExHook)
- HTTP client performance improvement - HTTP client performance improvement

View File

@ -504,7 +504,7 @@ case "$1" in
"$BINDIR/run_erl" -daemon "$PIPE_DIR" "$RUNNER_LOG_DIR" \ "$BINDIR/run_erl" -daemon "$PIPE_DIR" "$RUNNER_LOG_DIR" \
"$(relx_start_command)" "$(relx_start_command)"
WAIT_TIME=${WAIT_FOR_ERLANG:-15} WAIT_TIME=${WAIT_FOR_ERLANG:-150}
while [ "$WAIT_TIME" -gt 0 ]; do while [ "$WAIT_TIME" -gt 0 ]; do
if ! relx_nodetool "ping" >/dev/null 2>&1; then if ! relx_nodetool "ping" >/dev/null 2>&1; then
WAIT_TIME=$((WAIT_TIME - 1)) WAIT_TIME=$((WAIT_TIME - 1))
@ -516,7 +516,7 @@ case "$1" in
echo "$EMQX_DESCRIPTION $REL_VSN is started successfully!" echo "$EMQX_DESCRIPTION $REL_VSN is started successfully!"
exit 0 exit 0
fi fi
done && echo "$EMQX_DESCRIPTION $REL_VSN failed to start within ${WAIT_FOR_ERLANG:-15} seconds," done && echo "$EMQX_DESCRIPTION $REL_VSN failed to start within ${WAIT_FOR_ERLANG:-150} seconds,"
echo "see the output of '$0 console' for more information." echo "see the output of '$0 console' for more information."
echo "If you want to wait longer, set the environment variable" echo "If you want to wait longer, set the environment variable"
echo "WAIT_FOR_ERLANG to the number of seconds to wait." echo "WAIT_FOR_ERLANG to the number of seconds to wait."
@ -530,7 +530,7 @@ case "$1" in
echoerr "Graceful shutdown failed PID=[$PID]" echoerr "Graceful shutdown failed PID=[$PID]"
exit 1 exit 1
fi fi
WAIT_TIME="${WAIT_FOR_ERLANG_STOP:-60}" WAIT_TIME="${WAIT_FOR_ERLANG_STOP:-120}"
if ! wait_for "$WAIT_TIME" 'is_down' "$PID"; then if ! wait_for "$WAIT_TIME" 'is_down' "$PID"; then
msg="dangling after ${WAIT_TIME} seconds" msg="dangling after ${WAIT_TIME} seconds"
# also log to syslog # also log to syslog

75
scripts/buildx.sh Executable file
View File

@ -0,0 +1,75 @@
#!/usr/bin/env bash
## This script helps to run docker buildx to build cross-arch/platform packages (linux only)
## It mounts (not copy) host directory to a cross-arch/platform builder container
## Make sure the source dir (specified by --src_dir option) is clean before running this script
## NOTE: it requires $USER in docker group
## i.e. will not work if docker command has to be executed with sudo
## example:
## ./scripts/buildx.sh --profile emqx --pkgtype zip --builder ghcr.io/emqx/emqx-builder/4.4-4:24.1.5-3-debian10 --arch arm64
set -euo pipefail
help() {
echo
echo "-h|--help: To display this usage information"
echo "--pkgtype zip|pkg: Specify to build zip or deb|rpm package"
echo "--arch amd64|arm64: Target arch to build the EMQ X package for."
echo "--src_dir <SRC_DIR>: EMQ X source ode in this dir, default to PWD"
echo "--profile <PROFILE>: EMQ X profile to build, e.g. emqx, emqx-edge"
echo "--builder <BUILDER>: Builder image to pull."
echo " E.g. ghcr.io/emqx/emqx-builder/4.4-4:24.1.5-3-debian10"
}
while [ "$#" -gt 0 ]; do
case $1 in
-h|--help)
help
exit 0
;;
--src_dir)
SRC_DIR="$2"
shift 2
;;
--profile)
PROFILE="$2"
shift 2
;;
--pkgtype)
PKGTYPE="$2"
shift 2
;;
--builder)
BUILDER="$2"
shift 2
;;
--arch)
ARCH="$2"
shift 2
;;
*)
echo "WARN: Unknown arg (ignored): $1"
shift
continue
;;
esac
done
if [ -z "${PROFILE:-}" ] || [ -z "${PKGTYPE:-}" ] || [ -z "${BUILDER:-}" ] || [ -z "${ARCH:-}" ]; then
help
exit 1
fi
docker run --rm --privileged tonistiigi/binfmt:latest --install ${ARCH}
cd "${SRC_DIR:-.}"
docker run -i --rm \
-v "$(pwd)":/emqx \
--workdir /emqx \
--platform="linux/$ARCH" \
-e EMQX_NAME="$PROFILE" \
"$BUILDER" \
bash -euc "make ${PROFILE}-${PKGTYPE} && .ci/build_packages/tests.sh"