A series of articles about the installation and operation of the LoRaWAN Chirpstack server

1. Introduction



This series of articles will be devoted to the deployment and operation of open source software: the LoRaWAN Chirpstack network server. This software was created by one of the Netherlands enthusiasts, Orne Brocaar , and can be used to build their own LoRaWAN networks, the system components are licensed by the MIT license and can be used for commercial operation.



Communicating with customers and consumers of our LoRaWAN devices, I repeatedly heard requests for help in deploying my own networks based on this server, this made me think that a generalized guide for deploying and operating the server is needed, which I could read step by step, with his own hand, install anyone. In this regard, this series of articles was born. What are we going to discuss? Let's start with the most important thing, by installing all the server components. Further, there will be articles on the operation of the server, on integration with external platforms, on the use of such new technologies of LoRaWAN networks as Multicast and FUOTA. And so, let's start ... part one.



2.What will we work with



First of all, we will describe what we will test and deploy the LoRaWAN server on.

Hardware:



  • LoRaWAN gateway: DoMINO Indoor v.1.0 (you can use another for example Vega BS xx)
  • Pulse Counter DoMINO PULSE v.4.3 +


Software:



  • Cloud Server with Ubuntu 18.04


3. Description of the Chirpstack server



The structure of the LoRaWAN network server is shown in Figure 1.





Fig.1



The main components of the server are:



Gateway Bridge - some bridge between the Packet Forwarder program installed on the base station (gateway) and the LoRaWAN server structure itself;

Network Server - a network server that processes network-level messages;

Application Server - an application server that provides network operation at the user level, integrates with external platforms.



Auxiliary components:



MQTT Broker Mosquitto - for internal messaging between server components;

Redis  - an intermediate database for storing transient data;

PostgreSQL- a database for permanent data storage.

All software is open source software.



4. Server installation



The server is installed on Ubuntu 18.04 or Debian OS. We will describe an installation using a cloud server on Ubuntu 18.04. The connection to the server is made via SSH using the Putty client. Note: It is assumed that our reader has an idea of ​​working with Ubuntu, SSH, Putty, has an installed and configured OS.



4.1 Installing and configuring auxiliary software



To get started, we need to install auxiliary packages. To do this, enter the command in the console:



sudo apt install mosquitto mosquitto-clients redis-server redis-tools postgresql


and wait for the installation to complete.



Next, you need to configure the PostgreSQL database and add users to it.

We go into the database management mode:



sudo -u postgres psql


The database management prompt will appear postgres = #

Create users with your passwords (you need to remember this data, you can give other logins and passwords, but be sure to remember them, they will be required further to configure the network server and application server).



Create a user for the network server:



create role chirpstack_ns with login password 'dbpassword';


We create a user for the application server:



create role chirpstack_as with login password 'dbpassword';


Let's create a database for the network server:



create database chirpstack_ns with owner chirpstack_ns;


Create a database for the application server:



create database chirpstack_as with owner chirpstack_as;


Additional settings



Connect to the database:



\c chirpstack_as


Create an extension:



create extension pg_trgm;


Create an extension:



create extension hstore;


Exit editing database parameters:



\q


4.2 Installing the Chirpstack repository



The following components must be installed: dirmngr and apt-transport-https, if not run the command:



sudo apt install apt-transport-https dirmngr


Install the key for the new repository:



sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1CE2AFD36DBCCA00


Add the repository to the list:



sudo echo "deb https://artifacts.chirpstack.io/packages/3.x/deb stable main" | sudo tee /etc/apt/sources.list.d/chirpstack.list


Let's update the apt cache:



sudo apt update


This completes the preliminary configuration.



4.3 Installing the Gateway Bridge



Install the package:



sudo apt install chirpstack-gateway-bridge


Launch Gateway Bridge:



sudo systemctl start chirpstack-gateway-bridge


We put the Gateway Bridge application on startup:



sudo systemctl enable chirpstack-gateway-bridge


To check if it was started and installed correctly, you can check the log using the command:



sudo journalctl -f -n 100 -u chirpstack-gateway-bridge


Exit the log Ctrl + Z.



There should be no errors in the log.



4.4 Installing and Configuring the Network Server



Install the package:



sudo apt install chirpstack-network-server


For the server to work properly, we need to configure it, the configuration file is the file:



/etc/chirpstack-network-server/chirpstack-network-server.toml


Before using the network server, you need to edit it for our tasks, for this we enter the folder with the file:



/etc/chirpstack-network-server/


And in this folder, execute the command to create a new configuration file



chirpstack-network-server configfile > chirpstack-network-server.toml


Let's start making changes to the configuration file.



Open the file for editing in a convenient editor (nano, vim).



We will discuss in detail on the in-depth paragraph of the network server settings in the next parts of the cycle, now we will make only basic settings to provide the basis for the functionality.



We configure the connection of the network server to the database:



dsn="postgres://chirpstack_ns:dbpassword@localhost/chirpstack_ns?sslmode=disable"


This is where we need the database name, login and password from the previous paragraph!



We also edit the frequency plan parameter:



name="RU864"


We save the configuration file, exit to the terminal console.



We start the network server:



sudo systemctl start chirpstack-network-server


We put the network server on startup:



sudo systemctl enable chirpstack-network-server


We check the log of the network server, there should be no errors:



sudo journalctl -f -n 100 -u chirpstack-network-server


The server is configured and running.



4.5 Installing and configuring the Application Server



Install the package:



sudo apt install chirpstack-application-server


By analogy with the network server, we configure the application server configuration file.



Go to the settings folder:



/etc/chirpstack-application-server/


We update the configuration file:



chirpstack-application-server configfile > chirpstack-application-server.toml


Here we will also have to edit the connection to the database and a very important point is to create the jwt_secret secret key , for this we run the command:



openssl rand -base64 32


and write down the resulting key.



Open the configuration file for editing and change the database connection strings to our own:



dsn="postgres://chirpstack_as:dbpassword@localhost/chirpstack_as?sslmode=disable"


Install the copied secret key:



jwt_secret=”UwX3TeStLtm/7tkW7hsqfbpcvo5k+BOEh/l8uDHCcKU=”


We save the configuration file. We exit to the terminal console.



We start the application server:



sudo systemctl start chirpstack-application-server


Set the application server to startup:



sudo systemctl enable chirpstack-application-server


Checking the operation of the application server:



sudo journalctl -f -n 100 -u chirpstack-application-server


There should be no mistakes.



Congratulations, the LoRaWAN Chirpstack server is installed and ready to use!



In the next part of this series of articles, I will talk in detail about working with the Web interface of the LoRaWAN Chirpstack server. Best



regards,

Head of DoMINO GROUP,

Andrey Golovatenko



All Articles