Merge remote-tracking branch 'origin/master' into version1.2

This commit is contained in:
kerwincui
2022-05-30 14:14:49 +08:00
20 changed files with 2787 additions and 51 deletions

View File

@@ -0,0 +1,95 @@
version: '1.0'
name: pipeline-docker
displayName: 构建镜像
triggers:
trigger: auto
push:
branches:
precise:
- master
commitMessages:
include:
- ^deploy-docker
stages:
- name: stage-5ecf171c
displayName: 项目打包
strategy: naturally
trigger: auto
executor:
- kerwincui
steps:
- step: build@maven
name: build_maven
displayName: Maven 构建后端
jdkVersion: '8'
mavenVersion: 3.6.1
commands:
- cd ./springboot
- mvn -B clean package -Dmaven.test.skip=true
artifacts:
- name: BUILD_JAVA
path:
- ./springboot/wumei-admin/target/wumei-admin.jar
settings: []
strategy:
retry: '0'
- step: build@nodejs
name: build_nodejs
displayName: Nodejs 构建前端
nodeVersion: 14.16.0
commands:
- cd ./vue
- npm install --registry=https://registry.npm.taobao.org \
- '&& rm -rf ./dist && npm run build:prod'
artifacts:
- name: BUILD_VUE
path:
- ./vue/dist
strategy:
retry: '0'
- name: stage-f5631c9e
displayName: 上传打包文件
strategy: naturally
trigger: auto
executor:
- kerwincui
steps:
- step: publish@general_artifacts
name: publish_general_artifacts_java
displayName: 上传后端制品
dependArtifact: BUILD_JAVA
artifactName: springboot
strategy:
retry: '0'
- step: publish@general_artifacts
name: publish_general_artifacts_vue
displayName: 上传前端制品
dependArtifact: BUILD_VUE
artifactName: vue
strategy:
retry: '0'
- name: stage-59a550ac
displayName: 构建镜像
strategy: naturally
trigger: auto
executor:
- kerwincui
steps:
- step: build@docker
name: build_docker
displayName: 镜像构建
type: cert
certificate: kerwincui-docker
tag: kerwincui/wumei-smart:1.01
dockerfile: ./docker/Dockerfile
context: ./docker
artifacts:
- ${BUILD_JAVA}
- ${BUILD_VUE}
isCache: true
strategy:
retry: '0'
permissions:
- role: admin
members:
- kerwincui

View File

@@ -0,0 +1,64 @@
version: '1.0'
name: pipeline-java
displayName: 部署后端
triggers:
trigger: auto
push:
branches:
precise:
- master
commitMessages:
include:
- ^deploy-server
stages:
- name: stage-2c3f9607
displayName: 构建后端
strategy: naturally
trigger: auto
executor:
- kerwincui
steps:
- step: build@maven
name: build_maven
displayName: Maven 构建
jdkVersion: '8'
mavenVersion: 3.6.1
commands:
- cd ./springboot
- mvn -B clean package -Dmaven.test.skip=true
artifacts:
- name: BUILD_JAVA
path:
- ./springboot/wumei-admin/target/wumei-admin.jar
settings: []
strategy:
retry: '0'
- name: stage-b6625c4a
displayName: 部署后端
strategy: naturally
trigger: auto
executor:
- kerwincui
steps:
- step: deploy@agent
name: deploy_agent
displayName: 主机部署
hostGroupID: alicloud
deployArtifact:
- source: build
name: springboot
target: ~/gitee_go/deploy
dependArtifact: BUILD_JAVA
script: |-
# 请在此输入部署脚本如启动Java应用如下
# nohup java -jar test.jar > nohup.out &
echo 'Hello Gitee!'
touch springboot
strategy:
retry: '0'
strategy:
blocking: true
permissions:
- role: admin
members:
- kerwincui

View File

@@ -0,0 +1,60 @@
version: '1.0'
name: pipeline-vue
displayName: 部署前端
triggers:
trigger: auto
push:
branches:
precise:
- master
commitMessages:
include:
- ^deploy-vue
stages:
- name: stage-3761fd9a
displayName: 构建前端
strategy: naturally
trigger: auto
executor:
- kerwincui
steps:
- step: build@nodejs
name: build_nodejs
displayName: Nodejs 构建
nodeVersion: 14.16.0
commands:
- cd ./vue
- npm install --registry=https://registry.npm.taobao.org \
- '&& rm -rf ./dist && npm run build:prod'
artifacts:
- name: BUILD_VUE
path:
- ./vue/dist
strategy:
retry: '0'
- name: stage-79a96375
displayName: 部署前端
strategy: naturally
trigger: auto
executor:
- kerwincui
steps:
- step: deploy@agent
name: deploy_agent
displayName: 主机部署
hostGroupID: alicloud
deployArtifact:
- source: build
name: vue
target: ~/gitee_go/deploy
dependArtifact: BUILD_VUE
script: |-
# 请在此输入部署脚本如启动Java应用如下
# nohup java -jar test.jar > nohup.out &
echo 'Hello Gitee!' && touch vuetest
touch vue
strategy:
retry: '0'
permissions:
- role: admin
members: []

View File

@@ -6,7 +6,7 @@
#### 2. 设备接入使用EMQX消息服务器加密认证后端采用Spring boot前端采用Vue移动端采用Uniapp数据库采用Mysql和Redis设备端支持ESP32、ESP8266、树莓派等系统架构图如下 #### 2. 设备接入使用EMQX消息服务器加密认证后端采用Spring boot前端采用Vue移动端采用Uniapp数据库采用Mysql和Redis设备端支持ESP32、ESP8266、树莓派等系统架构图如下
<img src="https://oscimg.oschina.net/oscnet/up-98eefff896394066a60d664b875a3d05d1d.png" max-width="800" /> <img src="https://oscimg.oschina.net/oscnet/up-98eefff896394066a60d664b875a3d05d1d.png" max-width="800" />
#### 3. 项目可用于个人学习和使用,商业用途需要赞助项目,获得授权。[查看详情 >>](https://gitee.com/kerwincui/wumei-smart/blob/master/app/README.md) #### 3. 项目可用于个人学习和使用,商业用途需要赞助项目,获得授权。[查看详情 >>](https://wumei.live/doc/pages/sponsor/)
#### 4. 案例展示 #### 4. 案例展示
| Wifi通断器 | 信息牌 | 桌面小电视 | 雾霾/粉尘/空气检测仪 | Wifi通断器 | 信息牌 | 桌面小电视 | 雾霾/粉尘/空气检测仪
@@ -59,7 +59,7 @@
&nbsp;&nbsp;&nbsp;&nbsp; vue ----------------------- 前端<br /> &nbsp;&nbsp;&nbsp;&nbsp; vue ----------------------- 前端<br />
&nbsp;&nbsp;&nbsp;&nbsp; docker -------------------- docker部署文件<br /> &nbsp;&nbsp;&nbsp;&nbsp; docker -------------------- docker部署文件<br />
&nbsp;&nbsp;&nbsp;&nbsp; sdk ----------------------- 硬件SDK<br /> &nbsp;&nbsp;&nbsp;&nbsp; sdk ----------------------- 硬件SDK<br />
&nbsp;&nbsp;&nbsp;&nbsp; app ----------------------- [获取App源码](https://gitee.com/kerwincui/wumei-smart/tree/master/app)<br /> &nbsp;&nbsp;&nbsp;&nbsp; app ----------------------- 移动端打包文件
###### 移动端适配多端 ###### 移动端适配多端
|安卓/Android|苹果/IOS|微信小程序| 网页/H5|Vue2.0 |安卓/Android|苹果/IOS|微信小程序| 网页/H5|Vue2.0
@@ -69,7 +69,7 @@
### 七、相关文档 ### 七、相关文档
##### 权限管理基于ruoyi-vue系统Mqtt消息服务器基于EMQX4.0开源版SDK示例使用ESP8266 Core For Arduino开发 ##### 权限管理基于ruoyi-vue系统Mqtt消息服务器基于EMQX4.0开源版SDK示例使用ESP8266 Core For Arduino开发
* [项目文档](http://wumei.live/kerwincui/document/wiki/) * [项目文档](https://wumei.live/doc/)
* [物美智能官网](http://wumei.live/) * [物美智能官网](http://wumei.live/)
* [权限管理系统ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue) * [权限管理系统ruoyi-vue](https://gitee.com/y_project/RuoYi-Vue)
* [Mqtt消息服务器EMQX4.0](https://github.com/emqx/emqx) * [Mqtt消息服务器EMQX4.0](https://github.com/emqx/emqx)

View File

@@ -1,33 +1,23 @@
#### 一、物美智能项目是开源的可用于个人学习商业使用请赞助该项目获得授权同时还提供了小程序、APP源码和相关教程。
#### 二、个人使用后面会提供免费线上托管;移动端开放接口,还可以对接自己使用系统搭建的平台。
#### 三、获取移动端源码、教程和授权的方式
1. 赞助项目赞助费暂定1500元
2. 参与项目贡献代码减免300-1500元
3. 推广项目减免10-1500元
#### 四、通过赞助、贡献代码、推广可以加入项目内部里面包含移动端源码和更多相关教程并且获得一年的免费更新。目前项目还在完善教程暂无赞助费暂定1500元。可以通过官网[http://wumei.live/](http://wumei.live/) 注册账号,联系作者加入项目内部。
##### 项目开发交流群【946029159】项目互助交流群【1073236354】作者QQ 【164770707】
<br /> <br />
#### 五、移动端介绍 * 项目可用于个人学习;商业使用请赞助该项目,获得授权;
* 赞助后还提供了小程序、APP源码和相关教程。[详情](https://wumei.live/doc/pages/sponsor/)
#### 移动端介绍
|安卓/Android|苹果/IOS|微信小程序| 网页/H5|Vue2.0 |安卓/Android|苹果/IOS|微信小程序| 网页/H5|Vue2.0
| :---: | :---: | :---: | :---: |:---: | | :---: | :---: | :---: | :---: |:---: |
| √ | √| √ | √ | √ | | √ | √| √ | √ | √ |
##### 介绍
1. 项目使用uniapp开发适配小程序、安卓、苹果和H5其他平台未测试。 1. 项目使用uniapp开发适配小程序、安卓、苹果和H5其他平台未测试。
2. UI框架使用uView2.0 2. UI框架使用uView2.0
3. 组件使用easycom模式只要组件安装在项目的components目录下或uni_modules目录下并符合components/组件名称/组件名称.vue目录结构。就可以不用引用、注册直接在页面中使用。 3. 组件使用easycom模式只要组件安装在项目的components目录下或uni_modules目录下并符合components/组件名称/组件名称.vue目录结构。就可以不用引用、注册直接在页面中使用。
4. 开发工具为Hbuilder3.3版本,版本不易过低。 4. 开发工具为Hbuilder3.3版本,版本不易过低。
##### 项目结构 ###### 项目结构
``` ```
├─apis // 接口管理 ├─apis // 接口管理

View File

@@ -12,45 +12,56 @@ ENV DB_USER root
ENV DB_PASSWORD admin ENV DB_PASSWORD admin
RUN apt-get update && \ RUN apt-get update && \
# 安装网络工具和设置时区 echo "1. 安装网络工具和设置时区 =====================" && \
apt-get install wget -y --no-install-recommends && \ apt-get install wget -y --no-install-recommends && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
# 更换国内源
echo "2. 更换国内源 =============================" && \
wget http://qiniu.xiwen.online/Debian10.list && \ wget http://qiniu.xiwen.online/Debian10.list && \
mv Debian10.list /etc/apt/sources.list && \ mv Debian10.list /etc/apt/sources.list && \
apt update && apt upgrade -y && \ apt update && apt upgrade -y && \
# 安装压缩工具
apt install zip -y && \ echo "3. 安装压缩工具 ============================" && \
# 安装nginx和redis apt install zip -y && \
echo "4. 安装nginx ==============================" && \
apt-get install nginx -y --no-install-recommends && \ apt-get install nginx -y --no-install-recommends && \
echo "5. 安装redis ===============================" && \
apt-get install redis-server -y --no-install-recommends && \ apt-get install redis-server -y --no-install-recommends && \
# 安装 emqx
apt update && apt install -y \ echo "6. 修改redis配置 =============================" && \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common && \
curl -fsSL https://repos.emqx.io/gpg.pub | apt-key add - && \
add-apt-repository \
"deb [arch=amd64] https://repos.emqx.io/emqx-ce/deb/ubuntu/ \
./bionic \
stable" && \
apt update && \
apt install emqx=4.0.0 -y --no-install-recommends && \
# 修改redis配置
sed -i "s/# requirepass foobared/requirepass wumei-smart/g" /etc/redis/redis.conf && \ sed -i "s/# requirepass foobared/requirepass wumei-smart/g" /etc/redis/redis.conf && \
sed -i "s/bind 127.0.0.1/# bind 127.0.0.1/g" /etc/redis/redis.conf sed -i "s/bind 127.0.0.1/# bind 127.0.0.1/g" /etc/redis/redis.conf
# echo "6. 安装 emqx =============================" && \
# apt update && apt install -y \
# apt-transport-https \
# ca-certificates \
# curl \
# gnupg-agent \
# software-properties-common && \
# echo "6.2 添加EMQX官方GPG秘钥 =============================" && \
# curl -fsSL https://repos.emqx.io/gpg.pub | apt-key add - && \
# echo "6.3 设置存储库 =============================" && \
# add-apt-repository \
# "deb [arch=amd64] https://repos.emqx.io/emqx-ce/deb/ubuntu/ \
# ./bionic \
# stable" && \
# echo "6.4 更新apt包索引 =============================" && \
# apt update && \
# echo "6.5 安装4.0版本 =============================" && \
# apt install emqx=4.0.0 -y --no-install-recommends
# 复制emqx和Nginx的配置文件 # 复制emqx和Nginx的配置文件
COPY ./emqx4.0/emqx.conf /etc/emqx/emqx.conf # COPY ./emqx4.0/emqx.conf /etc/emqx/emqx.conf
COPY ./emqx4.0/emqx_auth_http.conf /etc/emqx/plugins/emqx_auth_http.conf # COPY ./emqx4.0/emqx_auth_http.conf /etc/emqx/plugins/emqx_auth_http.conf
COPY ./emqx4.0/emqx_web_hook.conf /etc/emqx/plugins/emqx_web_hook.conf # COPY ./emqx4.0/emqx_web_hook.conf /etc/emqx/plugins/emqx_web_hook.conf
COPY ./emqx4.0/loaded_plugins /var/lib/emqx/loaded_plugins # COPY ./emqx4.0/loaded_plugins /var/lib/emqx/loaded_plugins
COPY ./nginx.conf /etc/nginx/nginx.conf COPY ./nginx.conf /etc/nginx/nginx.conf
# 拷贝前后端压缩文件到容器,容器内解压后删除
COPY ./wumei-smart.tar /var/
RUN cd /var && tar -xvf wumei-smart.tar && rm wumei-smart.tar # 解压前端和后端文件并放置到对应位置
# 启动脚本 # 启动脚本
COPY docker-entrypoint.sh / COPY docker-entrypoint.sh /

View File

@@ -0,0 +1,61 @@
FROM openjdk:8u322-jre-slim-buster
ENV VERSION 1.1
ENV AUTHOR kerwincui
ENV INFO wumei smart open source living iot platform
ENV SERVERS nginx:1.14.2, redis-server:5.0.14, emqx:4.0, openjdk:8u322-jre-slim-buster
# mysql环境变量
ENV DB_HOST localhost
ENV DB_NAME wumei
ENV DB_USER root
ENV DB_PASSWORD admin
RUN apt-get update && \
# 安装网络工具和设置时区
apt-get install wget -y --no-install-recommends && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
# 更换国内源
wget http://qiniu.xiwen.online/Debian10.list && \
mv Debian10.list /etc/apt/sources.list && \
apt update && apt upgrade -y && \
# 安装压缩工具
apt install zip -y && \
# 安装nginx和redis
apt-get install nginx -y --no-install-recommends && \
apt-get install redis-server -y --no-install-recommends && \
# 安装 emqx
apt update && apt install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common && \
curl -fsSL https://repos.emqx.io/gpg.pub | apt-key add - && \
add-apt-repository \
"deb [arch=amd64] https://repos.emqx.io/emqx-ce/deb/ubuntu/ \
./bionic \
stable" && \
apt update && \
apt install emqx=4.0.0 -y --no-install-recommends && \
# 修改redis配置
sed -i "s/# requirepass foobared/requirepass wumei-smart/g" /etc/redis/redis.conf && \
sed -i "s/bind 127.0.0.1/# bind 127.0.0.1/g" /etc/redis/redis.conf
# 复制emqx和Nginx的配置文件
COPY ./emqx4.0/emqx.conf /etc/emqx/emqx.conf
COPY ./emqx4.0/emqx_auth_http.conf /etc/emqx/plugins/emqx_auth_http.conf
COPY ./emqx4.0/emqx_web_hook.conf /etc/emqx/plugins/emqx_web_hook.conf
COPY ./emqx4.0/loaded_plugins /var/lib/emqx/loaded_plugins
COPY ./nginx.conf /etc/nginx/nginx.conf
# 拷贝前后端压缩文件到容器,容器内解压后删除
COPY ./wumei-smart.tar /var/
RUN cd /var && tar -xvf wumei-smart.tar && rm wumei-smart.tar
# 启动脚本
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
# 映射端口
EXPOSE 80 1883 8083

View File

@@ -0,0 +1,48 @@
# 服务启动
service nginx start
service redis-server start
service mysql start
emqx start
java -jar /var/wumei-smart/app.jar
# 镜像构建
docker build -t wumei-smart:1.0 .
# 复制文件到容器
docker cp wumei-smart/* container:/var/wumei-smart/
# 镜像导出导入
docker export container| docker import - kerwincui/wumei-smart:1.0
# 镜像推送
阿里云镜像registry.cn-chengdu.aliyuncs.com/kerwincui/wumei-smart:1.0
docker tag wumei-smart kerwincui/wumei-smart:1.0
docker push kerwinci/wumei-smart:1.0
# 容器运行
docker run \
--name wumei-smart \
--env DB_HOST=wumei.live:3306 \
--env DB_NAME=wumei-smart \
--env DB_USER=root \
--env DB_PASSWORD=wumei-smart \
--publish 80:80 \
--publish 1883:1883 \
--publish 8083:8083 \
--volume /var/wumei-smart/java/uploadPath:/var/wumei-smart/java/uploadPath \
--restart unless-stopped \
--detach \
kerwincui/wumei-smart:1.1
--publish 18083:18083 \
--publish 8084:8084 \
--publish 8883:8883 \
--publish 8081:8081 \
--publish 6379:6379 \
--publish 8080:8080 \
--volume /var/wumei-smart/java/logs:/var/wumei-smart/java/logs \
--volume /var/wumei-smart/nginx/nginx.conf:/etc/nginx/nginx.conf \
--volume /var/wumei-smart/nginx/error.log:/var/log/nginx/error.log \
--volume /var/wumei-smart/redis/redis.conf:/etc/redis/redis.conf \
--volume /var/wumei-smart/redis/redis-server.log:/var/log/redis/redis-server.log \
--volume /var/wumei-smart/emqx/emqx.conf:/etc/emqx/emqx.conf \
--volume /var/wumei-smart/emqx/log:/var/log/emqx \

View File

@@ -0,0 +1,32 @@
#!/bin/bash
# start service
startTime=$(date "+%Y-%m-%d %H:%M:%S")
echo $startTime : wumei-smart is starting, please waiting ...
# 提取jar包配置文件
cd /var/wumei-smart/java
unzip app.jar BOOT-INF/classes/application-druid.yml
# 修改mysql配置
sed -i "s/{DB_HOST}/$DB_HOST/g" BOOT-INF/classes/application-druid.yml
sed -i "s/{DB_NAME}/$DB_NAME/g" BOOT-INF/classes/application-druid.yml
sed -i "s/{DB_USER}/$DB_USER/g" BOOT-INF/classes/application-druid.yml
sed -i "s/{DB_PASSWORD}/$DB_PASSWORD/g" BOOT-INF/classes/application-druid.yml
# 配置文件写入jar包并删除提取的配置
zip app.jar BOOT-INF/classes/application-druid.yml
rm -rf BOOT-INF
service nginx start
service redis-server start
emqx start
java -jar /var/wumei-smart/java/app.jar
while true
do
time=$(date "+%Y-%m-%d %H:%M:%S")
echo $time : wumei-smart is running...
sleep 3600
done

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,133 @@
##--------------------------------------------------------------------
## 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://localhost: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

View File

@@ -0,0 +1,22 @@
web.hook.api.url = http://localhost: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"}

View File

@@ -0,0 +1,8 @@
{emqx_management,true}.
{emqx_recon,true}.
{emqx_retainer,true}.
{emqx_dashboard,true}.
{emqx_rule_engine,true}.
{emqx_bridge_mqtt,false}.
{emqx_auth_http,true}.
{emqx_web_hook,true}.

View File

@@ -0,0 +1,97 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 16 64K;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
server {
listen 80;
server_name localhost;
location / {
rewrite ^(.*) https://$server_name$1 permanent;
}
}
server {
# 侦听443端口
listen 443 ssl;
# 定义访问域名
server_name localhost;
#证书文件名称
ssl_certificate domain_bundle.crt;
#私钥文件名称
ssl_certificate_key domain.key;
#SSL-START SSL相关配置请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
ssl_session_timeout 10m;
#请按照以下协议配置
ssl_protocols TLSv1.2 TLSv1.3;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
# web端
location / {
root /var/wumei-smart/vue;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
# 服务端接口
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
# emqx接口
location /api/v4/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8081/api/v4/;
}
# wss连接
location /mqtt {
proxy_pass http://localhost:8083/mqtt;
proxy_read_timeout 90s;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade';
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

View File

@@ -0,0 +1,55 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 16 64K;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
server {
listen 80;
server_name localhost;
charset utf-8;
location / {
root /var/wumei-smart/vue;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
location /api/v4/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8081/api/v4/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

View File

@@ -241,7 +241,7 @@
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
<compilerArguments> <compilerArguments>
<!-- rt.jar和jce.jar中间的分隔符windows为“;”linux为“:” --> <!-- rt.jar和jce.jar中间的分隔符windows为“;”linux为“:” -->
<bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath> <bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
</compilerArguments> </compilerArguments>
</configuration> </configuration>
</plugin> </plugin>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="/var/wumei-smart/java/logs" /> <property name="log.path" value="/var/data/java/logs" />
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

View File

@@ -79,7 +79,7 @@ public class EmqxClient {
token.waitForCompletion(); token.waitForCompletion();
}catch (Exception e){ }catch (Exception e){
logger.error("=====>>>>>mqtt连接失败 message={}",e.getMessage()); logger.error("=====>>>>>mqtt连接失败 message={}",e.getMessage());
// e.printStackTrace(); e.printStackTrace();
} }
} }
} }
@@ -98,7 +98,7 @@ public class EmqxClient {
logger.debug("====>>>mqtt客户端启动成功"); logger.debug("====>>>mqtt客户端启动成功");
}catch (MqttException e){ }catch (MqttException e){
logger.error("mqtt客户端连接错误 error={}",e.getMessage()); logger.error("mqtt客户端连接错误 error={}",e.getMessage());
// e.printStackTrace(); e.printStackTrace();
} }
} }
} }
@@ -132,7 +132,6 @@ public class EmqxClient {
token.waitForCompletion(); token.waitForCompletion();
}catch (MqttException e){ }catch (MqttException e){
logger.error("====>>>>断开mqtt连接发生错误 message={}",e.getMessage()); logger.error("====>>>>断开mqtt连接发生错误 message={}",e.getMessage());
throw new ServiceException("断开mqtt连接发生错误" + e.getMessage());
} }
} }
client = null; client = null;