Repository navigation
fix(chirpstack): make gateway bridges config-free (env-only) so install doesn't crash+rollback - #27
Merged
Conversation
…ll no longer crashes Root cause: gateways used command '-c <toml>' but the toml was written by post_install, which Cosmos runs AFTER first container start. At first boot the config file does not exist and both chirpstack-gateway-bridge binaries exit fatally -> restart loop -> Cosmos post_install exec fails -> rollback of the whole stack (Gateway Timeout / HTTP002). Fix: configure both gateway bridges purely via ChirpStack v4 environment variables (INTEGRATION__MQTT__*, BACKEND__TYPE, BACKEND__BASIC_STATION__*, BACKEND__SEMTECH__UDP__*) and drop command + post_install for them entirely. Verified by booting the actual images: semtech_udp listener starts, process stays up (only MQTT broker DNS retries until mosquitto is reachable). Also: - main chirpstack: stop depending on an external artefact; generate the chirpstack.toml inline in post_install (works for v4, which substitutes $ENV in toml at load), set api.secret from Passwords.1 (was the placeholder 'you-must-replace-this'), keep DB password from Passwords.0. - add API_SECRET env. Validated with the store's own whiskers render + JSON parse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's broken
Installing ChirpStack from the market fails with a rollback (Gateway Timeout / HTTP002). The failing step is the
ChirpStack-gateway-bridgepost-install:Root cause
Both gateway bridge services (
{ServiceName}-gateway-bridgeand-gateway-bridge-basicstation) were launched with:but the config file was written by
post_install— which Cosmos executes after the container has already started. On first boot the volume is empty, the config file does not exist, andchirpstack-gateway-bridgeexits fatally:The container enters a restart loop, so Cosmos's post-install
execfails with "container is restarting" and the entire stack is rolled back.The fix
ChirpStack v4's gateway-bridge (Go binary) reads configuration from environment variables (
KEY__NESTED→key.nestedvia viper) and a missing config file is not fatal when-cis not passed. I verified by booting the real images:gateway-bridge:State: running,backend/semtechudp: starting gateway udp listener🎉 (only MQTT DNS retries until mosquitto is reachable — harmless)gateway-bridge-basicstation:State: runningthe same way (itsconcentratorsare defined via gateway config in ChirpStack v4; empty list is acceptable at boot)So both gateway bridges are now configured purely via environment —
commandandpost_installremoved:-c missing.toml→ fatalINTEGRATION__MQTT__AUTH__GENERIC__SERVERS, region topic templates,BACKEND__TYPE=semtech_udp-c missing-{region}.toml→ fatalBACKEND__TYPE=basic_station,BACKEND__BASIC_STATION__BIND=:3001Additionally for the main
chirpstackservice:post_installinstead of downloading an external artefact (v4 substitutes$ENVin the toml at load — verified inchirpstack/src/config.rs).api.secretis now a real password ({Passwords.1}) instead of the placeholderyou-must-replace-this(otherwise the API/healthcheck misbehaves).API_SECRETenv var.Validation
chirpstack/chirpstack-gateway-bridge:4image with an empty volume +-c.chirpstack(v4 Rust binary) loads the generated toml, substitutes env, and reaches postgres (fails only on DNS because my test net has no{ServiceName}-postgres).cosmos-compose.jsonrenders + parses as valid JSON using the store's own whiskers validator.