feat: add ChirpStack LoRaWAN Network Server template (#486)

* feat: add ChirpStack LoRaWAN Network Server template

  Add complete ChirpStack v4 template with:
  - Main ChirpStack server with web UI
  - UDP and Basics Station gateway bridges
  - REST API interface
  - PostgreSQL database with PostGIS extensions
  - Redis cache
  - Mosquitto MQTT broker

Default configuration for EU868 region with secure random credentials. Supports all LoRaWAN frequency bands globally.

* fix(chirpstack): use original configurations from chirpstack-docker repo

Update template.toml to use exact configuration files from the
chirpstack-docker repository instead of simplified versions:

- Use original chirpstack.toml with all 15 enabled regions
- Use original gateway bridge configuration with documentation links
- Use complete Basics Station EU868 config with frequency plans
- Keep original Mosquitto and PostgreSQL initialization scripts

Template size increased from 131 to 219 lines (4.7KB) to include
comprehensive default configurations that match the official setup.

* feat: add all 38 region configuration files

* fix(chirpstack): add volume mounts to expose config files to containers

* fix(chirpstack): remove read-only flag

* fix(chirpstack): correct file paths for configuration mounts in docker-compose and template files

* fix: update volume paths to be on correct directory level

* fix: configure template for dokploy-network with proper DNS resolution

- Add dokploy-network configuration to docker-compose.yml
- Replace environment variable placeholders with actual service hostnames
- Change PostgreSQL DSN from $POSTGRESQL_HOST to postgres
- Change Redis server from $REDIS_HOST to redis
- Replace $MQTT_BROKER_HOST with mosquitto in all 39 region configurations

These changes ensure Docker DNS resolution works correctly by:
- Using dokploy-network (overlay) instead of bridge network
- Using service names directly in TOML config files (TOML doesn't expand env vars)
- Enabling proper service discovery between containers

This resolves DNS resolution failures that caused ChirpStack to fail connecting
to PostgreSQL and MQTT services during deployment.

* fix: add missing network configurations for all services in docker-compose

* feat: add internal services to config.domains for proper network configuration

* Update docker-compose.yml

* fix: enhance domain validation in template validator

- Updated the TemplateValidator to ensure that if the 'host' field is provided, it must be a valid string.
- Added comments to clarify that 'host' is optional for internal services.

* refactor: remove redundant host validation in template validator

- Removed the validation for the 'host' field in the TemplateValidator, as it is optional for internal services and does not require a type check if not provided.

* refactor: remove internal service domain configurations from template

- Eliminated the domain configurations for internal services (Postgres, Redis, Mosquitto) from the template.toml file, streamlining the configuration for better clarity and maintainability.

---------

Co-authored-by: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com>
Co-authored-by: Mauricio Siu <siumauricio@icloud.com>
This commit is contained in:
lefolalan
2025-12-14 07:13:13 +01:00
committed by GitHub
parent c0ff3ca788
commit f3c1060443
5 changed files with 9915 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,81 @@
services:
chirpstack:
image: chirpstack/chirpstack:4
command: -c /etc/chirpstack
restart: unless-stopped
volumes:
- ../files/chirpstack:/etc/chirpstack
ports:
- 8080
environment:
- MQTT_BROKER_HOST=mosquitto
- REDIS_HOST=redis
- POSTGRESQL_HOST=postgres
depends_on:
- postgres
- mosquitto
- redis
chirpstack-gateway-bridge:
image: chirpstack/chirpstack-gateway-bridge:4
restart: unless-stopped
volumes:
- ../files/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
ports:
- 1700/udp
environment:
- INTEGRATION__MQTT__EVENT_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/event/{{ .EventType }}
- INTEGRATION__MQTT__STATE_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/state/{{ .StateType }}
- INTEGRATION__MQTT__COMMAND_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/command/#
depends_on:
- mosquitto
chirpstack-gateway-bridge-basicstation:
image: chirpstack/chirpstack-gateway-bridge:4
command: -c /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge-basicstation-eu868.toml
restart: unless-stopped
volumes:
- ../files/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
ports:
- 3001
depends_on:
- mosquitto
chirpstack-rest-api:
image: chirpstack/chirpstack-rest-api:4
restart: unless-stopped
command: --server chirpstack:8080 --bind 0.0.0.0:8090 --insecure
ports:
- 8090
depends_on:
- chirpstack
postgres:
image: postgres:14-alpine
restart: unless-stopped
volumes:
- postgresqldata:/var/lib/postgresql/data
- ../files/postgresql/initdb:/docker-entrypoint-initdb.d
environment:
- POSTGRES_USER=chirpstack
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=chirpstack
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --save 300 1 --save 60 100 --appendonly no
volumes:
- redisdata:/data
mosquitto:
image: eclipse-mosquitto:2
restart: unless-stopped
volumes:
- ../files/mosquitto/config/:/mosquitto/config/
ports:
- 1883
volumes:
postgresqldata:
redisdata:

File diff suppressed because it is too large Load Diff

View File

@@ -237,9 +237,6 @@ class TemplateValidator {
if (domain.port === undefined || domain.port === null) {
this.error(`domain[${index}]: Missing required field 'port'`);
}
if (!domain.host) {
this.error(`domain[${index}]: Missing required field 'host'`);
}
// Validate serviceName matches docker-compose.yml services
if (domain.serviceName && composeServices && composeServices.length > 0) {

View File

@@ -1156,6 +1156,25 @@
"Document Management"
]
},
{
"id": "chirpstack",
"name": "ChirpStack",
"version": "4",
"description": "Open-source LoRaWAN Network Server for IoT applications. Complete stack with gateway bridges, REST API, and web interface for managing LoRaWAN devices and gateways.",
"logo": "chirpstack.png",
"links": {
"github": "https://github.com/chirpstack/chirpstack",
"website": "https://www.chirpstack.io/",
"docs": "https://www.chirpstack.io/docs/"
},
"tags": [
"iot",
"lorawan",
"network-server",
"gateway",
"monitoring"
]
},
{
"id": "chromium",
"name": "Chromium",