系统部署
大约 1 分钟
系统部署
适用于无法使用 Docker 或需要精细控制的部署场景。
环境准备
1. 安装 JDK 8
# Ubuntu/Debian
sudo apt install openjdk-8-jre
# CentOS
sudo yum install java-1.8.0-openjdk2. 安装 MySQL 5.7+
# 创建数据库
mysql -uroot -p
CREATE DATABASE fastbee DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;3. 安装 Redis 7
# Ubuntu
sudo apt install redis-server
# 设置密码
# 编辑 /etc/redis/redis.conf,添加:
# requirepass your_password4. 安装 ZLMediaKit(可选)
如需视频监控功能,需单独部署 ZLMediaKit。参考 ZLMediaKit 官方文档。
部署后端
1. 获取源码
git clone https://gitee.com/beecue/fastbee.git
cd fastbee2. 导入数据库
mysql -uroot -p fastbee < springboot/sql/fastbee.sql3. 修改配置
编辑 springboot/fastbee-admin/src/main/resources/application-druid.yml。
spring:
datasource:
druid:
master:
url: jdbc:mysql://localhost:3306/fastbee?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: your_password
redis:
host: localhost
port: 6379
password: your_password4. 编译运行
cd springboot
mvn clean package -DskipTests
java -jar fastbee-admin/target/fastbee-admin.jar后端启动后:
- API 端口 8080
- MQTT TCP 1883
- MQTT WebSocket 8083
部署前端
1. 编译
cd vue
npm install
npm run build:prod2. 部署到 Nginx
将 vue/dist 目录内容复制到 Nginx 的 Web 根目录。
3. Nginx 配置
server {
listen 80;
server_name your_domain.com;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
location /prod-api/ {
proxy_pass http://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /mqtt/ {
proxy_pass http://localhost:8083/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}验证部署
- 浏览器访问
http://服务器IP - 使用
admin/admin123登录 - 确认 MQTT 端口 1883 可连接
多数据库支持
FastBee 支持多种关系型数据库,切换时需使用对应的 SQL 脚本。
| 数据库 | SQL 脚本路径 |
|---|---|
| MySQL | sql/fastbee.sql |
| PostgreSQL | sql/postgres/fastbee-v2.1.sql |
| SQL Server | sql/sqlserver/fastbee-v2.1.sql |
| Oracle | sql/oracle/fastbee-v2.1.sql |
| 达梦 | sql/dameng/fastbee-v2.1.sql |
切换数据库需同时修改 application-druid.yml 中的驱动和数据源配置。
