线上部署 ¶
我们建议蜂鸟(Hummingbrid)物联网平台所有服务都以docker形式运行。
独立部署 ¶
docker-compose.yml
文件内容如下
yaml
version: "3"
networks:
hummingbird:
driver: bridge
services:
mqtt-broker:
image: registry.cn-shanghai.aliyuncs.com/winc-link/mqtt-broker:v1.0
container_name: mqtt-broker
hostname: mqtt-broker
restart: always
ports:
- "127.0.0.1:58090:58090"
networks:
- hummingbird
ekuiper:
image: lfedge/ekuiper:1.10.0-slim
ports:
- "127.0.0.1:9081:9081"
container_name: ekuiper
hostname: ekuiper
restart: always
user: root
volumes:
- ./kuiper/data:/kuiper/data
- ./kuiper/log:/kuiper/log
environment:
MQTT_SOURCE__DEFAULT__SERVER: "tcp://mqtt-broker:58090"
KUIPER__BASIC__CONSOLELOG: "true"
KUIPER__BASIC__IGNORECASE: "false"
networks:
- hummingbird
hummingbird-core:
image: registry.cn-shanghai.aliyuncs.com/winc-link/hummingbird-core:v1.0
container_name: hummingbird-core
restart: always
hostname: hummingbird-core
ports:
- "3000:3000"
- "58081:58081"
depends_on:
- ekuiper
- mqtt-broker
volumes:
- ./:/var/bin/hummingbird
- /var/run/docker.sock:/var/run/docker.sock
networks:
- hummingbird
运行docker-compose up -d
命令启动所有服务。
配合nginx使用 ¶
如果你想要为您的服务配置域名,可以配合nginx一起使用。
nginx.conf内容如下
text
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 9;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json;
gzip_disable "MSIE [1-6]\.";
gzip_vary on;
map $http_upgrade $connection_upgrade {
default keep-alive; #默认为keep-alive 可以支持 一般http请求
'websocket' upgrade; #如果为websocket 则为 upgrade 可升级的。
}
server {
listen 80;
server_name 您的域名;
return 301 https://$host$request_uri;
}
# HTTPS server
server {
listen 443 ssl;
server_name 您的域名;
ssl_certificate 您的crt证书路径;
ssl_certificate_key 您的key证书路径;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://hummingbird-core:3000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location @router {
rewrite ^.*$ /index.html last;
}
}
}
docker-compose.yml
文件内容如下
yaml
version: "3"
networks:
hummingbird:
driver: bridge
services:
mqtt-broker:
image: registry.cn-shanghai.aliyuncs.com/winc-link/mqtt-broker:v1.0
container_name: mqtt-broker
hostname: mqtt-broker
restart: always
ports:
- "127.0.0.1:58090:58090"
networks:
- hummingbird
ekuiper:
image: lfedge/ekuiper:1.10.0-slim
ports:
- "127.0.0.1:9081:9081"
container_name: ekuiper
hostname: ekuiper
restart: always
user: root
volumes:
- ./kuiper/data:/kuiper/data
- ./kuiper/log:/kuiper/log
environment:
MQTT_SOURCE__DEFAULT__SERVER: "tcp://mqtt-broker:58090"
KUIPER__BASIC__CONSOLELOG: "true"
KUIPER__BASIC__IGNORECASE: "false"
networks:
- hummingbird
hummingbird-core:
image: registry.cn-shanghai.aliyuncs.com/winc-link/hummingbird-core:v1.0
container_name: hummingbird-core
restart: always
hostname: hummingbird-core
ports:
- "3000:3000"
- "58081:58081"
depends_on:
- ekuiper
- mqtt-broker
volumes:
- ./:/var/bin/hummingbird
- /var/run/docker.sock:/var/run/docker.sock
networks:
- hummingbird
nginx:
restart: always
container_name: nginx
image: nginx:1.18.0
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf/:/etc/nginx/nginx.conf
environment:
- NGINX_PORT=80
- TZ=Asia/Shanghai
networks:
- hummingbird