【智慧物联网平台】安装部署教程——仙盟创梦IDE

一、部署前准备

1. 环境要求

  • 基础环境:JDK 1.8+、MySQL 5.7+/8.0、Maven 3.6+、Redis(用于缓存)、Node.js(用于前端构建,可选)。
  • 依赖服务:若需对接门禁、道闸等硬件设备,需确保设备网络可达(如通过局域网或网关接入)。

2. 源码获取

  • 从 Gitee 仓库克隆源码: bash

    复制代码
    git clone https://gitee.com/java110/MicroCommunityIot.git
    cd MicroCommunityIot

二、后端部署(Spring Boot 服务)

1. 配置数据库

  • 导入数据库脚本:仓库中 java110-db 模块包含数据库脚本,将其导入 MySQL 中:

    bash

    复制代码
    # 假设脚本路径为 java110-db/src/main/resources/sql/
    mysql -u 用户名 -p 数据库名 < java110-db/src/main/resources/sql/init.sql
  • 修改数据库配置:在 java110-boot 或各微服务模块的 application.yml 中配置数据库连接:

    yaml

    复制代码
    spring:
      datasource:
        url: jdbc:mysql://localhost:3306/hc_iot?useUnicode=true&characterEncoding=utf8
        username: 数据库用户名
        password: 数据库密码

2. 配置 Redis

  • 在服务配置文件中添加 Redis 连接信息(用于缓存和会话管理): yaml

    复制代码
    spring:
      redis:
        host: localhost
        port: 6379
        password: 你的Redis密码(若有)

3. 编译打包

  • 使用 Maven 编译整个项目(支持多模块打包): bash

    复制代码
    mvn clean package -Dmaven.test.skip=true
  • 打包后,可执行 Jar 包位于各模块的 target 目录下(如 java110-boot/target/java110-boot.jar)。

4. 启动服务

  • 直接运行 Jar 包(以 java110-boot 为例,其他服务类似):

    bash

    复制代码
    java -jar java110-boot/target/java110-boot.jar --spring.profiles.active=dev  # 指定环境(dev/test/prod)
  • 若为微服务架构(含 iot-eurekaiot-gateway 等),需按依赖顺序启动:先启动注册中心(iot-eureka),再启动网关(iot-gateway),最后启动业务服务(如 iot-accessControliot-barrier 等)。

三、前端部署(Vue/uni-app)

1. 编译前端项目

  • 仓库中 iot-h5(H5 界面)、iot-web(管理端)等模块为前端代码,需先安装依赖并打包:

    bash

    复制代码
    # 进入前端模块目录
    cd iot-web
    npm install  # 安装依赖
    npm run build  # 打包生成 dist 目录

2. 部署静态资源

  • 将打包后的 dist 目录部署到 Nginx 或 Apache 服务器:
    • 配置 Nginx 示例: nginx

      复制代码
      server {
        listen 80;
        server_name iot.example.com;  # 你的域名
        root /path/to/iot-web/dist;  # 前端打包目录
        index index.html;
      
        location / {
          try_files $uri $uri/ /index.html;  # 支持 Vue 路由
        }
      }

四、服务配置与验证

1. 关键配置调整

  • 接口地址 :前端需配置后端接口地址(如 iot-gateway 网关地址),确保与后端服务通信。
  • 设备对接
    • 门禁、道闸等设备需在系统中添加设备信息(IP 地址、端口、协议等),参考仓库中 iot-accessControliot-barrier 模块的说明。
    • 充电桩、智能表等设备需通过接口或协议(如 MQTT)与系统对接,具体可查看 iot-chargeiot-meter 模块的代码注释。

2. 验证部署结果

  • 访问管理端:通过 Nginx 配置的域名或服务器 IP + 端口访问前端页面(如 http://localhost:80),使用默认账号登录:
    • 运营账号:admin/admin
    • 物业账号:18909715555/123456
  • 检查服务状态:访问后端接口文档(默认路径 http://localhost:9999/doc-ui.html),验证接口是否正常响应。

五、其他注意事项

依赖服务

  • 确保 MySQL、Redis 服务正常运行,且网络通畅(防火墙需开放相关端口,如 3306、6379、8761 等)。
  • 若使用 Eureka 注册中心,需保证各服务能正常注册(默认地址 http://localhost:8761)。
  1. 日志与调试

    • 服务启动日志可通过 java -jar 命令的控制台输出查看,或配置日志文件路径(参考 logback.xml 配置)。
    • 若启动失败,检查端口冲突(如 netstat -tulpn | grep 9999)或数据库连接是否正确。
  2. 文档参考

    • 仓库中的 readme.mdCHNAGE_LOG.mdjava110-doc 模块可能包含更详细的部署步骤和接口说明,建议结合查阅。

阿雪技术观

在科技发展浪潮中,我们不妨积极投身技术共享。不满足于做受益者,更要主动担当贡献者。无论是分享代码、撰写技术博客,还是参与开源项目维护改进,每一个微小举动都可能蕴含推动技术进步的巨大能量。东方仙盟是汇聚力量的天地,我们携手在此探索硅基生命,为科技进步添砖加瓦。

Hey folks, in this wild tech - driven world, why not dive headfirst into the whole tech - sharing scene? Don't just be the one reaping all the benefits; step up and be a contributor too. Whether you're tossing out your code snippets, hammering out some tech blogs, or getting your hands dirty with maintaining and sprucing up open - source projects, every little thing you do might just end up being a massive force that pushes tech forward. And guess what? The Eastern FairyAlliance is this awesome place where we all come together. We're gonna team up and explore the whole silicon - based life thing, and in the process, we'll be fueling the growth of technology.

相关推荐
千千道3 小时前
利用keil +RASC给瑞萨RA8D1编译烧写程序
单片机·嵌入式硬件·mcu·物联网
小蕾Java3 小时前
PyCharm 软件使用各种问题 ,解决教程
ide·python·pycharm
周杰伦_Jay9 小时前
【Git操作详解】Git进行版本控制与管理,包括分支,提交,合并,标签、远程仓库查看
大数据·ide·git·科技·分类·github
小二·10 小时前
mac下解压jar包
ide·python·pycharm
YoungHong199216 小时前
一行配置解决claude code 2.0版本更新后 vscode 插件需要登录的问题
ide·vscode·编辑器
Blue桃之夭夭16 小时前
git和VScode
ide·git·vscode
苏州知芯传感21 小时前
物联网边缘节点中的MEMS传感器低功耗设计实战
物联网·mems
shimly1234561 天前
vscode 指定连接其它版本的 linux
ide·vscode·编辑器
TensorTinker1 天前
基于FireBeetle 2 ESP32-C5的智能植物光照系统——物联网农业实践
物联网
电子科技圈1 天前
芯科科技第三代无线SoC现已全面供货
嵌入式硬件·mcu·物联网·网络安全·智能家居·智能硬件·iot