Merge remote-tracking branch 'origin/master'

# Conflicts:
#	springboot/wumei-admin/src/main/resources/application.yml
This commit is contained in:
guanshubiao
2022-03-22 23:53:35 +08:00
17 changed files with 117 additions and 131 deletions

View File

@@ -1,10 +1,10 @@
### 一、项目简介 ### 一、项目简介
1. 物美智能 [wumei-smart](http://wumei.live/) 是一个简单易用的生活物联网平台。可用于搭建物联网平台以及二次开发和学习。 ###### 1. 物美智能 [wumei-smart](http://wumei.live/) 是一个简单易用的生活物联网平台。可用于搭建物联网平台以及二次开发和学习。
2. 设备接入使用EMQX消息服务器认证采用EMQX内置的Http插件对称加密认证。后端采用Spring boot前端采用Vue移动端采用Uniapp数据库采用Mysql、Redis和TDengine设备端支持硬件SDK生成例如ESP32、ESP8266、树莓派等设备模拟器采用Android和WPF框架不仅能模拟硬件设备还可以控制和监测电脑、手机。系统架构图如下 ###### 2. 设备接入使用EMQX消息服务器认证采用EMQX内置的Http插件对称加密认证。后端采用Spring boot前端采用Vue移动端采用Uniapp数据库采用Mysql、Redis和TDengine设备端支持硬件SDK生成例如ESP32、ESP8266、树莓派等设备模拟器采用Android和WPF框架不仅能模拟硬件设备还可以控制和监测电脑、手机。系统架构图如下
![系统架构图](https://gitee.com/kerwincui/wumei-smart/raw/master/document/sys.png) <img src="https://gitee.com/kerwincui/wumei-smart/raw/master/document/sys.png" width="800" />
### 二、功能 ### 二、功能

View File

@@ -1,25 +1,31 @@
FROM openjdk:8u322-jre-buster FROM openjdk:8u322-jre-slim-buster
ENV VERSION 1.1 ENV VERSION 1.1
ENV AUTHOR kerwincui ENV AUTHOR kerwincui
ENV INFO wumei smart open source living iot platform 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
# 安装工具和设置时区 apt install curl -y --no-install-recommends && \ apt-get install vim -y --no-install-recommends && \
RUN apt-get update && \ RUN apt-get update && \
# 安装网络工具和设置时区
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 && \
# 更换国内源
#更换国内源 wget http://qiniu.xiwen.online/Debian10.list && \
RUN 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 && \
# 安装压缩工具
# 安装nginx和redis apt install zip -y && \
RUN apt-get install nginx -y --no-install-recommends && \ # 安装nginx和redis
apt-get install redis-server -y --no-install-recommends apt-get install nginx -y --no-install-recommends && \
apt-get install redis-server -y --no-install-recommends && \
# 安装 emqx # 安装 emqx
RUN apt update && apt install -y \ apt update && apt install -y \
apt-transport-https \ apt-transport-https \
ca-certificates \ ca-certificates \
curl \ curl \
@@ -31,27 +37,25 @@ RUN apt update && apt install -y \
./bionic \ ./bionic \
stable" && \ stable" && \
apt update && \ apt update && \
apt install emqx=4.0.0 -y --no-install-recommends apt install emqx=4.0.0 -y --no-install-recommends && \
# 修改redis配置
# 修改redis配置 sed -i "s/# requirepass foobared/requirepass wumei-smart/g" /etc/redis/redis.conf && \
RUN sed -i "s/# requirepass foobared/requirepass wumei/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的配置文件 # 复制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 ./nginx.conf /etc/nginx/nginx.conf COPY ./nginx.conf /etc/nginx/nginx.conf
# 拷贝前后端压缩文件到容器,容器内解压后删除
# 挂载卷 COPY ./wumei-smart.tar /var/
VOLUME /var/wumei-smart RUN cd /var && tar -xvf wumei-smart.tar && rm wumei-smart.tar
# 启动脚本 # 启动脚本
COPY docker-entrypoint.sh / COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"] ENTRYPOINT ["/docker-entrypoint.sh"]
# 拷贝前后端压缩文件到容器,容器内解压后删除 # 映射端口
COPY ./wumei-smart.tar /var/
RUN cd /var && tar -xvf wumei-smart.tar && rm wumei-smart.tar
# 映射端口可选8081、8883、18083、8083
EXPOSE 80 1883 8083 EXPOSE 80 1883 8083

View File

@@ -19,66 +19,30 @@ docker push kerwinci/wumei-smart:1.0
# 容器运行 # 容器运行
docker run \ docker run \
--name wumei-smart \ --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 80:80 \
--publish 18083:18083 \
--publish 1883:1883 \ --publish 1883:1883 \
--publish 3306:3306 \ --publish 8083:8083 \
--publish 6379:6379 \ --volume /var/wumei-smart/java/uploadPath:/var/wumei-smart/java/uploadPath \
--restart always \ --restart unless-stopped \
--detach \ --detach \
kerwincui/wumei-smart:1.0 kerwincui/wumei-smart:1.1
docker run ^ --publish 18083:18083 \
--name wumei-smart ^ --publish 8084:8084 \
--publish 80:80 ^ --publish 8883:8883 \
--publish 18083:18083 ^ --publish 8081:8081 \
--publish 1883:1883 ^ --publish 6379:6379 \
--publish 3306:3306 ^ --publish 8080:8080 \
--publish 6379:6379 ^
--restart always ^
--detach ^
kerwincui/wumei-smart:1.0
--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 \
########################容器内处理##########################
# 配置redis
# vim /etc/redis/redis.conf 取消注释requirepass admin123注释 bind:127.0.0.1
# 配置docker-entrypoint.sh
# vim /docker-entrypoint.sh 启动mysql和java app
# 配置nginx
# vim /etc/nginx/nginx.confnginx服务配置
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
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/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

View File

@@ -2,12 +2,24 @@
# start service # start service
startTime=$(date "+%Y-%m-%d %H:%M:%S") startTime=$(date "+%Y-%m-%d %H:%M:%S")
echo $startTime : wumei-smart is starting... 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 nginx start
service redis-server start service redis-server start
emqx start emqx start
#java -jar /var/wumei-smart/java/app.jar java -jar /var/wumei-smart/java/app.jar
while true while true

View File

@@ -127,18 +127,18 @@ cluster.autoclean = 5m
## Path to a file containing the client's private PEM-encoded key. ## Path to a file containing the client's private PEM-encoded key.
## ##
## Value: File ## Value: File
## cluster.etcd.ssl.keyfile = etc/certs/client-key.pem ## cluster.etcd.ssl.keyfile = /etc/emqx/certs/client-key.pem
## The path to a file containing the client's certificate. ## The path to a file containing the client's certificate.
## ##
## Value: File ## Value: File
## cluster.etcd.ssl.certfile = etc/certs/client.pem ## cluster.etcd.ssl.certfile = /etc/emqx/certs/client.pem
## Path to the file containing PEM-encoded CA certificates. The CA certificates ## Path to the file containing PEM-encoded CA certificates. The CA certificates
## are used during server authentication and when building the client certificate chain. ## are used during server authentication and when building the client certificate chain.
## ##
## Value: File ## Value: File
## cluster.etcd.ssl.cacertfile = etc/certs/ca.pem ## cluster.etcd.ssl.cacertfile = /etc/emqx/certs/ca.pem
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Cluster using Kubernates ## Cluster using Kubernates
@@ -194,7 +194,7 @@ node.cookie = emqxsecretcookie
## Data dir for the node ## Data dir for the node
## ##
## Value: Folder ## Value: Folder
node.data_dir = data node.data_dir = /var/lib/emqx
## Heartbeat monitoring of an Erlang runtime system. Comment the line to disable ## Heartbeat monitoring of an Erlang runtime system. Comment the line to disable
## heartbeat, or set the value as 'on' ## heartbeat, or set the value as 'on'
@@ -259,14 +259,14 @@ node.fullsweep_after = 1000
## Crash dump log file. ## Crash dump log file.
## ##
## Value: Log file ## Value: Log file
node.crash_dump = log/crash.dump node.crash_dump = /var/log/emqx/crash.dump
## Specify SSL Options in the file if using SSL for Erlang Distribution. ## Specify SSL Options in the file if using SSL for Erlang Distribution.
## ##
## Value: File ## Value: File
## ##
## vm.args: -ssl_dist_optfile <File> ## vm.args: -ssl_dist_optfile <File>
## node.ssl_dist_optfile = etc/ssl_dist.conf ## node.ssl_dist_optfile = /etc/emqx/ssl_dist.conf
## Sets the net_kernel tick time. TickTime is specified in seconds. ## Sets the net_kernel tick time. TickTime is specified in seconds.
## Notice that all communicating nodes are to have the same TickTime ## Notice that all communicating nodes are to have the same TickTime
@@ -397,7 +397,7 @@ log.level = warning
## The dir for log files. ## The dir for log files.
## ##
## Value: Folder ## Value: Folder
log.dir = log log.dir = /var/log/emqx
## The log filename for logs of level specified in "log.level". ## The log filename for logs of level specified in "log.level".
## ##
@@ -454,7 +454,7 @@ acl_nomatch = allow
## Default ACL File. ## Default ACL File.
## ##
## Value: File Name ## Value: File Name
acl_file = etc/acl.conf acl_file = /etc/emqx/acl.conf
## Whether to enable ACL cache. ## Whether to enable ACL cache.
## ##
@@ -1167,20 +1167,20 @@ listener.ssl.external.handshake_timeout = 15s
## See: http://erlang.org/doc/man/ssl.html ## See: http://erlang.org/doc/man/ssl.html
## ##
## Value: File ## Value: File
listener.ssl.external.keyfile = etc/certs/key.pem listener.ssl.external.keyfile = /etc/emqx/certs/key.pem
## Path to a file containing the user certificate. ## Path to a file containing the user certificate.
## ##
## See: http://erlang.org/doc/man/ssl.html ## See: http://erlang.org/doc/man/ssl.html
## ##
## Value: File ## Value: File
listener.ssl.external.certfile = etc/certs/cert.pem listener.ssl.external.certfile = /etc/emqx/certs/cert.pem
## Path to the file containing PEM-encoded CA certificates. The CA certificates ## Path to the file containing PEM-encoded CA certificates. The CA certificates
## are used during server authentication and when building the client certificate chain. ## are used during server authentication and when building the client certificate chain.
## ##
## Value: File ## Value: File
## listener.ssl.external.cacertfile = etc/certs/cacert.pem ## listener.ssl.external.cacertfile = /etc/emqx/certs/cacert.pem
## The Ephemeral Diffie-Helman key exchange is a very effective way of ## The Ephemeral Diffie-Helman key exchange is a very effective way of
## ensuring Forward Secrecy by exchanging a set of keys that never hit ## ensuring Forward Secrecy by exchanging a set of keys that never hit
@@ -1197,7 +1197,7 @@ listener.ssl.external.certfile = etc/certs/cert.pem
## openssl dhparam -out dh-params.pem 2048 ## openssl dhparam -out dh-params.pem 2048
## ##
## Value: File ## Value: File
## listener.ssl.external.dhfile = etc/certs/dh-params.pem ## listener.ssl.external.dhfile = /etc/emqx/certs/dh-params.pem
## A server only does x509-path validation in mode verify_peer, ## A server only does x509-path validation in mode verify_peer,
## as it then sends a certificate request to the client (this ## as it then sends a certificate request to the client (this
@@ -1640,26 +1640,26 @@ listener.wss.external.verify_protocol_header = on
## See: listener.ssl.$name.keyfile ## See: listener.ssl.$name.keyfile
## ##
## Value: File ## Value: File
listener.wss.external.keyfile = etc/certs/key.pem listener.wss.external.keyfile = /etc/emqx/certs/key.pem
## Path to a file containing the user certificate. ## Path to a file containing the user certificate.
## ##
## See: listener.ssl.$name.certfile ## See: listener.ssl.$name.certfile
## ##
## Value: File ## Value: File
listener.wss.external.certfile = etc/certs/cert.pem listener.wss.external.certfile = /etc/emqx/certs/cert.pem
## Path to the file containing PEM-encoded CA certificates. ## Path to the file containing PEM-encoded CA certificates.
## ##
## See: listener.ssl.$name.cacert ## See: listener.ssl.$name.cacert
## ##
## Value: File ## Value: File
## listener.wss.external.cacertfile = etc/certs/cacert.pem ## listener.wss.external.cacertfile = /etc/emqx/certs/cacert.pem
## See: listener.ssl.$name.dhfile ## See: listener.ssl.$name.dhfile
## ##
## Value: File ## Value: File
## listener.ssl.external.dhfile = etc/certs/dh-params.pem ## listener.ssl.external.dhfile = /etc/emqx/certs/dh-params.pem
## See: listener.ssl.$name.vefify ## See: listener.ssl.$name.vefify
## ##
@@ -1871,15 +1871,15 @@ module.rewrite = off
## The etc dir for plugins' config. ## The etc dir for plugins' config.
## ##
## Value: Folder ## Value: Folder
plugins.etc_dir = etc/plugins/ plugins.etc_dir = /etc/emqx/plugins/
## The file to store loaded plugin names. ## The file to store loaded plugin names.
## ##
## Value: File ## Value: File
plugins.loaded_file = data/loaded_plugins plugins.loaded_file = /var/lib/emqx/loaded_plugins
## File to store loaded plugin names. ## File to store loaded plugin names.
plugins.expand_plugins_dir = plugins/ plugins.expand_plugins_dir = /var/lib/emqx/plugins/
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## Broker ## Broker

View File

@@ -10,17 +10,17 @@
## are used during server authentication and when building the client certificate chain. ## are used during server authentication and when building the client certificate chain.
## ##
## Value: File ## Value: File
## auth.http.ssl.cacertfile = etc/certs/ca.pem ## auth.http.ssl.cacertfile = /etc/emqx/certs/ca.pem
## The path to a file containing the client's certificate. ## The path to a file containing the client's certificate.
## ##
## Value: File ## Value: File
## auth.http.ssl.certfile = etc/certs/client-cert.pem ## auth.http.ssl.certfile = /etc/emqx/certs/client-cert.pem
## Path to a file containing the client's private PEM-encoded key. ## Path to a file containing the client's private PEM-encoded key.
## ##
## Value: File ## Value: File
## auth.http.ssl.keyfile = etc/certs/client-key.pem ## auth.http.ssl.keyfile = /etc/emqx/certs/client-key.pem
##-------------------------------------------------------------------- ##--------------------------------------------------------------------
## HTTP Request Headers ## HTTP Request Headers

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

@@ -26,7 +26,7 @@ http {
charset utf-8; charset utf-8;
location / { location / {
root /var/data/wumei/vue; root /var/wumei-smart/vue;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
index index.html index.htm; index index.html index.htm;
} }
@@ -37,7 +37,15 @@ http {
proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/; 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; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html {

BIN
document/integrated.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -43,8 +43,8 @@ spring:
allow: allow:
url-pattern: /druid/* url-pattern: /druid/*
# 控制台管理用户名和密码 # 控制台管理用户名和密码
login-username: admin login-username: wumei-smart
login-password: admin123 login-password: wumei-smart
filter: filter:
stat: stat:
enabled: true enabled: true

View File

@@ -8,8 +8,8 @@ ruoyi:
copyrightYear: 2021 copyrightYear: 2021
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/wumei/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/wumei-smart/uploadPathLinux配置 /var/wumei-smart/java/uploadPath
profile: D:\project\github\wumei-smart\springboot\uploadpath profile: /var/wumei-smart/java/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: true addressEnabled: true
# 验证码类型 math 数组计算 char 字符验证 # 验证码类型 math 数组计算 char 字符验证
@@ -87,16 +87,6 @@ spring:
default-topic: test # 默认主题 default-topic: test # 默认主题
timeout: 60000 # 超时时间 timeout: 60000 # 超时时间
keepalive: 30 # 保持连接 keepalive: 30 # 保持连接
clearSession: false
isShared: false
isSharedGroup: false
task:
execution:
pool:
core-size: 10 #最小连接数
max-size: 20 #最大连接数
queue-capacity: 25 #设置队列容量为2000个
# token配置 # token配置
token: token:

View File

@@ -571,7 +571,7 @@ export default {
name: this.monitorThings[i].name, name: this.monitorThings[i].name,
type: 'line', type: 'line',
showSymbol: false, showSymbol: false,
data: this.dataList[i].data data: []
}] }]
}; };
option && this.chart[i].setOption(option); option && this.chart[i].setOption(option);