部署文件更新
@@ -1,50 +0,0 @@
|
|||||||
FROM ubuntu:20.04 as build
|
|
||||||
|
|
||||||
|
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive &&\
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends openjdk-8-jre-headless openjdk-8-jdk-headless git maven nodejs npm openssl && \
|
|
||||||
mkdir -p /opt/fastbee/java /opt/fastbee/vue
|
|
||||||
|
|
||||||
|
|
||||||
RUN cd /home && \
|
|
||||||
git clone "https://gitee.com/zhuangpengli/FastBee" && \
|
|
||||||
cp /home/FastBee/docker/settings.xml /usr/share/maven/conf/
|
|
||||||
|
|
||||||
RUN cd /home/FastBee/vue && \
|
|
||||||
npm install --registry=https://registry.npmmirror.com && \
|
|
||||||
npm run build:prod && \
|
|
||||||
cp -rf /home/FastBee/vue/dist/* /opt/fastbee/vue/
|
|
||||||
|
|
||||||
RUN cd /home/FastBee/springboot && \
|
|
||||||
mvn clean package -Dmaven.test.skip=true && \
|
|
||||||
cp -rf /home/FastBee/springboot/fastbee-admin/target/fastbee-admin.jar /opt/fastbee/java
|
|
||||||
|
|
||||||
|
|
||||||
FROM openjdk:8-jre
|
|
||||||
|
|
||||||
EXPOSE 8080/tcp
|
|
||||||
EXPOSE 1883/tcp
|
|
||||||
EXPOSE 8083/tcp
|
|
||||||
EXPOSE 8888/tcp
|
|
||||||
EXPOSE 8889/tcp
|
|
||||||
EXPOSE 5061/udp
|
|
||||||
|
|
||||||
ENV LC_ALL zh_CN.UTF-8
|
|
||||||
|
|
||||||
COPY --from=build /opt/fastbee/java /opt
|
|
||||||
|
|
||||||
WORKDIR /opt
|
|
||||||
|
|
||||||
CMD ["java", "-jar", "/server.jar"]
|
|
||||||
|
|
||||||
FROM nginx:stable
|
|
||||||
|
|
||||||
EXPOSE 80/tcp
|
|
||||||
EXPOSE 443/tcp
|
|
||||||
|
|
||||||
ENV LC_ALL zh_CN.UTF-8
|
|
||||||
|
|
||||||
COPY --from=build /opt/fastbee/vue/* /usr/share/nginx/html
|
|
||||||
COPY ./data/nginx/ssl/* /usr/share/nginx/ssl
|
|
||||||
COPY ./data/nginx/nginx.conf /etc/nginx/nginx.conf
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
## 1.clone本项目
|
|
||||||
```
|
|
||||||
git clone https://gitee.com/zhuangpengli/fastbee-docker.git
|
|
||||||
cd fastbee-docker
|
|
||||||
cp -rf ./data /var
|
|
||||||
```
|
|
||||||
## 2.编译java包
|
|
||||||
```
|
|
||||||
git clone https://gitee.com/zhuangpengli/FastBee.git
|
|
||||||
cd FastBee/springboot
|
|
||||||
# 编译emqx版本 请修改fastbee-admin下面 application.yml
|
|
||||||
# server:
|
|
||||||
# broker:
|
|
||||||
# enabled: false
|
|
||||||
# openws: false
|
|
||||||
# 编译netty mqtt版本 保持默认配置
|
|
||||||
mvn clean package -Dmaven.test.skip=true
|
|
||||||
cp ./fastbee-admin/target/fastbee-admin.jar /var/data/java/fastbee-admin.jar
|
|
||||||
```
|
|
||||||
|
|
||||||
## 3.打包前端目录
|
|
||||||
```
|
|
||||||
git clone https://gitee.com/zhuangpengli/FastBee.git
|
|
||||||
cd FastBee/vue
|
|
||||||
npm install
|
|
||||||
npm run build:prod
|
|
||||||
cp -rf ./dist/* /var/data/nginx/vue
|
|
||||||
```
|
|
||||||
|
|
||||||
## 4.启动项目
|
|
||||||
```
|
|
||||||
cd /var/data
|
|
||||||
setenforce 0
|
|
||||||
chmod 777 -R /var/data
|
|
||||||
# 使用emqx版本mqtt broker输入该命令:
|
|
||||||
sudo cp -rf docker-compose-emqx.yml docker-compose.yml
|
|
||||||
# 使用netty mqtt则使用默认脚本直接启动
|
|
||||||
docker-compose up -d
|
|
||||||
```
|
|
||||||
@@ -89,7 +89,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /var/data/nginx/vue:/usr/share/nginx/html
|
- /var/data/nginx/vue:/usr/share/nginx/html
|
||||||
- /var/data/nginx/h5:/usr/share/nginx/h5
|
- /var/data/nginx/h5:/usr/share/nginx/h5
|
||||||
- /var/data/nginx/www:/usr/share/nginx/www
|
|
||||||
- /var/data/nginx/ssl:/usr/share/nginx/ssl
|
- /var/data/nginx/ssl:/usr/share/nginx/ssl
|
||||||
- /var/data/nginx/nginx.conf:/etc/nginx/nginx.conf
|
- /var/data/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||||
- /var/data/nginx:/var/log/nginx
|
- /var/data/nginx:/var/log/nginx
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
##--------------------------------------------------------------------
|
|
||||||
## HTTP Auth/ACL Plugin
|
|
||||||
##--------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
##------------------------------------------------------------------------------
|
|
||||||
## SSL options
|
|
||||||
|
|
||||||
## Path to the file containing PEM-encoded CA certificates. The CA certificates
|
|
||||||
## are used during server authentication and when building the client certificate chain.
|
|
||||||
##
|
|
||||||
## Value: File
|
|
||||||
## auth.http.ssl.cacertfile = /etc/emqx/certs/ca.pem
|
|
||||||
|
|
||||||
## The path to a file containing the client's certificate.
|
|
||||||
##
|
|
||||||
## Value: File
|
|
||||||
## auth.http.ssl.certfile = /etc/emqx/certs/client-cert.pem
|
|
||||||
|
|
||||||
## Path to a file containing the client's private PEM-encoded key.
|
|
||||||
##
|
|
||||||
## Value: File
|
|
||||||
## auth.http.ssl.keyfile = /etc/emqx/certs/client-key.pem
|
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
|
||||||
## HTTP Request Headers
|
|
||||||
##
|
|
||||||
## Example: auth.http.header.Accept-Encoding = *
|
|
||||||
##
|
|
||||||
## Value: String
|
|
||||||
## auth.http.header.Accept = */*
|
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
|
||||||
## Authentication request.
|
|
||||||
##
|
|
||||||
## Variables:
|
|
||||||
## - %u: username
|
|
||||||
## - %c: clientid
|
|
||||||
## - %a: ipaddress
|
|
||||||
## - %r: protocol
|
|
||||||
## - %P: password
|
|
||||||
## - %p: sockport of server accepted
|
|
||||||
## - %C: common name of client TLS cert
|
|
||||||
## - %d: subject of client TLS cert
|
|
||||||
##
|
|
||||||
## Value: URL
|
|
||||||
auth.http.auth_req = http://java:8080/iot/tool/mqtt/auth
|
|
||||||
## Value: post | get | put
|
|
||||||
auth.http.auth_req.method = post
|
|
||||||
## Value: Params
|
|
||||||
auth.http.auth_req.params = clientid=%c,username=%u,password=%P
|
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
|
||||||
## Superuser request.
|
|
||||||
##
|
|
||||||
## Variables:
|
|
||||||
## - %u: username
|
|
||||||
## - %c: clientid
|
|
||||||
## - %a: ipaddress
|
|
||||||
## - %r: protocol
|
|
||||||
## - %P: password
|
|
||||||
## - %p: sockport of server accepted
|
|
||||||
## - %C: common name of client TLS cert
|
|
||||||
## - %d: subject of client TLS cert
|
|
||||||
##
|
|
||||||
## Value: URL
|
|
||||||
# auth.http.super_req = http://127.0.0.1:8991/mqtt/superuser
|
|
||||||
## Value: post | get | put
|
|
||||||
# auth.http.super_req.method = post
|
|
||||||
## Value: Params
|
|
||||||
# auth.http.super_req.params = clientid=%c,username=%u
|
|
||||||
|
|
||||||
##--------------------------------------------------------------------
|
|
||||||
## ACL request.
|
|
||||||
##
|
|
||||||
## Variables:
|
|
||||||
## - %A: 1 | 2, 1 = sub, 2 = pub
|
|
||||||
## - %u: username
|
|
||||||
## - %c: clientid
|
|
||||||
## - %a: ipaddress
|
|
||||||
## - %r: protocol
|
|
||||||
## - %m: mountpoint
|
|
||||||
## - %t: topic
|
|
||||||
##
|
|
||||||
## Value: URL
|
|
||||||
# auth.http.acl_req = http://127.0.0.1:8991/mqtt/acl
|
|
||||||
## Value: post | get | put
|
|
||||||
# auth.http.acl_req.method = get
|
|
||||||
## Value: Params
|
|
||||||
# auth.http.acl_req.params = access=%A,username=%u,clientid=%c,ipaddr=%a,topic=%t,mountpoint=%m
|
|
||||||
|
|
||||||
##------------------------------------------------------------------------------
|
|
||||||
## Http Reqeust options
|
|
||||||
|
|
||||||
## Time-out time for the http request, 0 is never timeout.
|
|
||||||
##
|
|
||||||
## Value: Duration
|
|
||||||
## -h: hour, e.g. '2h' for 2 hours
|
|
||||||
## -m: minute, e.g. '5m' for 5 minutes
|
|
||||||
## -s: second, e.g. '30s' for 30 seconds
|
|
||||||
##
|
|
||||||
## Default: 0
|
|
||||||
## auth.http.request.timeout = 0
|
|
||||||
|
|
||||||
## Connection time-out time, used during the initial request
|
|
||||||
## when the client is connecting to the server
|
|
||||||
##
|
|
||||||
## Value: Duration
|
|
||||||
##
|
|
||||||
## Default is same with the timeout option
|
|
||||||
## auth.http.request.connect_timout = 0
|
|
||||||
|
|
||||||
## Re-send http reuqest times
|
|
||||||
##
|
|
||||||
## Value: integer
|
|
||||||
##
|
|
||||||
## Default: 3
|
|
||||||
auth.http.request.retry_times = 3
|
|
||||||
|
|
||||||
## The interval for re-sending the http request
|
|
||||||
##
|
|
||||||
## Value: Duration
|
|
||||||
##
|
|
||||||
## Default: 1s
|
|
||||||
auth.http.request.retry_interval = 1s
|
|
||||||
|
|
||||||
## The 'Exponential Backoff' mechanism for re-sending request. The actually
|
|
||||||
## re-send time interval is `interval * backoff ^ times`
|
|
||||||
##
|
|
||||||
## Value: float
|
|
||||||
##
|
|
||||||
## Default: 2.0
|
|
||||||
auth.http.request.retry_backoff = 2.0
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
web.hook.api.url = http://java:8080/iot/tool/mqtt/webhook
|
|
||||||
|
|
||||||
## Encode message payload field
|
|
||||||
##
|
|
||||||
## Value: base64 | base62
|
|
||||||
##
|
|
||||||
## Default: undefined
|
|
||||||
## web.hook.encode_payload = base64
|
|
||||||
|
|
||||||
# web.hook.rule.client.connect.1 = {"action": "on_client_connect"}
|
|
||||||
# web.hook.rule.client.connack.1 = {"action": "on_client_connack"}
|
|
||||||
web.hook.rule.client.connected.1 = {"action": "on_client_connected"}
|
|
||||||
web.hook.rule.client.disconnected.1 = {"action": "on_client_disconnected"}
|
|
||||||
# web.hook.rule.client.subscribe.1 = {"action": "on_client_subscribe"}
|
|
||||||
# web.hook.rule.client.unsubscribe.1 = {"action": "on_client_unsubscribe"}
|
|
||||||
# web.hook.rule.session.subscribed.1 = {"action": "on_session_subscribed"}
|
|
||||||
# web.hook.rule.session.unsubscribed.1 = {"action": "on_session_unsubscribed"}
|
|
||||||
# web.hook.rule.session.terminated.1 = {"action": "on_session_terminated"}
|
|
||||||
# web.hook.rule.message.publish.1 = {"action": "on_message_publish"}
|
|
||||||
# web.hook.rule.message.delivered.1 = {"action": "on_message_delivered"}
|
|
||||||
# web.hook.rule.message.acked.1 = {"action": "on_message_acked"}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{emqx_management, true}.
|
|
||||||
{emqx_recon, true}.
|
|
||||||
{emqx_retainer, true}.
|
|
||||||
{emqx_dashboard, true}.
|
|
||||||
{emqx_rule_engine, true}.
|
|
||||||
{emqx_auth_http,true}.
|
|
||||||
{emqx_web_hook,true}.
|
|
||||||
{emqx_bridge_mqtt, false}.
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
%%--------------------------------------------------------------------
|
|
||||||
%% -type(ipaddr() :: {ipaddr, string()}).
|
|
||||||
%%
|
|
||||||
%% -type(ipaddrs() :: {ipaddrs, string()}).
|
|
||||||
%%
|
|
||||||
%% -type(username() :: {user | username, string()} | {user | username, {re, regex()}}).
|
|
||||||
%%
|
|
||||||
%% -type(clientid() :: {client | clientid, string()} | {client | clientid, {re, regex()}}).
|
|
||||||
%%
|
|
||||||
%% -type(who() :: ipaddr() | ipaddrs() |username() | clientid() |
|
|
||||||
%% {'and', [ipaddr() | ipaddrs()| username() | clientid()]} |
|
|
||||||
%% {'or', [ipaddr() | ipaddrs()| username() | clientid()]} |
|
|
||||||
%% all).
|
|
||||||
%%
|
|
||||||
%% -type(action() :: subscribe | publish | all).
|
|
||||||
%%
|
|
||||||
%% -type(topic_filters() :: string()).
|
|
||||||
%%
|
|
||||||
%% -type(topics() :: [topic_filters() | {eq, topic_filters()}]).
|
|
||||||
%%
|
|
||||||
%% -type(permission() :: allow | deny).
|
|
||||||
%%
|
|
||||||
%% -type(rule() :: {permission(), who(), access(), topics()} | {permission(), all}).
|
|
||||||
%%--------------------------------------------------------------------
|
|
||||||
|
|
||||||
{allow, {username, {re, "^dashboard$"}}, subscribe, ["$SYS/#"]}.
|
|
||||||
|
|
||||||
{allow, {ipaddr, "127.0.0.1"}, all, ["$SYS/#", "#"]}.
|
|
||||||
|
|
||||||
{deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
|
|
||||||
|
|
||||||
{allow, all}.
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
## NOTE:
|
|
||||||
## This config file overrides data/configs/cluster.hocon,
|
|
||||||
## and is merged with environment variables which start with 'EMQX_' prefix.
|
|
||||||
##
|
|
||||||
## Config changes made from EMQX dashboard UI, management HTTP API, or CLI
|
|
||||||
## are stored in data/configs/cluster.hocon.
|
|
||||||
## To avoid confusion, please do not store the same configs in both files.
|
|
||||||
##
|
|
||||||
## See https://docs.emqx.com/en/enterprise/v5.0/configuration/configuration.html
|
|
||||||
## Configuration full example can be found in emqx.conf.example
|
|
||||||
|
|
||||||
node {
|
|
||||||
name = "emqx@177.7.0.12"
|
|
||||||
cookie = "emqxsecretcookie"
|
|
||||||
data_dir = "data"
|
|
||||||
}
|
|
||||||
|
|
||||||
cluster {
|
|
||||||
name = emqxcl
|
|
||||||
discovery_strategy = manual
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dashboard {
|
|
||||||
listeners.http {
|
|
||||||
bind = 18083
|
|
||||||
}
|
|
||||||
default_username = "admin"
|
|
||||||
default_password = "admin123"
|
|
||||||
}
|
|
||||||
|
|
||||||
authorization {
|
|
||||||
deny_action = ignore
|
|
||||||
no_match = allow
|
|
||||||
cache = { enable = true }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
## http 认证
|
|
||||||
authentication = [
|
|
||||||
{
|
|
||||||
mechanism = password_based
|
|
||||||
backend = http
|
|
||||||
enable = true
|
|
||||||
method = post
|
|
||||||
url = "http://java:8080/iot/tool/mqtt/authv5"
|
|
||||||
body {
|
|
||||||
clientid = "${clientid}"
|
|
||||||
username = "${username}"
|
|
||||||
password = "${password}"
|
|
||||||
peerhost = "${peerhost}"
|
|
||||||
}
|
|
||||||
headers {
|
|
||||||
"Content-Type" = "application/json"
|
|
||||||
"X-Request-Source" = "EMQX"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
# WebHook(匹配上线和下线规则后触发)
|
|
||||||
bridges {
|
|
||||||
webhook.fastbee_hook =
|
|
||||||
{
|
|
||||||
enable = true
|
|
||||||
connect_timeout = 15s
|
|
||||||
retry_interval = 60s
|
|
||||||
pool_type = random
|
|
||||||
pool_size = 8
|
|
||||||
enable_pipelining = 100
|
|
||||||
max_retries = 2
|
|
||||||
request_timeout = 15s
|
|
||||||
method = post
|
|
||||||
url = "http://java:8080/iot/tool/mqtt/webhookv5"
|
|
||||||
body = "{\"clientid\" : \"${clientid}\",\"event\" : \"${event}\",\"peername\" : \"${peername}\"}"
|
|
||||||
headers = { accept = "application/json" "cache-control" = "no-cache" connection = "keep-alive" "content-type" = "application/json" "keep-alive" = "timeout=5"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# 规则(处理上线和下线)
|
|
||||||
rule_engine {
|
|
||||||
ignore_sys_message = true
|
|
||||||
jq_function_default_timeout = 10s
|
|
||||||
rules.fastbee_rule =
|
|
||||||
{
|
|
||||||
sql = "SELECT * FROM \"t/#\",\"$events/client_connected\", \"$events/client_disconnected\", \"$events/session_subscribed\""
|
|
||||||
actions = ["webhook:fastbee_hook"]
|
|
||||||
enable = true
|
|
||||||
description = "处理设备上下线和订阅完主题的规则"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |