mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
添加docker相关文件
This commit is contained in:
@@ -4,21 +4,21 @@ ENV VERSION 1.1
|
||||
ENV AUTHOR kerwincui
|
||||
ENV INFO wumei smart open source living iot platform
|
||||
|
||||
# 安装工具和设置时区 apt install curl -y --no-install-recommends && \
|
||||
# 安装工具和设置时区 apt install curl -y --no-install-recommends && \ apt-get install vim -y --no-install-recommends && \
|
||||
RUN apt-get update && \
|
||||
apt-get install vim -y --no-install-recommends && \
|
||||
apt-get install wget -y --no-install-recommends && \
|
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
#更换国内源
|
||||
RUN wget http://qiniu.xiwen.online/Debian10.list && \
|
||||
mv Debian10.list /etc/apt/sources.list && \
|
||||
apt update && apt upgrade -y
|
||||
|
||||
# 安装nginx和redis,需要容器内配置nginx和redis
|
||||
# 安装nginx和redis
|
||||
RUN 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-transport-https \
|
||||
ca-certificates \
|
||||
@@ -31,7 +31,16 @@ RUN apt update && apt install -y \
|
||||
./bionic \
|
||||
stable" && \
|
||||
apt update && \
|
||||
apt install emqx -y --no-install-recommends
|
||||
apt install emqx=4.0.0 -y --no-install-recommends
|
||||
|
||||
# 修改redis配置
|
||||
RUN sed -i "s/# requirepass foobared/requirepass wumei/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 ./nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 挂载卷
|
||||
VOLUME /var/wumei-smart
|
||||
@@ -44,5 +53,5 @@ ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
COPY ./wumei-smart.tar /var/
|
||||
RUN cd /var && tar -xvf wumei-smart.tar && rm wumei-smart.tar
|
||||
|
||||
# 映射端口
|
||||
EXPOSE 80 3306 1883 18083
|
||||
# 映射端口,可选:8081、8883、18083、8083
|
||||
EXPOSE 80 1883 8083
|
||||
@@ -42,23 +42,6 @@ kerwincui/wumei-smart:1.0
|
||||
|
||||
|
||||
########################容器内处理##########################
|
||||
# 安装mysql
|
||||
### wget http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb && \
|
||||
apt install ./mysql-apt-config_0.8.13-1_all.deb && \
|
||||
apt update && \
|
||||
apt install mysql-server -y
|
||||
### service mysql start
|
||||
### mysql_secure_installation
|
||||
# 配置远程访问
|
||||
### vim /etc/mysql/mysql.conf.d/mysqld.cnf ,注释bind-address
|
||||
### 本地登录mysql并更新用户host,并刷新
|
||||
### update mysql.user set host='%' where user='root'; flush privileges;
|
||||
# 查看mysql字符集编码
|
||||
### show variables like 'character%';
|
||||
# 修改编码
|
||||
### vim /etc/mysql/mysql.conf.d/mysqld.cnf ,增加character-set-server=utf8
|
||||
### vim /etc/mysql/conf.d/mysql.cnf ,增加default-character-set=utf8
|
||||
# 导入sql文件
|
||||
|
||||
# 配置redis
|
||||
# vim /etc/redis/redis.conf ,取消注释requirepass admin123,注释 bind:127.0.0.1
|
||||
|
||||
2061
docker/emqx4.0/emqx.conf
Normal file
2061
docker/emqx4.0/emqx.conf
Normal file
File diff suppressed because it is too large
Load Diff
133
docker/emqx4.0/emqx_auth_http.conf
Normal file
133
docker/emqx4.0/emqx_auth_http.conf
Normal 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/certs/ca.pem
|
||||
|
||||
## The path to a file containing the client's certificate.
|
||||
##
|
||||
## Value: File
|
||||
## auth.http.ssl.certfile = etc/certs/client-cert.pem
|
||||
|
||||
## Path to a file containing the client's private PEM-encoded key.
|
||||
##
|
||||
## Value: File
|
||||
## auth.http.ssl.keyfile = etc/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
|
||||
22
docker/emqx4.0/emqx_web_hook.conf
Normal file
22
docker/emqx4.0/emqx_web_hook.conf
Normal 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"}
|
||||
47
docker/nginx.conf
Normal file
47
docker/nginx.conf
Normal file
@@ -0,0 +1,47 @@
|
||||
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/data/wumei/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;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
document/message.png
Normal file
BIN
document/message.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
Reference in New Issue
Block a user