LoRaWAN Network Server项目 ChirpStack平台搭建

前置步骤

  1. 安装Go环境
    Golang官网,下载go语言的安装包 (go1.13.5.linux-amd64.tar.gz)
    解压:sudo tar -zvxf go1.13.5.linux-amd64.tar.gz -C /usr/local

    配置环境:
    在以下文件中加入相关配置

    /etc/environment : export GOPATH=$HOME/Lora
    /etc/profile : export GOROOT=/usr/local/go  #设置为go安装的路径
    			   export GOPATH=$HOME/Lora
    			   export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
    #添加完之后
    source /etc/profile
    #然后在GOPATH路径中新建目录:/bin,/src,/pkg
    cd ~/Lora
    mkdir bin src pkg
    
  2. 安装mosquitto,redis,postgresql并添加相应数据库
    可参照官网

    #安装mosquitto,redis,postgresql
    sudo apt install mosquitto mosquitto-clients redis-server redis-tools postgresql 
    
    #添加用户和数据库
    sudo -u postgres psql 
    
    #-- set up the users and the passwords
    #-- (note that it is important to use single quotes and a semicolon at the end!)
    create role chirpstack_as with login password 'dbpassword';
    create role chirpstack_ns with login password 'dbpassword';
    
    #-- create the database for the servers
    create database chirpstack_as with owner chirpstack_as;
    create database chirpstack_ns with owner chirpstack_ns;
    
    #-- change to the ChirpStack Application Server database
    \c chirpstack_as
    
    #-- enable the pq_trgm and hstore extensions
    #-- (this is needed to facilitate the search feature)
    create extension pg_trgm;
    #-- (this is needed to store additional k/v meta-data)
    create extension hstore;
    
    #-- exit psql
    \q
    
    

源码编译安装

1.chirpstack-gateway-bridge

cd ~/Lora/src
git clone https://github.com/brocaar/chirpstack-gateway-bridge
cd chirpstack-gateway-bridge/
make dev-requirements
make build

生成配置文件

cd build
./chirpstack-gateway-bridge configfile > chirpstack-gateway-bridge.toml

2.chirpstack-network-server

cd ~/Lora/src
git clone https://github.com/brocaar/chirpstack-network-server
cd chirpstack-network-server/
make dev-requirements
make build

生成配置文件

cd build
./chirpstack-network-server configfile > chirpstack-network-server.toml

3.chirpstack-application-server

编译chirpstack-application-server需要node.js

cd ~/Lora/src
git clone https://github.com/brocaar/chirpstack-application-server
cd chirpstack-application-server/
make dev-requirements ui-requirements
make build

生成配置文件

cd build
./chirpstack-application-server configfile > chirpstack-application-server.toml

在make build的过程中,我遇到如下问题:

Creating an optimized production build...
Failed to compile.

./src/components/DataTable.js
  Line 83:29:  Parsing error: JSX value should be either an expression or a quoted JSX text

  81 |         <Table 
  82 |          className={this.props.classes.table}
> 83 |          rowsPerPageOptions=[10, 25, 50, 100, 200, 500]>
     |                             ^
  84 |           <TableHead>
  85 |             {this.props.header}
  86 |           </TableHead>


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chirpstack-application-server-ui@3.0.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the chirpstack-application-server-ui@3.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Makefile:41: recipe for target 'ui/build' failed
make: *** [ui/build] Error 1

这是由于JSX语法问题导致的。只需给该数组套个大括号,然后重新build即可:

#在chirpstack-application-server/ui/src/components/DataTable.js找到错误的部分,并修改
rowsPerPageOptions={[10, 25, 50, 100, 200, 500]}>

#然后回到chirpstack-application-server目录,重新build
make clean
make build

相关配置

  1. chirpstack-network-server.toml

    #设置连接数据库的用户和密码(前置步骤2中配置的用户和密码)
    [postgresql]
    dsn="postgres://chirpstack_ns:dbpassword@localhost/chirpstack_ns?sslmode=disable"
    
    #设置地区参数
    [network_server.band]
    name="CN_470_510"
    
  2. chirpstack-application-server.toml

    #设置连接数据库的用户和密码(前置步骤2中配置的用户和密码)
    [postgresql]
    dsn="postgres://chirpstack_as:dbpassword@localhost/chirpstack_as?sslmode=disable"
    
    #设置jwt密钥
    [application_server.external_api]
    jwt_secret="verysecret"
    

参考文章

LoRaServer 笔记 1.3 源码编译
ChirpStack官网

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
ChirpStack中的网络服务是指在物联网(IoT)应用中用于连接和管理设备的服务。网络服务负责管理设备与应用程序之间的通信,并提供设备注册、激活、身份验证、配置和远程操作等功能。 ChirpStack的网络服务主要包括以下几个方面: 1. 设备管理:网络服务提供设备注册和激活功能。当设备加入网络时,需要将其注册到网络服务中,并进行身份验证和激活操作。网络服务会为每个设备分配唯一的标识符,以便后续的管理和通信操作。 2. 通信管理:网络服务负责设备与应用程序之间的通信管理。它提供了数据传输的接口和协议,使应用程序能够与设备进行双向通信。网络服务还支持数据的加密和解密,确保通信的安全性。 3. 设备配置:网络服务允许应用程序进行设备配置。它提供了远程配置设备的接口,使应用程序能够更改设备的参数和设置。这样,应用程序可以根据需求对设备进行灵活的调整和控制。 4. 设备管理和监控:网络服务还提供了设备管理和监控功能。它可以对设备进行远程监控,并实时查看设备的状态和性能。网络服务还可通过告警和通知功能,及时向管理员发送设备故障或异常情况的通知。 总之,ChirpStack中的网络服务是一个重要的组件,它扮演着连接设备和应用程序的桥梁。它提供了设备管理、通信管理、远程操作和监控等功能,为物联网应用提供了强大的支持。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值