Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Losing parameter values in chirpstack.toml and chirpstack-gateway-bridge.toml during upgrade #295

Closed
IoTThinks opened this issue Oct 8, 2023 · 4 comments

Comments

@IoTThinks
Copy link

Hi all,
During upgrading of ChirpStack v4.x and ChirpStack Gateway Bridge v4.x, my parameter values in the chirpstack.toml and chirpstack-gateway-bridge.toml are overwritten by default values such as localhost and port 1883 (for MQTT)...

I always try to use environment parameters (such as $MQTT_SERVER and $MQTT_PORT) in the toml files.
Could we use environment parameters and parameters separately in two files? One for configuration (chirpstack.toml) and one for custom parameter values?

So it is more convenienent and less downtime during upgrading.
Thanks a lot.

@brocaar
Copy link
Contributor

brocaar commented Oct 9, 2023

Let me look into this, it might be an issue in the Debian postinst script which gets triggered on installation and upgrading.

@IoTThinks
Copy link
Author

Thanks a lot.
If this finding is fixed, it is more easy to upgrade with less downtime.

brocaar added a commit that referenced this issue Oct 11, 2023
@brocaar
Copy link
Contributor

brocaar commented Oct 11, 2023

The above fixes the issue. My mistake, the postinst is also executed post-upgrade, but with different parameters. The above commit fixes this.

@IoTThinks
Copy link
Author

We will test this during upgrading at weekend to confirm if the issue is resolved.
Thanks a lot for your effort.

brocaar added a commit that referenced this issue Nov 22, 2023
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants