From 20fe426de3897c8981952513cf65702d6bab0a46 Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Sun, 8 Oct 2017 15:12:31 +0800 Subject: [PATCH] Merge with EMQ X --- .ci/build.sh | 4 +- .ci/centos6.8/Dockerfile | 5 +- .ci/centos7/Dockerfile | 7 ++- .ci/debian7/Dockerfile | 4 +- .ci/debian8/Dockerfile | 5 +- .ci/docker_ci.sh | 8 +-- .ci/files/emq_ci.sh | 18 ------ .ci/files/emqx_ci.sh | 18 ++++++ .ci/mac_ci.sh | 8 +-- .ci/ubuntu12.04/Dockerfile | 5 +- .ci/ubuntu14.04/Dockerfile | 4 +- .ci/ubuntu16.04/Dockerfile | 4 +- .gitignore | 3 + Makefile | 85 +++++++++++++++------------- README.md | 24 ++++---- bin/emqenv | 11 ---- bin/{emqttd => emqx} | 28 ++++----- bin/{emqttd.cmd => emqx.cmd} | 12 ++-- bin/{emqttd_ctl => emqx_ctl} | 8 +-- bin/{emqttd_ctl.cmd => emqx_ctl.cmd} | 14 ++--- bin/emqx_env | 11 ++++ bin/nodetool | 8 +-- ct/emqtt.spec | 31 ---------- ct/emqx.spec | 31 ++++++++++ ct/run_emqtt.sh | 3 - ct/run_emqx.sh | 3 + data/loaded_plugins | 9 +-- relx.config | 70 ++++++++++++----------- vars.config | 2 +- 29 files changed, 231 insertions(+), 212 deletions(-) delete mode 100755 .ci/files/emq_ci.sh create mode 100755 .ci/files/emqx_ci.sh delete mode 100755 bin/emqenv rename bin/{emqttd => emqx} (90%) rename bin/{emqttd.cmd => emqx.cmd} (96%) rename bin/{emqttd_ctl => emqx_ctl} (93%) rename bin/{emqttd_ctl.cmd => emqx_ctl.cmd} (90%) create mode 100755 bin/emqx_env delete mode 100644 ct/emqtt.spec create mode 100644 ct/emqx.spec delete mode 100755 ct/run_emqtt.sh create mode 100755 ct/run_emqx.sh diff --git a/.ci/build.sh b/.ci/build.sh index 600437a7..d7595961 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -12,7 +12,7 @@ mkdir -p /home/ubuntu/package oslist=(debian7 debian8 debian9 centos6.8 centos7 ubuntu12.04 ubuntu14.04 ubuntu16.04) for var in ${oslist[@]};do - sudo docker build -t ci-${var} -f ${var}/Dockerfile . + sudo docker build -t emqx_ci-${var} -f ${var}/Dockerfile . sudo docker rm -f emq-${var} - sudo docker run -itd --net='host' --name emq-${var} -e "ostype=${var}" -e "host=emqtt.io" -e "tag=release" -e "versionid=$1" -e "type=$2" ci-${var} + sudo docker run -itd --net='host' --name emq-${var} -e "ostype=${var}" -e "host=emqtt.io" -e "tag=release" -e "versionid=$1" -e "type=$2" emqx_ci-${var} done diff --git a/.ci/centos6.8/Dockerfile b/.ci/centos6.8/Dockerfile index 3f9069e3..72aaae40 100644 --- a/.ci/centos6.8/Dockerfile +++ b/.ci/centos6.8/Dockerfile @@ -7,6 +7,7 @@ RUN wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm RUN rpm -Uvh /tmp/erlang-solutions-1.0-1.noarch.rpm RUN yum install -y epel-release RUN yum install -y esl-erlang-20.0 +RUN mkdir -p /rebar && git clone https://github.com/rebar/rebar && cd /rebar && ./bootstrap && cp /rebar/rebar /usr/local/bin/ && rm -rf /rebar RUN mkdir -p /root/.ssh/ # cleanup @@ -16,6 +17,6 @@ RUN yum clean packages \ ADD ./files/id_rsa /root/.ssh/ ADD ./files/id_rsa.pub /root/.ssh/ ADD ./files/config /root/.ssh/ -ADD ./files/emq_ci.sh / +ADD ./files/emqx_ci.sh / -CMD ["/emq_ci.sh"] +CMD ["/emqx_ci.sh"] diff --git a/.ci/centos7/Dockerfile b/.ci/centos7/Dockerfile index 69fefcf6..14623ce4 100644 --- a/.ci/centos7/Dockerfile +++ b/.ci/centos7/Dockerfile @@ -1,12 +1,13 @@ FROM centos:7 RUN yum update -y -RUN yum install -y wget git zip +RUN yum install -y wget git zip which RUN yum groupinstall -y "Development Tools" RUN wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm -P /tmp RUN rpm -Uvh /tmp/erlang-solutions-1.0-1.noarch.rpm RUN yum install -y epel-release RUN yum install -y esl-erlang-20.0 +RUN mkdir -p /rebar && git clone https://github.com/rebar/rebar && cd /rebar && ./bootstrap && cp /rebar/rebar /usr/local/bin/ && rm -rf /rebar RUN mkdir -p /root/.ssh/ # cleanup @@ -16,6 +17,6 @@ RUN yum clean packages \ ADD ./files/id_rsa /root/.ssh/ ADD ./files/id_rsa.pub /root/.ssh/ ADD ./files/config /root/.ssh/ -ADD ./files/emq_ci.sh / +ADD ./files/emqx_ci.sh / -CMD ["/emq_ci.sh"] +CMD ["/emqx_ci.sh"] diff --git a/.ci/debian7/Dockerfile b/.ci/debian7/Dockerfile index f2e3dc90..cafc9752 100644 --- a/.ci/debian7/Dockerfile +++ b/.ci/debian7/Dockerfile @@ -11,6 +11,6 @@ RUN apt-get clean\ ADD ./files/id_rsa /root/.ssh/ ADD ./files/id_rsa.pub /root/.ssh/ ADD ./files/config /root/.ssh/ -ADD ./files/emq_ci.sh / +ADD ./files/emqx_ci.sh / -CMD ["/emq_ci.sh"] +CMD ["/emqx_ci.sh"] diff --git a/.ci/debian8/Dockerfile b/.ci/debian8/Dockerfile index 08f347f7..5b4f337b 100644 --- a/.ci/debian8/Dockerfile +++ b/.ci/debian8/Dockerfile @@ -5,6 +5,7 @@ RUN apt-get install -y wget git zip build-essential debhelper RUN wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_20.0-1~debian~jessie_amd64.deb -O /tmp/erlang.deb RUN dpkg -i /tmp/erlang.deb || true RUN apt-get -f install -y +RUN mkdir -p /rebar && git clone https://github.com/rebar/rebar && cd /rebar && ./bootstrap && cp /rebar/rebar /usr/local/bin/ && rm -rf /rebar RUN mkdir -p /root/.ssh/ # cleanup RUN apt-get clean\ @@ -13,6 +14,6 @@ RUN apt-get clean\ ADD ./files/id_rsa /root/.ssh/ ADD ./files/id_rsa.pub /root/.ssh/ ADD ./files/config /root/.ssh/ -ADD ./files/emq_ci.sh / +ADD ./files/emqx_ci.sh / -CMD ["/emq_ci.sh"] +CMD ["/emqx_ci.sh"] diff --git a/.ci/docker_ci.sh b/.ci/docker_ci.sh index d14dbfff..7f81d17c 100755 --- a/.ci/docker_ci.sh +++ b/.ci/docker_ci.sh @@ -5,15 +5,15 @@ # Example: # ./docker_ci.sh 2.2-beta.1 -package=emqttd-docker-v$1 +package=emqx-docker-v$1 -git clone https://github.com/emqtt/emq-docker +git clone -b X https://github.com/emqtt/emq-docker emqx-docker -cd emq-docker +cd emqx-docker sudo docker build -t ${package} . -sudo docker save ${package} > ${package} +sudo docker save ${package} > ${package} zip -r ${package}.zip ${package} diff --git a/.ci/files/emq_ci.sh b/.ci/files/emq_ci.sh deleted file mode 100755 index f06df2b2..00000000 --- a/.ci/files/emq_ci.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -chmod 600 /root/.ssh/config -rm -rf /emq_temp && mkdir /emq_temp && cd /emq_temp -git clone -b ${tag} https://github.com/emqtt/emq-relx.git -version=`cd emq-relx && git describe --abbrev=0 --tags` -pkg=emqttd-${ostype}-${version}.zip -echo "building $pkg..." -cd emq-relx && make && cd _rel && zip -rq $pkg emqttd && scp $pkg root@${host}:/root/releases/${versionid}-${type} && cd /emq_temp - -git clone https://github.com/emqtt/emq-package.git -cd emq-package -make -name=`basename package/*` -name2=${name/emqttd-${versionid}/emqttd-${ostype}-${version}} -name3=${name2/emqttd_${versionid}/emqttd-${ostype}-${version}} -mv package/${name} package/${name3} -scp package/* root@${host}:/root/releases/${versionid}-${type} diff --git a/.ci/files/emqx_ci.sh b/.ci/files/emqx_ci.sh new file mode 100755 index 00000000..97d40f0a --- /dev/null +++ b/.ci/files/emqx_ci.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +chmod 600 /root/.ssh/config +rm -rf /emqx_temp && mkdir /emqx_temp && cd /emqx_temp +git clone -b ${tag} https://github.com/emqtt/emq-relx.git emqx-rel +version=`cd emqx-rel && git describe --abbrev=0 --tags` +pkg=emqx-${ostype}-${version}.zip +echo "building $pkg..." +cd emqx-rel && make && cd _rel && zip -rq $pkg emqx && scp $pkg root@${host}:/root/releases/${versionid}-${type} && cd /emq_temp + +git clone -b X https://github.com/emqtt/emq-package.git emqx-package +cd emqx-package +make +name=`basename package/*` +name2=${name/emqx-${versionid}/emqx-${ostype}-${version}} +name3=${name2/emqx_${versionid}/emqx-${ostype}-${version}} +mv package/${name} package/${name3} +scp package/* root@${host}:/root/releases/${versionid}-${type} diff --git a/.ci/mac_ci.sh b/.ci/mac_ci.sh index e48e925a..b3afb382 100755 --- a/.ci/mac_ci.sh +++ b/.ci/mac_ci.sh @@ -5,9 +5,9 @@ # Example: # ./mac_ci.sh 2.2-beta.1 -git clone -b release https://github.com/emqtt/emq-relx.git -version=`cd emq-relx && git describe --abbrev=0 --tags` -pkg=emqttd-macosx-${version}.zip +git clone -b release https://github.com/emqtt/emq-relx.git emqx-rel +version=`cd emqx-rel && git describe --abbrev=0 --tags` +pkg=emqx-macosx-${version}.zip echo "building $pkg..." -cd emq-relx && make && cd _rel && zip -rq $pkg emqttd +cd emqx-rel && make && cd _rel && zip -rq $pkg emqx scp _rel/$pkg root@emqtt.io:/root/releases/$1 diff --git a/.ci/ubuntu12.04/Dockerfile b/.ci/ubuntu12.04/Dockerfile index 819e42d6..72551ece 100644 --- a/.ci/ubuntu12.04/Dockerfile +++ b/.ci/ubuntu12.04/Dockerfile @@ -13,7 +13,6 @@ RUN apt-get clean\ ADD ./files/id_rsa /root/.ssh/ ADD ./files/id_rsa.pub /root/.ssh/ ADD ./files/config /root/.ssh/ -ADD ./files/emq_ci.sh / - -CMD ["/emq_ci.sh"] +ADD ./files/emqx_ci.sh / +CMD ["/emqx_ci.sh"] diff --git a/.ci/ubuntu14.04/Dockerfile b/.ci/ubuntu14.04/Dockerfile index b0ccf771..b325f8ec 100644 --- a/.ci/ubuntu14.04/Dockerfile +++ b/.ci/ubuntu14.04/Dockerfile @@ -16,6 +16,6 @@ RUN apt-get clean\ ADD ./files/id_rsa /root/.ssh/ ADD ./files/id_rsa.pub /root/.ssh/ ADD ./files/config /root/.ssh/ -ADD ./files/emq_ci.sh / +ADD ./files/emqx_ci.sh / -CMD ["/emq_ci.sh"] +CMD ["/emqx_ci.sh"] diff --git a/.ci/ubuntu16.04/Dockerfile b/.ci/ubuntu16.04/Dockerfile index 067188d2..407962c2 100644 --- a/.ci/ubuntu16.04/Dockerfile +++ b/.ci/ubuntu16.04/Dockerfile @@ -15,6 +15,6 @@ RUN apt-get clean\ ADD ./files/id_rsa /root/.ssh/ ADD ./files/id_rsa.pub /root/.ssh/ ADD ./files/config /root/.ssh/ -ADD ./files/emq_ci.sh / +ADD ./files/emqx_ci.sh / -CMD ["/emq_ci.sh"] +CMD ["/emqx_ci.sh"] diff --git a/.gitignore b/.gitignore index e9aea929..38791ce6 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ rel/ log/ ct/logs/* .DS_Store +.idea/ +*.d +*.iml diff --git a/Makefile b/Makefile index 5cffd714..639dd8e7 100644 --- a/Makefile +++ b/Makefile @@ -1,61 +1,70 @@ -PROJECT = emq-relx -PROJECT_DESCRIPTION = Release Project for the EMQ Broker -PROJECT_VERSION = 2.3 +PROJECT = emqx-rel +PROJECT_DESCRIPTION = Release Project for EMQ X Broker +PROJECT_VERSION = 2.4 +NO_AUTOPATCH = gen_rpc cuttlefish emqx_elixir_plugin ## Fix 'rebar command not found' DEPS = goldrush dep_goldrush = git https://github.com/basho/goldrush 0.1.9 -DEPS += emqttd emq_modules emq_dashboard emq_retainer emq_recon emq_reloader \ - emq_auth_clientid emq_auth_username emq_auth_ldap emq_auth_http \ - emq_auth_mysql emq_auth_pgsql emq_auth_redis emq_auth_mongo \ - emq_sn emq_coap emq_stomp emq_plugin_template emq_web_hook \ - emq_lua_hook emq_auth_jwt emq_lwm2m +DEPS += emqx emqx_modules emqx_management emqx_dashboard emqx_retainer \ + emqx_auth_clientid emqx_auth_username emqx_auth_ldap emqx_auth_http \ + emqx_auth_mysql emqx_auth_pgsql emqx_auth_redis emqx_auth_mongo \ + emqx_auth_jwt emqx_statsd emqx_delayed_publish emqx_recon emqx_reloader \ + emqx_web_hook emqx_lua_hook emqx_sn emqx_coap emqx_stomp emqx_lwm2m \ + emqx_plugin_template -# emq deps -dep_emqttd = git https://github.com/emqtt/emqttd develop -dep_emq_modules = git https://github.com/emqtt/emq-modules develop -dep_emq_dashboard = git https://github.com/emqtt/emq-dashboard develop -dep_emq_retainer = git https://github.com/emqtt/emq-retainer develop -dep_emq_recon = git https://github.com/emqtt/emq-recon develop -dep_emq_reloader = git https://github.com/emqtt/emq-reloader develop +# emqx modules +dep_emqx = git https://github.com/emqtt/emqttd X -# emq auth/acl plugins -dep_emq_auth_clientid = git https://github.com/emqtt/emq-auth-clientid develop -dep_emq_auth_username = git https://github.com/emqtt/emq-auth-username develop -dep_emq_auth_ldap = git https://github.com/emqtt/emq-auth-ldap develop -dep_emq_auth_http = git https://github.com/emqtt/emq-auth-http develop -dep_emq_auth_mysql = git https://github.com/emqtt/emq-auth-mysql develop -dep_emq_auth_pgsql = git https://github.com/emqtt/emq-auth-pgsql develop -dep_emq_auth_redis = git https://github.com/emqtt/emq-auth-redis develop -dep_emq_auth_mongo = git https://github.com/emqtt/emq-auth-mongo develop -dep_emq_auth_jwt = git https://github.com/emqtt/emq-auth-jwt develop +dep_emqx_modules = git https://github.com/emqtt/emq-modules X +dep_emqx_management = git https://github.com/emqtt/emq-management X +dep_emqx_dashboard = git https://github.com/emqtt/emq-dashboard X +dep_emqx_retainer = git https://github.com/emqtt/emq-retainer X +dep_emqx_recon = git https://github.com/emqtt/emq-recon X +dep_emqx_reloader = git https://github.com/emqtt/emq-reloader X +dep_emqx_statsd = git https://github.com/emqtt/emqx-statsd X +dep_emqx_delayed_publish = git https://github.com/emqtt/emqx-delayed-publish X +# emqx auth/acl plugins +dep_emqx_auth_clientid = git https://github.com/emqtt/emq-auth-clientid X +dep_emqx_auth_username = git https://github.com/emqtt/emq-auth-username X +dep_emqx_auth_ldap = git https://github.com/emqtt/emq-auth-ldap X +dep_emqx_auth_http = git https://github.com/emqtt/emq-auth-http X +dep_emqx_auth_mysql = git https://github.com/emqtt/emq-auth-mysql X +dep_emqx_auth_pgsql = git https://github.com/emqtt/emq-auth-pgsql X +dep_emqx_auth_redis = git https://github.com/emqtt/emq-auth-redis X +dep_emqx_auth_mongo = git https://github.com/emqtt/emq-auth-mongo X +dep_emqx_auth_jwt = git https://github.com/emqtt/emq-auth-jwt X -# mqtt-sn, coap and stomp -dep_emq_sn = git https://github.com/emqtt/emq-sn develop -dep_emq_coap = git https://github.com/emqtt/emq-coap develop -dep_emq_stomp = git https://github.com/emqtt/emq-stomp develop -dep_emq_lwm2m = git https://github.com/emqtt/emq-lwm2m develop +# emqx mqtt-sn, coap and stomp +dep_emqx_sn = git https://github.com/emqtt/emq-sn X +dep_emqx_coap = git https://github.com/emqtt/emq-coap X +dep_emqx_stomp = git https://github.com/emqtt/emq-stomp X +dep_emqx_lwm2m = git https://github.com/emqtt/emq-lwm2m X -# plugin template -dep_emq_plugin_template = git https://github.com/emqtt/emq-plugin-template develop +# emqx plugin template +dep_emqx_plugin_template = git https://github.com/emqtt/emq-plugin-template X # web_hook lua_hook -dep_emq_web_hook = git https://github.com/emqtt/emq-web-hook develop -dep_emq_lua_hook = git https://github.com/emqtt/emq-lua-hook develop -#dep_emq_elixir_plugin = git https://github.com/emqtt/emq-elixir-plugin develop +dep_emqx_web_hook = git https://github.com/emqtt/emq-web-hook X +dep_emqx_lua_hook = git https://github.com/emqtt/emq-lua-hook X +#dep_emqx_elixir_plugin = git https://github.com/emqtt/emq-elixir-plugin X -# COVER = true +BUILD_DEPS = cuttlefish +dep_cuttlefish = git https://github.com/emqtt/cuttlefish -NO_AUTOPATCH = emq_elixir_plugin +# COVER = true include erlang.mk +# Compile options +ERLC_OPTS += +warn_export_all +warn_missing_spec +warn_untyped_record + plugins: @rm -rf rel @mkdir -p rel/conf/plugins/ rel/schema/ @for conf in $(DEPS_DIR)/*/etc/*.conf* ; do \ - if [ "emq.conf" = "$${conf##*/}" ] ; then \ + if [ "emqx.conf" = "$${conf##*/}" ] ; then \ cp $${conf} rel/conf/ ; \ elif [ "acl.conf" = "$${conf##*/}" ] ; then \ cp $${conf} rel/conf/ ; \ diff --git a/README.md b/README.md index ca73b6f4..6f5a547c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -emq-relx +emqx-rel ======== -The Release Project for the *EMQ* Broker. +The Release Project for EMQ X Broker. NOTICE: Requires Erlang/OTP R19.3+ to build since EMQ 2.2-rc.2. @@ -9,17 +9,17 @@ Build on Linux/Unix/Mac ----------------------- ``` -git clone https://github.com/emqtt/emq-relx.git -cd emq-relx && make -cd _rel/emqttd && ./bin/emqttd console +git clone -b X https://github.com/emqtt/emq-relx.git emqx-rel +cd emqx-rel && make +cd _rel/emqx && ./bin/emqx console ``` Build Docker Image ------------------ ``` -git clone https://github.com/emqtt/emq_docker.git -cd emq_docker && docker build -t emq:latest . +git clone -b X https://github.com/emqtt/emq_docker.git emqx_docker +cd emqx_docker && docker build -t emqx:latest . ``` Build on Windows @@ -31,14 +31,14 @@ Install Erlang/OTP-R18.3 and MSYS2-x86_64 for erlang.mk: https://erlang.mk/guide/installation.html#_on_windows ``` -Clone and build the EMQ broker with erlang.mk: +Clone and build the EMQ X Broker with erlang.mk: ``` -git clone https://github.com/emqtt/emq-relx.git -cd emq-relx +git clone -b X https://github.com/emqtt/emq-relx.git emqx-rel +cd emqx-rel make -cd _rel\emqttd -bin\emqttd console +cd _rel\emqx +bin\emqx console ``` License diff --git a/bin/emqenv b/bin/emqenv deleted file mode 100755 index 84b39c56..00000000 --- a/bin/emqenv +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -[ "x" = "x$EMQ_NODE_NAME" ] && EMQ_NODE_NAME=emqttd@127.0.0.1 -[ "x" = "x$EMQ_NODE_COOKIE" ] && EMQ_NODE_COOKIE=emqsecretcookie -[ "x" = "x$EMQ_MAX_PACKET_SIZE" ] && EMQ_MAX_PACKET_SIZE=64KB -[ "x" = "x$EMQ_MAX_PORTS" ] && EMQ_MAX_PORTS=65536 -[ "x" = "x$EMQ_TCP_PORT" ] && EMQ_TCP_PORT=1883 -[ "x" = "x$EMQ_SSL_PORT" ] && EMQ_SSL_PORT=8883 -[ "x" = "x$EMQ_WS_PORT" ] && EMQ_WS_PORT=8083 -[ "x" = "x$EMQ_WSS_PORT" ] && EMQ_WSS_PORT=8084 - diff --git a/bin/emqttd b/bin/emqx similarity index 90% rename from bin/emqttd rename to bin/emqx index 5b048f36..f7a8577e 100755 --- a/bin/emqttd +++ b/bin/emqx @@ -10,7 +10,7 @@ if [ -z $SCRIPT ]; then fi; SCRIPT_DIR="$(cd `dirname "$SCRIPT"` && pwd -P)" RUNNER_ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd -P){{ runner_root_dir }}" -REL_NAME="emqttd" +REL_NAME="emqx" REL_VSN="{{ rel_vsn }}" ERTS_VSN="{{ erts_vsn }}" ERTS_PATH=$RUNNER_ROOT_DIR/erts-$ERTS_VSN/bin @@ -137,7 +137,7 @@ 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 - APPCONF=`relx_nodetool mergeconf $RUNNER_ETC_DIR/emq.conf $RUNNER_ETC_DIR/plugins $RUNNER_DATA_DIR/configs` + APPCONF=`relx_nodetool mergeconf $RUNNER_ETC_DIR/emqx.conf $RUNNER_ETC_DIR/plugins $RUNNER_DATA_DIR/configs` if [ "$?" -ne 0 ]; then echoerr "Error merging configs!" exit 1 @@ -158,14 +158,14 @@ generate_config() { } replace_env_in_conf() { - [ "x" = "x$EMQ_NODE_NAME" ] || $SED_REPLACE "s/^[ \t]*node.name[ \t]*=.*$/node.name= $EMQ_NODE_NAME/" $APPCONF - [ "x" = "x$EMQ_NODE_COOKIE" ] || $SED_REPLACE "s/^[ \t]*node.cookie[ \t]*=.*$/node.cookie= $EMQ_NODE_COOKIE/" $APPCONF - [ "x" = "x$EMQ_MAX_PORTS" ] || $SED_REPLACE "s/^[ \t]*node.max_ports[ \t]*=.*$/node.max_ports = $EMQ_MAX_PORTS/" $APPCONF - [ "x" = "x$EMQ_MAX_PACKET_SIZE" ] || $SED_REPLACE "s/^[ \t]*mqtt.max_packet_size[ \t]*=.*$/mqtt.max_packet_size = $EMQ_MAX_PACKET_SIZE/" $APPCONF - [ "x" = "x$EMQ_TCP_PORT" ] || $SED_REPLACE "s/^[ \t]*listener.tcp.external[ \t]*=.*$/listener.tcp.external = $EMQ_TCP_PORT/" $APPCONF - [ "x" = "x$EMQ_SSL_PORT" ] || $SED_REPLACE "s/^[ \t]*listener.ssl.external[ \t]*=.*$/listener.ssl.external = $EMQ_SSL_PORT/" $APPCONF - [ "x" = "x$EMQ_WS_PORT" ] || $SED_REPLACE "s/^[ \t]*listener.ws.external[ \t]*=.*$/listener.ws.external = $EMQ_WS_PORT/" $APPCONF - [ "x" = "x$EMQ_WSS_PORT" ] || $SED_REPLACE "s/^[ \t]*listener.wss.external[ \t]*=.*$/listener.wss.external = $EMQ_WSS_PORT/" $APPCONF + [ "x" = "x$EMQX_NODE_NAME" ] || $SED_REPLACE "s/^[ \t]*node.name[ \t]*=.*$/node.name= $EMQX_NODE_NAME/" $APPCONF + [ "x" = "x$EMQX_NODE_COOKIE" ] || $SED_REPLACE "s/^[ \t]*node.cookie[ \t]*=.*$/node.cookie= $EMQX_NODE_COOKIE/" $APPCONF + [ "x" = "x$EMQX_MAX_PORTS" ] || $SED_REPLACE "s/^[ \t]*node.max_ports[ \t]*=.*$/node.max_ports = $EMQX_MAX_PORTS/" $APPCONF + [ "x" = "x$EMQX_MAX_PACKET_SIZE" ] || $SED_REPLACE "s/^[ \t]*mqtt.max_packet_size[ \t]*=.*$/mqtt.max_packet_size = $EMQX_MAX_PACKET_SIZE/" $APPCONF + [ "x" = "x$EMQX_TCP_PORT" ] || $SED_REPLACE "s/^[ \t]*listener.tcp.external[ \t]*=.*$/listener.tcp.external = $EMQX_TCP_PORT/" $APPCONF + [ "x" = "x$EMQX_SSL_PORT" ] || $SED_REPLACE "s/^[ \t]*listener.ssl.external[ \t]*=.*$/listener.ssl.external = $EMQX_SSL_PORT/" $APPCONF + [ "x" = "x$EMQX_WS_PORT" ] || $SED_REPLACE "s/^[ \t]*listener.ws.external[ \t]*=.*$/listener.ws.external = $EMQX_WS_PORT/" $APPCONF + [ "x" = "x$EMQX_WSS_PORT" ] || $SED_REPLACE "s/^[ \t]*listener.wss.external[ \t]*=.*$/listener.wss.external = $EMQX_WSS_PORT/" $APPCONF } # Make sure log directory exists @@ -183,7 +183,7 @@ fi [ "x" = "x$EMQ_NODE_NAME" ] || NAME_ARG="-name $EMQ_NODE_NAME" # Extract the target node name from node.args if [ -z "$NAME_ARG" ]; then - NODENAME=`egrep '^[ \t]*node.name[ \t]*=[ \t]*' $RUNNER_ETC_DIR/emq.conf 2> /dev/null | tail -1 | cut -d = -f 2` + NODENAME=`egrep '^[ \t]*node.name[ \t]*=[ \t]*' $RUNNER_ETC_DIR/emqx.conf 2> /dev/null | tail -1 | cut -d = -f 2` if [ -z "$NODENAME" ]; then echoerr "vm.args needs to have a -name parameter." echoerr " -sname is not supported." @@ -202,7 +202,7 @@ PIPE_DIR="${PIPE_DIR:-/tmp/${WHOAMI}_erl_pipes/$NAME/}" [ "x" = "x$EMQ_NODE_COOKIE" ] || COOKIE_ARG="-setcookie $EMQ_NODE_COOKIE" # Extract the target cookie if [ -z "$COOKIE_ARG" ]; then - COOKIE=`egrep '^[ \t]*node.cookie[ \t]*=[ \t]*' $RUNNER_ETC_DIR/emq.conf 2> /dev/null | tail -1 | cut -d = -f 2` + COOKIE=`egrep '^[ \t]*node.cookie[ \t]*=[ \t]*' $RUNNER_ETC_DIR/emqx.conf 2> /dev/null | tail -1 | cut -d = -f 2` if [ -z "$COOKIE" ]; then echoerr "vm.args needs to have a -setcookie parameter." exit 1 @@ -281,11 +281,11 @@ case "$1" in if ! relx_nodetool "ping" >/dev/null 2>&1; then continue fi - echo "emqttd {{ rel_vsn }} is started successfully!" + echo "emqx {{ rel_vsn }} is started successfully!" exit 0 done echo "The broker failed to start within ${WAIT_FOR_ERLANG:-15} seconds," - echo "see the output of './bin/emqttd console' for more information." + echo "see the output of './bin/emqx console' for more information." echo "If you want to wait longer, set the environment variable" echo "WAIT_FOR_ERLANG to the number of seconds to wait." exit 1 diff --git a/bin/emqttd.cmd b/bin/emqx.cmd similarity index 96% rename from bin/emqttd.cmd rename to bin/emqx.cmd index d5ff5abd..6ceb151e 100644 --- a/bin/emqttd.cmd +++ b/bin/emqx.cmd @@ -14,7 +14,7 @@ :: * usage - display available commands :: Set variables that describe the release -@set rel_name=emqttd +@set rel_name=emqx @set rel_vsn={{ rel_vsn }} @set erts_vsn={{ erts_vsn }} @set erl_opts={{ erl_opts }} @@ -32,7 +32,7 @@ @set etc_dir=%rel_root_dir%\etc @set lib_dir=%rel_root_dir%\lib @set data_dir=%rel_root_dir%\data -@set emq_conf=%etc_dir%\emq.conf +@set emqx_conf=%etc_dir%\emqx.conf @call :find_erts_dir @call :find_vm_args @@ -51,13 +51,13 @@ @set nodetool="%rel_root_dir%\bin\nodetool" @set cuttlefish="%rel_root_dir%\bin\cuttlefish" -:: Extract node name from emq.conf -@for /f "usebackq delims=\= tokens=2" %%I in (`findstr /b node\.name "%emq_conf%"`) do @( +:: Extract node name from emqx.conf +@for /f "usebackq delims=\= tokens=2" %%I in (`findstr /b node\.name "%emqx_conf%"`) do @( @set node_type="-name" @call :set_trim node_name %%I ) -:: Extract node cookie from emq.conf +:: Extract node cookie from emqx.conf @for /f "usebackq delims=\= tokens=2" %%I in (`findstr /b node\.cookie "%emq_conf%"`) do @( @call :set_trim node_cookie= %%I ) @@ -138,7 +138,7 @@ @goto :eof :generate_app_config -@set mergeconf_cmd=%escript% %nodetool% mergeconf %etc_dir%\emq.conf %etc_dir%\plugins %data_dir%\configs +@set mergeconf_cmd=%escript% %nodetool% mergeconf %etc_dir%\emqx.conf %etc_dir%\plugins %data_dir%\configs @for /f %%Z in ('%%mergeconf_cmd%%') do @( set merged_app_conf=%%Z ) diff --git a/bin/emqttd_ctl b/bin/emqx_ctl similarity index 93% rename from bin/emqttd_ctl rename to bin/emqx_ctl index e170c6e3..75e53b03 100755 --- a/bin/emqttd_ctl +++ b/bin/emqx_ctl @@ -10,7 +10,7 @@ if [ -z $SCRIPT ]; then fi; SCRIPT_DIR="$(cd `dirname "$SCRIPT"` && pwd -P)" RUNNER_ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd -P){{ runner_root_dir }}" -REL_NAME="emqttd" +REL_NAME="emqx" REL_VSN="{{ rel_vsn }}" ERTS_VSN="{{ erts_vsn }}" REL_DIR="$RUNNER_ROOT_DIR/releases/$REL_VSN" @@ -51,7 +51,7 @@ relx_nodetool() { [ "x" = "x$EMQ_NODE_NAME" ] || NAME_ARG="-name $EMQ_NODE_NAME" # Extract the target node name from node.args if [ -z "$NAME_ARG" ]; then - NODENAME=`egrep '^[ \t]*node.name[ \t]*=[ \t]*' $RUNNER_ETC_DIR/emq.conf 2> /dev/null | tail -1 | cut -d = -f 2` + NODENAME=`egrep '^[ \t]*node.name[ \t]*=[ \t]*' $RUNNER_ETC_DIR/emqx.conf 2> /dev/null | tail -1 | cut -d = -f 2` if [ -z "$NODENAME" ]; then echoerr "vm.args needs to have a -name parameter." echoerr " -sname is not supported." @@ -68,7 +68,7 @@ NAME="$(echo "$NAME_ARG" | awk '{print $2}')" [ "x" = "x$EMQ_NODE_COOKIE" ] || COOKIE_ARG="-setcookie $EMQ_NODE_COOKIE" # Extract the target cookie if [ -z "$COOKIE_ARG" ]; then - COOKIE=`egrep '^[ \t]*node.cookie[ \t]*=[ \t]*' $RUNNER_ETC_DIR/emq.conf 2> /dev/null | tail -1 | cut -d = -f 2` + COOKIE=`egrep '^[ \t]*node.cookie[ \t]*=[ \t]*' $RUNNER_ETC_DIR/emqx.conf 2> /dev/null | tail -1 | cut -d = -f 2` if [ -z "$COOKIE" ]; then echoerr "vm.args needs to have a -setcookie parameter." exit 1 @@ -85,5 +85,5 @@ export ROOTDIR="$RUNNER_ROOT_DIR" export BINDIR="$ERTS_DIR/bin" cd "$ROOTDIR" -relx_nodetool rpc emqttd_ctl run $@ +relx_nodetool rpc emqx_ctl run $@ diff --git a/bin/emqttd_ctl.cmd b/bin/emqx_ctl.cmd similarity index 90% rename from bin/emqttd_ctl.cmd rename to bin/emqx_ctl.cmd index 3aa78d80..1cbc4549 100644 --- a/bin/emqttd_ctl.cmd +++ b/bin/emqx_ctl.cmd @@ -1,9 +1,9 @@ -:: The batch file for emqttd_ctl command +:: The batch file for emqx_ctl command @set args=%* :: Set variables that describe the release -@set rel_name=emqttd +@set rel_name=emqx @set rel_vsn={{ rel_vsn }} @set erts_vsn={{ erts_vsn }} @set erl_opts={{ erl_opts }} @@ -15,7 +15,7 @@ set rel_root_dir=%%~fA ) @set rel_dir=%rel_root_dir%\releases\%rel_vsn% -@set emq_conf=%rel_root_dir%\etc\emq.conf +@set emqx_conf=%rel_root_dir%\etc\emqx.conf @call :find_erts_dir @@ -24,14 +24,14 @@ @set escript="%bindir%\escript.exe" @set nodetool="%rel_root_dir%\bin\nodetool" -:: Extract node name from emq.conf -@for /f "usebackq tokens=1-2" %%I in (`findstr /b "node.name=" "%emq_conf%"`) do @( +:: Extract node name from emqx.conf +@for /f "usebackq tokens=1-2" %%I in (`findstr /b "node.name=" "%emqx_conf%"`) do @( @set node_type="-name" @call :set_trim node_name %%I ) :: Extract cookie from vm.args -@for /f "usebackq tokens=1-2" %%I in (`findstr /b "node.cookie=" "%emq_conf%"`) do @( +@for /f "usebackq tokens=1-2" %%I in (`findstr /b "node.cookie=" "%emqx_conf%"`) do @( @call :set_trim node_cookie= %%I ) @@ -43,7 +43,7 @@ copy "%rel_dir%\%rel_name%.boot" "%rel_dir%\start.boot" >nul ) -@%escript% %nodetool% %node_type% "%node_name%" -setcookie "%node_cookie%" rpc emqttd_ctl run %args% +@%escript% %nodetool% %node_type% "%node_name%" -setcookie "%node_cookie%" rpc emqx_ctl run %args% :: Find the ERTS dir :find_erts_dir diff --git a/bin/emqx_env b/bin/emqx_env new file mode 100755 index 00000000..6c89be24 --- /dev/null +++ b/bin/emqx_env @@ -0,0 +1,11 @@ +#!/bin/sh + +[ "x" = "x$EMQX_NODE_NAME" ] && EMQX_NODE_NAME=emqx@127.0.0.1 +[ "x" = "x$EMQX_NODE_COOKIE" ] && EMQX_NODE_COOKIE=emqxsecretcookie +[ "x" = "x$EMQX_MAX_PACKET_SIZE" ] && EMQX_MAX_PACKET_SIZE=64KB +[ "x" = "x$EMQX_MAX_PORTS" ] && EMQX_MAX_PORTS=65536 +[ "x" = "x$EMQX_TCP_PORT" ] && EMQX_TCP_PORT=1883 +[ "x" = "x$EMQX_SSL_PORT" ] && EMQX_SSL_PORT=8883 +[ "x" = "x$EMQX_WS_PORT" ] && EMQX_WS_PORT=8083 +[ "x" = "x$EMQX_WSS_PORT" ] && EMQX_WSS_PORT=8084 + diff --git a/bin/nodetool b/bin/nodetool index 385a822b..8829cf25 100755 --- a/bin/nodetool +++ b/bin/nodetool @@ -51,7 +51,7 @@ main(Args) -> %% a "pong" io:format("pong\n"); ["stop"] -> - rpc:call(TargetNode, emqttd_plugins, unload, [], 60000), + rpc:call(TargetNode, emqx_plugins, unload, [], 60000), io:format("~p\n", [rpc:call(TargetNode, init, stop, [], 60000)]); ["restart"] -> io:format("~p\n", [rpc:call(TargetNode, init, restart, [], 60000)]); @@ -261,7 +261,7 @@ consult(Cont, Str, Acc) -> end. %% -%% Validation functions for checking the emqttd.config +%% Validation functions for checking the app.config %% validate([Terms]) -> Results = [ValidateFun(Terms) || ValidateFun <- get_validation_funs()], @@ -278,7 +278,7 @@ get_validation_funs() -> [ ]. print_issue({warning, Warning}) -> - io:format(standard_error, "Warning in emqttd.config: ~s~n", [Warning]); + io:format(standard_error, "Warning in app.config: ~s~n", [Warning]); print_issue({error, Error}) -> - io:format(standard_error, "Error in emqttd.config: ~s~n", [Error]). + io:format(standard_error, "Error in app.config: ~s~n", [Error]). diff --git a/ct/emqtt.spec b/ct/emqtt.spec deleted file mode 100644 index e99f4d00..00000000 --- a/ct/emqtt.spec +++ /dev/null @@ -1,31 +0,0 @@ -{alias, emqttd, "../deps/emqttd/test"}. -{alias, emq_dashboard, "../deps/emq_dashboard/test"}. -{alias, emq_auth_mysql, "../deps/emq_auth_mysql/test"}. -{alias, emq_auth_pgsql, "../deps/emq_auth_pgsql/test"}. -{alias, emq_auth_mongo, "../deps/emq_auth_mongo/test"}. -{alias, emq_auth_redis, "../deps/emq_auth_redis/test"}. -{alias, emq_auth_http, "../deps/emq_auth_http/test"}. -{alias, emq_auth_clientid, "../deps/emq_auth_clientid/test"}. -{alias, emq_auth_username, "../deps/emq_auth_username/test"}. -{alias, emq_web_hook, "../deps/emq_web_hook/test"}. - -{logdir, "./logs/"}. - -{include, "../deps/emqttd/include"}. -{include, "../deps/emq_auth_mongo/include"}. -{include, "../deps/emq_auth_mysql/include"}. -{include, "../deps/emq_auth_redis/include"}. - -{auto_compile, true}. - -{suites, emqttd, all}. -{suites, emq_dashboard, all}. -{suites, emq_auth_mysql, all}. -{suites, emq_auth_pgsql, all}. -{suites, emq_auth_mongo, all}. -{suites, emq_auth_redis, all}. -{suites, emq_auth_http, all}. -{suites, emq_auth_clientid, all}. -{suites, emq_auth_username, all}. -{suites, emq_web_hook, all}. -{abort_if_missing_suites, true}. diff --git a/ct/emqx.spec b/ct/emqx.spec new file mode 100644 index 00000000..fa4e6de0 --- /dev/null +++ b/ct/emqx.spec @@ -0,0 +1,31 @@ +{alias, emqx, "../deps/emqx/test"}. +{alias, emqx_dashboard, "../deps/emqx_dashboard/test"}. +{alias, emqx_auth_mysql, "../deps/emqx_auth_mysql/test"}. +{alias, emqx_auth_pgsql, "../deps/emqx_auth_pgsql/test"}. +{alias, emqx_auth_mongo, "../deps/emqx_auth_mongo/test"}. +{alias, emqx_auth_redis, "../deps/emqx_auth_redis/test"}. +{alias, emqx_auth_http, "../deps/emqx_auth_http/test"}. +{alias, emqx_auth_clientid, "../deps/emqx_auth_clientid/test"}. +{alias, emqx_auth_username, "../deps/emqx_auth_username/test"}. +{alias, emqx_web_hook, "../deps/emqx_web_hook/test"}. + +{logdir, "./logs/"}. + +{include, "../deps/emqx/include"}. +{include, "../deps/emqx_auth_mongo/include"}. +{include, "../deps/emqx_auth_mysql/include"}. +{include, "../deps/emqx_auth_redis/include"}. + +{auto_compile, true}. + +{suites, emqx, all}. +{suites, emqx_dashboard, all}. +{suites, emqx_auth_mysql, all}. +{suites, emqx_auth_pgsql, all}. +{suites, emqx_auth_mongo, all}. +{suites, emqx_auth_redis, all}. +{suites, emqx_auth_http, all}. +{suites, emqx_auth_clientid, all}. +{suites, emqx_auth_username, all}. +{suites, emqx_web_hook, all}. +{abort_if_missing_suites, true}. diff --git a/ct/run_emqtt.sh b/ct/run_emqtt.sh deleted file mode 100755 index fc232ad8..00000000 --- a/ct/run_emqtt.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -make -C ../ -ct_run -spec emqtt.spec -pa ../deps/*/ebin ../deps/*/test diff --git a/ct/run_emqx.sh b/ct/run_emqx.sh new file mode 100755 index 00000000..3b32f618 --- /dev/null +++ b/ct/run_emqx.sh @@ -0,0 +1,3 @@ +#!/bin/bash +make -C ../ +ct_run -spec emqx.spec -pa ../deps/*/ebin ../deps/*/test diff --git a/data/loaded_plugins b/data/loaded_plugins index 484c05de..b3d64993 100644 --- a/data/loaded_plugins +++ b/data/loaded_plugins @@ -1,4 +1,5 @@ -emq_recon. -emq_modules. -emq_retainer. -emq_dashboard. +emqx_recon. +emqx_modules. +emqx_retainer. +emqx_management. +emqx_dashboard. diff --git a/relx.config b/relx.config index 8bcdbe8f..fa76e669 100644 --- a/relx.config +++ b/relx.config @@ -1,5 +1,6 @@ +%% -*- mode: Erlang; fill-column: 80; comment-column: 75; -*- -{release, {emqttd, "2.3"}, [ +{release, {emqx, "2.4"}, [ sasl, asn1, syntax_tools, @@ -27,28 +28,31 @@ mochiweb, {mnesia, load}, {ekka, load}, - emqttd, - {emq_sn, load}, - {emq_coap, load}, - {emq_lwm2m, load}, - {emq_recon, load}, - {emq_stomp, load}, - {emq_modules, load}, - {emq_retainer, load}, - {emq_reloader, load}, - {emq_dashboard, load}, - {emq_web_hook, load}, - {emq_lua_hook, load}, - {emq_auth_clientid, load}, - {emq_auth_username, load}, - {emq_auth_ldap, load}, - {emq_auth_http, load}, - {emq_auth_mongo, load}, - {emq_auth_mysql, load}, - {emq_auth_pgsql, load}, - {emq_auth_redis, load}, - {emq_auth_jwt, load}, - {emq_plugin_template, load} + emqx, + {emqx_sn, load}, + {emqx_coap, load}, + {emqx_lwm2m, load}, + {emqx_recon, load}, + {emqx_stomp, load}, + {emqx_modules, load}, + {emqx_retainer, load}, + {emqx_reloader, load}, + {emqx_statsd, load}, + {emqx_delayed_publish, load}, + {emqx_management, load}, + {emqx_dashboard, load}, + {emqx_web_hook, load}, + {emqx_lua_hook, load}, + {emqx_auth_clientid, load}, + {emqx_auth_username, load}, + {emqx_auth_ldap, load}, + {emqx_auth_http, load}, + {emqx_auth_mongo, load}, + {emqx_auth_mysql, load}, + {emqx_auth_pgsql, load}, + {emqx_auth_redis, load}, + {emqx_auth_jwt, load}, + {emqx_plugin_template, load} ]}. {include_src, false}. @@ -70,22 +74,22 @@ {mkdir, "data/mnesia"}, {mkdir, "data/configs"}, {mkdir, "hook_lua"}, - {template, "bin/emqenv", "bin/emqenv"}, - {template, "bin/emqttd", "bin/emqttd"}, - {template, "bin/emqttd_ctl", "bin/emqttd_ctl"}, - {template, "bin/emqttd.cmd", "bin/emqttd.cmd"}, - {template, "bin/emqttd_ctl.cmd", "bin/emqttd_ctl.cmd"}, + {template, "bin/emqx_env", "bin/emqx_env"}, + {template, "bin/emqx", "bin/emqx"}, + {template, "bin/emqx_ctl", "bin/emqx_ctl"}, + {template, "bin/emqx.cmd", "bin/emqx.cmd"}, + {template, "bin/emqx_ctl.cmd", "bin/emqx_ctl.cmd"}, {copy, "rel/conf/plugins", "etc/"}, - {copy, "deps/emqttd/etc/certs", "etc/"}, - {template, "rel/conf/emq.conf", "etc/emq.conf"}, - {template, "rel/conf/plugins/emq_coap.conf", "etc/plugins/emq_coap.conf"}, - {template, "rel/conf/plugins/emq_lwm2m.conf", "etc/plugins/emq_lwm2m.conf"}, + {copy, "deps/emqx/etc/certs", "etc/"}, + {template, "rel/conf/emqx.conf", "etc/emqx.conf"}, + {template, "rel/conf/plugins/emqx_coap.conf", "etc/plugins/emqx_coap.conf"}, + {template, "rel/conf/plugins/emqx_lwm2m.conf", "etc/plugins/emqx_lwm2m.conf"}, {copy, "rel/conf/acl.conf", "etc/acl.conf"}, {copy, "data/loaded_plugins", "data/loaded_plugins"}, {copy, "bin/cuttlefish", "bin/cuttlefish"}, {copy, "bin/nodetool", "bin/nodetool"}, {copy, "rel/schema", "releases/\{\{rel_vsn\}\}/"}, {copy, "bin/install_upgrade_escript", "bin/install_upgrade_escript"}, - {copy, "deps/emq_lwm2m/lwm2m_xml", "etc/"} + {copy, "deps/emqx_lwm2m/lwm2m_xml", "etc/"} ]}. diff --git a/vars.config b/vars.config index 14dedd0b..14e9e0a1 100644 --- a/vars.config +++ b/vars.config @@ -9,7 +9,7 @@ {platform_log_dir, "log"}. %% -%% bin/emqttd +%% bin/emqx %% %% {runner_script_dir, "$(cd ${0%/*} && pwd)"}. {runner_root_dir, ""}.