iThings is an open source cloud-native IoT platform based on EMQ X + TDengine + React

Introduction to iThings

iThings is a lightweight cloud-native microservice IoT platform developed based on golang. It is written in golang and uses high-performance components (emqx, nats, tdengine). It is based on the go-zero microservice framework while ensuring high performance and service stability. ; A set of code supports k8s, docker, micro-service and monomer mode deployment at the same time, which is convenient for business switching from monomer to micro-service; one-click installation of all dependencies, one-click operation of iThings, easy deployment; it can be deployed through http, grpc, or even Directly integrate iThings into the enterprise business system as a package.

eef3e236f5c3b8b3fe521dcab27915f2.png

▌Product Architecture

The iThings IoT platform provides a universal access and management platform across different devices and data sources, and plays an intermediary role in the entire IoT architecture, linking all interactions between the perception layer and the application layer: downward connection, management The networked device side completes the collection and storage of sensing data, and provides application developers and system integrators with a unified data interface and common module tools for application development.

Application manufacturers can quickly integrate into their own systems by introducing http, grpc, and golang packages, and quickly obtain the capabilities of the IoT platform, which is lightweight and efficient.

5c5056d2da583be29998716cb1d3b706.png

▌Platform value

  • Strong ability to expand

    The development of the company has different stages, and the application scenarios also have different needs. iThings supports both monolithic and microservices so that developers do not need to maintain two sets of codes. At the same time, when the monolith is not enough to meet the needs of the company, it can also be easily switched to the microservice architecture.

  • high performance

    Developed with golang, there are few third-party services that depend on it, and it can even be deployed on low-performance arm for scenarios with low performance requirements

  • data value

    With privatized deployment, all data can be managed by yourself, so you don’t have to worry about public cloud suspension and high fees

  • Solution base

    It can be used as a digital base for industry solutions, supports multi-industry solutions to share the same IoT platform base, and accumulates more industry experience and product solutions for enterprises.

▌Product function

Device access: Massive device connections can be realized through industry standard IoT protocols (MQTT, CoAP and HTTP), and custom protocols can also be accessed through the rule engine.

Remote control: Using the http api can realize the precise control of the server on the device and the device actively sends request notifications to the server.

Object model: Support standard object model to effectively manage device attributes, events and behaviors.

RBAC permission: permission control adopts RBAC, role-based access control. Complete package of basic authority functions such as users, roles, and menus.

Application support: Provide http, grpc or golang to directly import packages to transfer data flow to the business level, shielding the complex features of the IoT level, allowing enterprises to focus on business application development, shortening the time-to-market of IoT solutions, and saving a lot of money for enterprises Development time and costs.

Flexible deployment: private cloud, public cloud, edge deployment.

Rapid development and maintenance: Provide device cloud debugging logs, device local logs, and online device debugging for rapid development and debugging problems.

▌Technology stack

Backend technology stack

  • Microservice framework: go-zero

  • High performance cache: redis

  • High performance message queue: nats

  • Relational database: mysql

  • Microservice registration center (monolithic may not be used): etcd

  • Cloud-native lightweight object storage: minio

  • Open source, high performance, cloud native, minimalist time series data processing platform: TDengine

  • Large-scale elastically scalable cloud-native distributed IoT MQTT message server: EMQX

Front-end technology stack

  • JavaScript library for building user interfaces: react

  • Enterprise design components: ant design

  • A set of high-quality and reliable React Hooks library: ahooks

Console interface display

product management

093815e3ec617d80e38e773099e5adcb.png

animal model

159698d63c22ec4935b9e2790a8eec77.png

device management

796b0421d048c3bee04a76a3edc5ac0a.png

log service

9da733be66f031b947711b93de64044b.png

API interface management

086ff7471878ab937a1852576ab249ee.png

operational audit

633ff93abec7042d7ee87841867a1743.png

Local Deployment & Online Experience

Code structure:

- deploy #部署时 相关配置
  - conf
    - emqx #mtqq组件 相关配置
      - data
        - loaded_plugins
      - etc
        - plugins
          - emqx.conf #mtqq组件 主要服务配置文件
          - emqx_auth_http.conf #mtqq组件 鉴权服务配置文件
    - ithings #本项目服务 相关配置
      - apisvr
        - etc #部署时 各服务 配置文件
          - api.yaml #api网关接口代理模块配置
          - dd.yaml #设备数据处理模块配置
          - di.yaml #设备交互模块配置
          - dm.yaml #设备管理模块配置
          - sys.yaml #系统管理模块配置
    - mysql #本项目SQL文件
      - sql
        - dmsvr.sql #设备管理模块SQL
        - rulesvr.sql #协议规则引擎模块SQL
        - syssvr.sql #系统管理模块SQL
    - nats #nats组件 相关配置
      - nats-server.conf # #nats配置文件


- doc #项目文档
  - assets #一些逻辑流程图、架构图、二维码
  - v2 #v2版本架构设计思路


- shared #公共服务、DTO、Client
  - clients #mqtt/nats/TDengine client
  - conf #配置文件内 部分对象的 DTO
  - def #常量、结构体 通用定义
  - devices #此负责提供 和设备相关的 公用的操作函数
  - domain #此包用于封装 跨服务共享的 领域对象
    - application #此包负责定义 应用层推送的 结构体
    - deviceAuth
    - schema #此包负责 物模型定义及相关逻辑
  - errors #程序错误对象、错误码的定义
  - events #此包负责提供事件的封装及解包(如topic、常量、结构体、封解方法)
  - oss #对象存储SDK
  - proto #公共proto定义
  - result #apisvr网关模块 响应结果处理 的封装
  - store
  - third #第三方SDK对接
  - traces #链路追踪方法封装
  - users #jwt方法封装
  - utils #工具类函数封装
  - verify #验证码函数封装


- src #项目主要代码(go-zero rest)
  - apisvr #api网关接口代理模块
    - etc #单体部署 运行时 各服务 配置文件
      - api.yaml #api网关接口代理模块配置
      - dd.yaml #设备数据处理模块配置
      - di.yaml #设备交互模块配置
      - dm.yaml #设备管理模块配置
      - sys.yaml #系统管理模块配置
    - apidirect
      - direct.go #加载配置、协程启动dd服务、构造单例上下文(含根据配置判断连接其他子服务)
  - ddsvr #设备数据处理模块(go-zero rest)
    - etc
      - dd.yaml #独立部署 运行时 当前服务 配置文件
    - dddirect
      - direct.go #加载配置、构造单例上下文、注册消费者Handle
  - disvr #设备交互模块(go-zero rpc)
    - etc
      - di.yaml #独立部署 运行时 当前服务 配置文件
    - didirect
      - direct.go #加载配置、构造单例上下文、注册消费者Handle
  - dmsvr #设备管理模块(go-zero rpc)
    - etc
      - dm.yaml #独立部署 运行时 当前服务 配置文件
    - dmdirect
      - direct.go #加载配置、构造单例上下文
  - rulesvr #协议规则引擎模块(go-zero rpc)
    - etc
      - rule.yaml #独立部署 运行时 当前服务 配置文件
    - ruledirect
      - direct.go #加载配置、构造单例上下文、注册消费者Handle
  - syssvr #系统管理模块(go-zero rpc)
    - etc
      - sys.yaml #独立部署 运行时 当前服务 配置文件
    - sysdirect
      - direct.go #加载配置、构造单例上下文


- tests #单元测试用例

Local deployment steps:

    • Rely on open source components: MySQL, Redis, nats, etcd, TDengine, EMQX, etc.,

      See the configuration file content under itings\src\apisvr\etc\*.yaml for details

    • Create database iThings and execute all SQL commands under the directory itings/deploy/conf/mysql/sql/

    • Modify the IDE working directory to itings\src\apisvr, and then run the main function of itings/src/apisvr/api.go

Demo address: http://42.193.250.251:7777

Get the source code: https://github.com/i-Things/iThings

Past recommendation

☞ IDC China 2022 IoT Platform Evaluation Report

☞ IoT Platform Trends in 2022: Privatization

☞ 5 failed lessons worth sharing about Internet of Things startups

☞ Selection and comparison of four domestic IoT platforms

☞ Is the [IoT platform] of cloud vendors not popular?

7b8246e06aeb105d6250a934fbf22887.png

e7c3a867519059cb165d66a99848a049.gif

39ebf47fe01769ab88da176948f49715.gif

e18b43cefecf2f2d067ab9b8c49b3951.gif

98103f9a530dcc102468bdc81ba80055.gif

Guess you like

Origin blog.csdn.net/klandor2008/article/details/131098918