Remove env variables from example config.

Initially this was added to make development using Docker Compose easier.
However, in my experience Docker Compose is not great for the reason
that there might be environmental differences between Rust running in
Compose and Rust running outside Compose (if using VSCode with Rust
plugin, then rust-analyzer will perform checks in the background). This
and 'cross' not working properly in Compose was the reason to migrate
to nix, as it provides a reproducible environment for development that
can also be used by VSCode (using the Nix environment selector
extension) and GitHub Actions (for the CI pipeline).

As the chirpstack-docker repository provides its own configuration files,
these files are not included in the Dockerfile and because we are
rewriting these env variables anyway to 'localhost' in the .deb and .rpm
post-installation script, it is better to set these to localhost by
default.

The post-installation rewrite to 'localhost' is causing issues on
upgrade (#295). If we only do the rewrite on initial installation, then
we run in an other issue; the package-manager will prompt that the
config file has changed (from 'localhost' to '$MQTT_BROKER_HOST' for
example) and will ask if you would like to overwrite or not. If the
end-user would accept the config changes without looking at the diff
this would break the installation as most likely, these environment are
not set (which is why we were rewriting these to 'localhost' in the first
place).
This commit is contained in:
Orne Brocaar 2023-11-22 11:10:13 +00:00
parent 5fd56e7e3c
commit c0cd3a3361
42 changed files with 46 additions and 58 deletions

View File

@ -201,10 +201,6 @@ post_install_script = '''
chown -R chirpstack:chirpstack /etc/chirpstack
chmod 750 /etc/chirpstack
chmod 640 /etc/chirpstack/*.toml
sed -i "s/\$MQTT_BROKER_HOST/localhost/" /etc/chirpstack/*.toml
sed -i "s/\$POSTGRESQL_HOST/localhost/" /etc/chirpstack/*.toml
sed -i "s/\$REDIS_HOST/localhost/" /etc/chirpstack/*.toml
'''
assets = [

View File

@ -19,7 +19,7 @@
# * 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@$POSTGRESQL_HOST/chirpstack?sslmode=disable"
dsn="postgres://chirpstack:chirpstack@localhost/chirpstack?sslmode=disable"
# Max open connections.
#
@ -41,7 +41,7 @@
#
# Set multiple addresses when connecting to a cluster.
servers=[
"redis://$REDIS_HOST/",
"redis://localhost/",
]
# Redis Cluster.
@ -99,5 +99,5 @@
enabled=["mqtt"]
[integration.mqtt]
server="tcp://$MQTT_BROKER_HOST:1883/"
server="tcp://localhost:1883/"
json=true

View File

@ -38,7 +38,7 @@
topic_prefix="as923"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="as923_2"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="as923_3"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="as923_4"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="au915_0"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="au915_1"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="au915_2"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="au915_3"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="au915_4"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="au915_5"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="au915_6"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="au915_7"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_0"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_1"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_10"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_11"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_2"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_3"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_4"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_5"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_6"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_7"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_8"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn470_9"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="cn779"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="eu433"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="eu868"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="in865"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="ism2400"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="kr920"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="ru864"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="us915_0"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="us915_1"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="us915_2"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="us915_3"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="us915_4"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="us915_5"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="us915_6"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -38,7 +38,7 @@
topic_prefix="us915_7"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://$MQTT_BROKER_HOST:1883"
server="tcp://localhost:1883"
# Connect with the given username (optional)
username=""

View File

@ -1,16 +1,8 @@
#!/usr/bin/env bash
# Only execute on first install
if [[ -z $2 ]]; then
# Set config-file permissions
chown -R chirpstack:chirpstack /etc/chirpstack
chmod 750 /etc/chirpstack
chmod 640 /etc/chirpstack/*.toml
# Set environment variables to localhost
sed -i "s/\$MQTT_BROKER_HOST/localhost/" /etc/chirpstack/*.toml
sed -i "s/\$POSTGRESQL_HOST/localhost/" /etc/chirpstack/*.toml
sed -i "s/\$REDIS_HOST/localhost/" /etc/chirpstack/*.toml
fi
# Set config-file permissions
chown -R chirpstack:chirpstack /etc/chirpstack
chmod 750 /etc/chirpstack
chmod 640 /etc/chirpstack/*.toml
#DEBHELPER#