From 24ec339b51ecee442e515e6a2b58a924ec713ae1 Mon Sep 17 00:00:00 2001 From: Jon Roeber Date: Sun, 8 Oct 2023 12:45:10 -0400 Subject: [PATCH] add initial gateway bridge instructions --- doc/3-chirpstack.md | 179 ---------------------------------------- doc/3-gateway-bridge.md | 56 +++++++++++++ 2 files changed, 56 insertions(+), 179 deletions(-) delete mode 100644 doc/3-chirpstack.md create mode 100644 doc/3-gateway-bridge.md diff --git a/doc/3-chirpstack.md b/doc/3-chirpstack.md deleted file mode 100644 index ae7ffa3..0000000 --- a/doc/3-chirpstack.md +++ /dev/null @@ -1,179 +0,0 @@ -# ChirpStack Setup - -Follow install instructions: - -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://:@/?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 -``` diff --git a/doc/3-gateway-bridge.md b/doc/3-gateway-bridge.md new file mode 100644 index 0000000..f78b57f --- /dev/null +++ b/doc/3-gateway-bridge.md @@ -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.