add initial gateway bridge instructions

This commit is contained in:
Jon Roeber 2023-10-08 12:45:10 -04:00
parent 918608599c
commit 24ec339b51
2 changed files with 56 additions and 179 deletions

View File

@ -1,179 +0,0 @@
# ChirpStack Setup
Follow install instructions: <https://www.chirpstack.io/docs/getting-started/debian-ubuntu.html>
Set configurations
For `/etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml`:
```toml
root@chirpstack:/etc/chirpstack-gateway-bridge# cat chirpstack-gateway-bridge.toml
# This configuration provides a Semtech UDP packet-forwarder backend and
# integrates with a MQTT broker. Many options and defaults have been omitted
# for simplicity.
#
# See https://www.chirpstack.io/gateway-bridge/install/config/ for a full
# configuration example and documentation.
# Gateway backend configuration.
[backend]
# Backend type.
type="semtech_udp"
# Semtech UDP packet-forwarder backend.
[backend.semtech_udp]
# ip:port to bind the UDP listener to
#
# Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
# This is the listener to which the packet-forwarder forwards its data
# so make sure the 'serv_port_up' and 'serv_port_down' from your
# packet-forwarder matches this port.
udp_bind = "0.0.0.0:1700"
# Integration configuration.
[integration]
# Payload marshaler.
#
# This defines how the MQTT payloads are encoded. Valid options are:
# * protobuf: Protobuf encoding
# * json: JSON encoding (easier for debugging, but less compact than 'protobuf')
marshaler="protobuf"
# MQTT integration configuration.
[integration.mqtt]
# Event topic template.
event_topic_template="us915_0/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
# Command topic template.
command_topic_template="us915_0/gateway/{{ .GatewayID }}/command/#"
# MQTT authentication.
[integration.mqtt.auth]
# Type defines the MQTT authentication type to use.
#
# Set this to the name of one of the sections below.
type="generic"
# Generic MQTT authentication.
[integration.mqtt.auth.generic]
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://127.0.0.1:1883"
# Connect with the given username (optional)
username=""
# Connect with the given password (optional)
password=""
```
For `/etc/chirpstack/chirpstack.toml`:
```toml
root@chirpstack:/etc/chirpstack# cat chirpstack.toml
# Logging.
[logging]
# Log level.
#
# Options are: trace, debug, info, warn error.
level="info"
# PostgreSQL configuration.
[postgresql]
# PostgreSQL DSN.
#
# Format example: postgres://<USERNAME>:<PASSWORD>@<HOSTNAME>/<DATABASE>?sslmode=<SSLMODE>.
#
# SSL mode options:
# * disable - no SSL
# * require - Always SSL (skip verification)
# * verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA)
# * verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)
dsn="postgres://chirpstack:chirpstack@localhost/chirpstack?sslmode=disable"
# Max open connections.
#
# This sets the max. number of open connections that are allowed in the
# PostgreSQL connection pool.
max_open_connections=10
# Min idle connections.
#
# This sets the min. number of idle connections in the PostgreSQL connection
# pool (0 = equal to max_open_connections).
min_idle_connections=0
# Redis configuration.
[redis]
# Server address or addresses.
#
# Set multiple addresses when connecting to a cluster.
servers=[
"redis://localhost/",
]
# Redis Cluster.
#
# Set this to true when the provided URLs are pointing to a Redis Cluster
# instance.
cluster=false
# Network related configuration.
[network]
# Network identifier (NetID, 3 bytes) encoded as HEX (e.g. 010203).
net_id="000000"
# Enabled regions.
#
# Multiple regions can be enabled simultaneously. Each region must match
# the 'name' parameter of the region configuration in '[[regions]]'.
enabled_regions=[
"as923",
"as923_2",
"as923_3",
"as923_4",
"au915_0",
"cn470_10",
"cn779",
"eu433",
"eu868",
"in865",
"ism2400",
"kr920",
"ru864",
"us915_0",
"us915_1",
]
# API interface configuration.
[api]
# interface:port to bind the API interface to.
bind="0.0.0.0:8080"
# Secret.
#
# This secret is used for generating login and API tokens, make sure this
# is never exposed. Changing this secret will invalidate all login and API
# tokens. The following command can be used to generate a random secret:
# openssl rand -base64 32
secret="theChirpthing!."
[integration]
enabled=["mqtt"]
[integration.mqtt]
server="tcp://localhost:1883/"
json=true
```

56
doc/3-gateway-bridge.md Normal file
View File

@ -0,0 +1,56 @@
# Gateway Bridge
Get the ChirpStack GPG key:
```sh
# https://superuser.com/a/1773782
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 1CE2AFD36DBCCA00 && \
gpg --export 1CE2AFD36DBCCA00 | sudo tee /etc/apt/trusted.gpg.d/chirpstack.gpg >/dev/null && \
gpg --batch --yes --delete-keys 1CE2AFD36DBCCA00
```
This avoids using the deprecated `apt-key` command listed on the ChirpStack site.
Add the source at:
```conf
echo "deb https://artifacts.chirpstack.io/packages/4.x/deb stable main" | sudo tee /etc/apt/sources.list.d/chirpstack.list
```
Update and install:
```conf
sudo apt update
sudo apt install chirpstack-gateway-bridge
```
See the following message:
```none
---------------------------------------------------------------------------------
The configuration file is located at:
/etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
Some helpful commands for chirpstack-gateway-bridge:
Start:
$ sudo systemctl start chirpstack-gateway-bridge
Restart:
$ sudo systemctl restart chirpstack-gateway-bridge
Stop:
$ sudo systemctl stop chirpstack-gateway-bridge
Display logs:
$ sudo journalctl -f -n 100 -u chirpstack-gateway-bridge
---------------------------------------------------------------------------------
```
Edit `/etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml` to match the port that the packet forwarder is using (1730 instead of 1700):
```toml
upd_bind = "0.0.0.0:1730"
```
Set up the Mosquitto integration later.