网站首页 > 博客文章 正文
IoTSharp 是一个 基于.Net Core 开源的物联网基础平台, 支持 HTTP、MQTT 、CoAp 协议, 属性数据和遥测数据协议简单类型丰富,简单设置即可将数据存储在PostgreSql、MySql、Oracle、SQLServer、Sqlite,是一个用于数据收集、处理、可视化与设备管理的 IoT 平台。
gitee仓库地址:https://gitee.com/dotnetchina/IoTSharp?_from=gitee_search
官方文档:https://docs.iotsharp.io/docs/intro ,具体介绍请查看官方文档。此文章只讲部署。
官方的部署方式为docker部署,但阿里云/腾讯云的windows系统本身就是虚拟机,不支持二次虚拟化,也就是在阿里云windows服务器是不能运行docker的,只能采用源码编译的方式进行编译部署。
开发IDE:vs2022
环境:netcore 6,nodejs,npm,yarn
数据库:mysql,内存存储
1.下载源码
git clone https://github.com/IoTSharp/IoTSharp.git
也可以根据自己的环境在gitee或github上下载zip文件,解压。
2.服务端源码编译
进入根目录,用vs2022打开IoTSharp.sln,右键“IoTGateway”项目,重新生成,编译项目,等待项目编译成功,第一次时间可能比较长,耐心等待。
3.修改配置文件
编译成功后,进入编译后的程序目录,打开appsettings.Production.json文件,根据需要修改参数配置,修改完成后双击“IoTSharp.exe”即可,会自动生成数据库(iotsharp)和对应的表,完成后可检查数据库是否成功。
appsettings.Production.json
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"DataBase": "MySql",
"ConnectionStrings": {
"IoTSharp": "server=localhost;user=root;password=123456;database=IoTSharp",
"TelemetryStorage": "server=localhost;user=root;password=123456;database=IoTSharp"
},
"JwtKey": "iotsharpiotsharpiotsharpiotsharpiotsharp",
"JwtExpireHours": 3,
"JwtIssuer": "IoTSharp.Net",
"JwtAudience": "IoTSharp.Net",
"EventBusStore": "InMemory",
"EventBusMQ": "InMemory",
"TelemetryStorage": "Sharding"
}
4.前端编译
因前端使用angular,需要安装node、npm或yarn才可以进行前端编译,我这里用的yarn。dos进入"根目录\IoTSharp\ClientApp"文件夹,执行命令yarn,自动安装依赖。
yarn
依赖安装完成后,执行命令yarn build进行编译,成功后会在"根目录\IoTSharp\ClientApp"文件夹下生成dist文件夹,前端编译成功。
5.部署
服务端双击““IoTSharp.exe””或dotnet 命令运行即可,客户端使用nginx部署,在端口4441监听,通过nginx做下转发,将请求接口转发到服务端,配置完成后启动nginx即可,nginx配置如下所示。
server {
listen 44411;
# gzip config
gzip on;
gzip_min_length 1k;
gzip_comp_level 9;
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
root C:\iotsharp\dist;
include mime.types;
location /api/ {
proxy_pass http://localhost:5000/api/; #修改此地址为后台服务地址
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_connect_timeout 1;
proxy_buffering off;
chunked_transfer_encoding off;
proxy_cache off;
proxy_send_timeout 30m;
proxy_read_timeout 30m;
client_max_body_size 100m;
}
location / {
index index.html;
}
}
6.打开浏览器,输入:http://localhost:44411/,第一次运行进入初始化界面,填写完成后点击注册,进入登录界面,密码为刚输入的密码。
7.登录成功
8.3D界面
- 上一篇: 实践小记:Cypress
- 下一篇: HummerRisk 入门3:开发手册
猜你喜欢
- 2024-11-30 Hadoop集群部署(实操干货,建议收藏)
- 2024-11-30 列式存储的分布式数据库——HBase(环境部署)
- 2024-11-30 Vue3.2项目架构详解
- 2024-11-30 Flink安装(Standalone、Yarn模式)
- 2024-11-30 Apache Doris 整合 Iceberg + Flink CDC 构建实时湖仓一体的联邦查询
- 2024-11-30 大数据Apache Druid(二):Druid数据结构及架构原理
- 2024-11-30 CTO来教你:技术人员突然离职,如何接手他的项目?
- 2024-11-30 1.4 Flink on YARN集群部署《Flink核心源码解读》
- 2024-11-30 windows系统下如何安装多版本node.js
- 2024-11-30 从 jQuery 到 Vue3 的快捷通道
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)