Hello,
I have setup chirpstack v4 using the chirpstack-docker example on ubuntu22.04 and successfully connected a gateway to it and I am able to receive messages from my lora devices.
The gRPC interface works as well, for example to schedule downlink messages.
Now I wanted to setup a FUOTA server using the separate component (https://github.com/chirpstack/chirpstack-fuota-server/tree/master).
To my understanding, I am supposed to start it from the host using the docker volume (after building inside the docker-container), e.g. ./build/chirpstack-fuota-server -c packaging/files/chirpstack-fuota-server.toml
In the file packaging/files/chirpstack-fuota-server.toml, i added the IP of the application server, as well as the postgre-database connection details.
[postgresql]
dsn="postgres://chirpstack_fuota:chirpstack_fuota@172.18.0.2/chirpstack_fuota?sslmode=disable"
automigrate=true
# Application Server (integration) settings.
[application_server]
# Event handler integration settings.
[application_server.event_handler]
marshaler="protobuf"
# HTTP handler settings.
[application_server.event_handler.http]
# IP:Port to bind the event handler server to.
bind="0.0.0.0:8090"
# API integration settings.
[application_server.api]
# ChirpStack Application Server API server endpoint.
server="172.20.0.6:8080"
# API token.
token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJjaGlycHN0YWNrIiwiaXNzIjoiY2hpcnBzdGFjayIsInN1YiI6IjFmZTI0ZDhiLTY5YTMtNDBmZC1hYjU1LTg5YmM2Y2ZlY2I0NSIsInR5cCI6ImtleSJ9.jOHvj5sxntzKlgV9_idd3.pUMGGwKkbTRH8Dp1AfGuI"
# Endpoint uses TLS.
tls_enabled=false
I am able to connect to the postgre-database, but I get errors with gRPC related code. It seems that the address is not passed along correctly:
INFO[0000] starting ChirpStack FUOTA Server version=
INFO[0000] storage: connecting to PostgreSQL database
INFO[0000] storage: applying PostgreSQL schema migrations
INFO[0000] client/as: setup application-server client
DEBU[0000] [core]original dial target is: ""
DEBU[0000] [core]parsed dial target is: {Scheme: Authority: Endpoint: URL:{Scheme: Opaque: User: Host: Path: RawPath: OmitHost:false ForceQuery:false RawQuery: Fragment: RawFragment:}}
DEBU[0000] [core]fallback to scheme "passthrough"
DEBU[0000] [core]parsed dial target is: {Scheme:passthrough Authority: Endpoint: URL:{Scheme:passthrough Opaque: User: Host: Path:/ RawPath: OmitHost:false ForceQuery:false RawQuery: Fragment: RawFragment:}}
DEBU[0000] [core]Channel authority set to ""
DEBU[0000] [core]ccResolverWrapper: sending update to cc: {[{ <nil> <nil> 0 <nil>}] <nil> <nil>}
DEBU[0000] [core]ClientConn switching balancer to "pick_first"
DEBU[0000] [core]Channel switches to new LB policy "pick_first"
DEBU[0000] [core]Subchannel Connectivity change to CONNECTING
DEBU[0000] [core]Subchannel picks a new address "" to connect
WARN[0000] [core] grpc: addrConn.createTransport failed to connect to { <nil> <nil> 0 <nil>}. Err: connection error: desc = "transport: Error while dialing dial tcp: missing address"
DEBU[0000] [core]Subchannel Connectivity change to TRANSIENT_FAILURE
DEBU[0000] [core]pickfirstBalancer: UpdateSubConnState: 0xc0002e9800, {CONNECTING <nil>}
DEBU[0000] [core]Channel Connectivity change to CONNECTING
DEBU[0000] [core]pickfirstBalancer: UpdateSubConnState: 0xc0002e9800, {TRANSIENT_FAILURE connection error: desc = "transport: Error while dialing dial tcp: missing address"}
DEBU[0000] [core]Channel Connectivity change to TRANSIENT_FAILURE
DEBU[0001] [core]Channel Connectivity change to SHUTDOWN
DEBU[0001] [core]Subchannel Connectivity change to SHUTDOWN
FATA[0001] setup application-server client error: dial application-server api error: context deadline exceeded
When I display the config, using the configfile option, the configuration looks much different, e.g. IPs are missing.
Could it be, that not all arguments from this default template are replaced by the contents of the supplied config-file or am I missing a step somewhere?
Unfortunately that did not help. It only displays the configfile (i guess the default one). Without the -c flag i get already errors connecting to the database (wrong user). For that reason i adjusted the config and start all via: ./chirpstack-fuota-server -c ../packaging/files/chirpstack-fuota-server.toml.
The default config template included in the .deb was outdated (I forgot to update if during the v3 to v4 migration), however using the configfile you should be able to generate a new one. If that doesn’t work, please use this template as a starting point:
Thank you! Now, with the updated configuration, it works. Now I am facing one more problem with the firmware update using an end device. It seems that the communication between end device and FUOTA works, but that the data-fragments are not received properly. I think there might be a configuration issue that I cannot figure out.
I did configure the HTTP integration in chirpstack (localhost:8090 with protobuf) and adjusted the go-example to my appplication (App-Id, DevEui, mcRootKey).
For the line: mcRootKey, err := multicastsetup.GetMcRootKeyForGenAppKey(lorawan.AES128Key{ I used the AppKey from my end device.
Running the example client, confirms that the deployment is successfully created. In my end device using a FOTA Demo from ST, I see the multicast-group setup and the fragmentation setup.
But then it seems that I never receive actual data fragments (I also tried it with a 70kB firmware). I only receive the FragmentationSessionStatus message afterwards, while in the Chirpstack log i see all the successfull gRPC requests.
Is there any configuration step missing or wrong?
In the FUOTA component I get a warning in the beginning: ‘DEBU[0765] [transport]transport: loopyWriter.run returning. connection error: desc = “transport is closing”’
Also at the end i see that not all has finished properly: WARN[29429] fuota: fragmentation-session status request reached max. number of attempts, some devices did not complete deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
The client log looks as follows:
INFO[28875] storage: deployment created id=71567901-978e-45f5-9a48-84ba918e6055
INFO[28875] storage: deployment device created deployment_id=71567901-978e-45f5-9a48-84ba918e6055 dev_eui=70b3d58ff003306f
DEBU[28875] fuota: stepCreateMulticastGroup funtion called deployment_id=71567901-978e-45f5-9a48-84ba918e6055
WARN[28875] [transport] transport: http2Server.HandleStreams failed to read frame: read tcp [::1]:8070->[::1]:33814: read: connection reset by peer
DEBU[28875] [transport]transport: loopyWriter.run returning. connection error: desc = "transport is closing"
INFO[28875] finished client unary call grpc.code=OK grpc.method=Create grpc.service=api.MulticastGroupService grpc.time_ms=13.606 span.kind=client system=grpc
INFO[28875] fuota: multicast-group created deployment_id=71567901-978e-45f5-9a48-84ba918e6055 multicast_group_id=5e3fa32d-77c4-4659-b118-14b333459fe9
INFO[28875] fuota: add devices to multicast-group deployment_id=71567901-978e-45f5-9a48-84ba918e6055
INFO[28875] fuota: add device to multicast-group deployment_id=71567901-978e-45f5-9a48-84ba918e6055 dev_eui=70b3d58ff003306f multicast_group_id=5e3fa32d-77c4-4659-b118-14b333459fe9
INFO[28875] finished client unary call grpc.code=OK grpc.method=AddDevice grpc.service=api.MulticastGroupService grpc.time_ms=18.099 span.kind=client system=grpc
INFO[28875] fuota: starting multicast-setup for devices deployment_id=71567901-978e-45f5-9a48-84ba918e6055
INFO[28875] fuota: initiate multicast-setup for device attempt=1 deployment_id=71567901-978e-45f5-9a48-84ba918e6055 dev_eui=70b3d58ff003306f
INFO[28875] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.DeviceService grpc.time_ms=8.125 span.kind=client system=grpc
INFO[28875] storage: deployment log created command=McGroupSetupReq deployment_id=71567901-978e-45f5-9a48-84ba918e6055 dev_eui=70b3d58ff003306f
WARN[28935] fuota: multicast-setup reached max. number of attepts, some devices did not complete deployment_id=71567901-978e-45f5-9a48-84ba918e6055
INFO[28935] storage: deployment updated id=71567901-978e-45f5-9a48-84ba918e6055
INFO[28935] fuota: starting fragmentation-session setup for devices deployment_id=71567901-978e-45f5-9a48-84ba918e6055
WARN[28995] fuota: fragmentation-session setup reached max. number of attempts, some devices did not complete deployment_id=71567901-978e-45f5-9a48-84ba918e6055
INFO[28995] storage: deployment updated id=71567901-978e-45f5-9a48-84ba918e6055
INFO[28995] fuota: starting multicast class-c session setup for devices deployment_id=71567901-978e-45f5-9a48-84ba918e6055
WARN[29055] fuota: multicast class-c session setup reached max. number of attempts, some devices did not complete deployment_id=71567901-978e-45f5-9a48-84ba918e6055
INFO[29055] storage: deployment updated id=71567901-978e-45f5-9a48-84ba918e6055
INFO[29055] fuota: starting multicast enqueue deployment_id=71567901-978e-45f5-9a48-84ba918e6055
INFO[29055] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.MulticastGroupService grpc.time_ms=30.45 span.kind=client system=grpc
INFO[29055] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.MulticastGroupService grpc.time_ms=14.378 span.kind=client system=grpc
INFO[29055] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.MulticastGroupService grpc.time_ms=13.112 span.kind=client system=grpc
INFO[29055] storage: deployment updated id=71567901-978e-45f5-9a48-84ba918e6055
INFO[29055] fuota: waiting for multicast-session to end for devices before sending fragmentation-session status request deployment_id=71567901-978e-45f5-9a48-84ba918e6055 sleep_time=1m3.928109268s
INFO[29119] fuota: starting fragmentation-session status request for devices deployment_id=71567901-978e-45f5-9a48-84ba918e6055
WARN[29179] fuota: fragmentation-session status request reached max. number of attempts, some devices did not complete deployment_id=71567901-978e-45f5-9a48-84ba918e6055
INFO[29179] storage: deployment updated id=71567901-978e-45f5-9a48-84ba918e6055
INFO[29179] fuota: deleting multicast-group deployment_id=71567901-978e-45f5-9a48-84ba918e6055
INFO[29179] finished client unary call grpc.code=OK grpc.method=Delete grpc.service=api.MulticastGroupService grpc.time_ms=15.495 span.kind=client system=grpc
INFO[29179] fuota: multicast-group deleted deployment_id=71567901-978e-45f5-9a48-84ba918e6055 multicast_group_id=5e3fa32d-77c4-4659-b118-14b333459fe9
INFO[29312] storage: deployment created id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29312] storage: deployment device created deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
DEBU[29312] fuota: stepCreateMulticastGroup funtion called deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
DEBU[29312] [transport]transport: loopyWriter.run returning. connection error: desc = "transport is closing"
INFO[29312] finished client unary call grpc.code=OK grpc.method=Create grpc.service=api.MulticastGroupService grpc.time_ms=16.887 span.kind=client system=grpc
INFO[29312] fuota: multicast-group created deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f multicast_group_id=5c106f7b-bad6-4d6d-bb51-9b5e70aa2346
INFO[29312] fuota: add devices to multicast-group deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29312] fuota: add device to multicast-group deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78 multicast_group_id=5c106f7b-bad6-4d6d-bb51-9b5e70aa2346
INFO[29312] finished client unary call grpc.code=OK grpc.method=AddDevice grpc.service=api.MulticastGroupService grpc.time_ms=19.194 span.kind=client system=grpc
INFO[29312] fuota: starting multicast-setup for devices deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29312] fuota: initiate multicast-setup for device attempt=1 deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29312] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.DeviceService grpc.time_ms=10.662 span.kind=client system=grpc
INFO[29312] storage: deployment log created command=McGroupSetupReq deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
DEBU[29317] eventhandler: event received from application-server data=0200 dev_eui=0080e11505005b78 event=up f_cnt=1 f_port=200
INFO[29317] fuota: multicast-setup command received cid=McGroupSetupReq deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29317] fuota: McGroupSetupAns received deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78 id_error=false mc_group_id=0
INFO[29317] storage: deployment log created command=McGroupSetupAns deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29317] storage: deployment device updated deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29317] fuota: multicast-setup completed successful for all devices deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29317] storage: deployment updated id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29317] fuota: starting fragmentation-session setup for devices deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29317] fuota: initiate fragmentation-session setup for device attempt=1 deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29317] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.DeviceService grpc.time_ms=11.629 span.kind=client system=grpc
INFO[29317] storage: deployment log created command=FragSessionSetupReq deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
DEBU[29324] eventhandler: event received from application-server data=0200 dev_eui=0080e11505005b78 event=up f_cnt=2 f_port=201
INFO[29324] fuota: fragmentation-session setup command received cid=FragSessionSetupReq deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29324] fuota: FragSessionSetupAns received deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78 encoding_unsupported=false frag_index=0 frag_session_index_not_supported=false not_enough_memory=false wrong_descriptor=false
INFO[29324] storage: deployment log created command=FragSessionSetupAns deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29324] storage: deployment device updated deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29324] fuota: fragmentation-session setup completed successful for all devices deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29325] storage: deployment updated id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29325] fuota: starting multicast class-c session setup for devices deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29325] fuota: initiate multicast class-c session setup for device attempt=1 deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29325] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.DeviceService grpc.time_ms=139.092 span.kind=client system=grpc
INFO[29325] storage: deployment log created command=McClassCSessionReq deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
DEBU[29333] eventhandler: event received from application-server data=04007e1ed1 dev_eui=0080e11505005b78 event=up f_cnt=3 f_port=200
INFO[29333] fuota: multicast-setup command received cid=McClassCSessionReq deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29333] fuota: McClassCSessionAns received deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78 dr_error=false freq_error=false mc_group_id=0 mc_group_undefined=false
INFO[29333] storage: deployment log created command=McClassCSessionAns deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29333] storage: deployment device updated deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29333] fuota: multicast class-c session setup completed successful for all devices deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29334] storage: deployment updated id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29334] fuota: starting multicast enqueue deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29334] fuota: waiting with enqueue until multicast-session starts deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f sleep_time=11.001307784s
INFO[29345] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.MulticastGroupService grpc.time_ms=426.077 span.kind=client system=grpc
...
INFO[29394] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.MulticastGroupService grpc.time_ms=12.518 span.kind=client system=grpc
INFO[29394] storage: deployment updated id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29394] fuota: waiting for multicast-session to end for devices before sending fragmentation-session status request deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f sleep_time=14.967305474s
INFO[29409] fuota: starting fragmentation-session status request for devices deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29409] fuota: request fragmentation-session status for device attempt=1 deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
INFO[29409] finished client unary call grpc.code=OK grpc.method=Enqueue grpc.service=api.DeviceService grpc.time_ms=8.624 span.kind=client system=grpc
INFO[29409] storage: deployment log created command=FragSessionStatusReq deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f dev_eui=0080e11505005b78
WARN[29429] fuota: fragmentation-session status request reached max. number of attempts, some devices did not complete deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29429] storage: deployment updated id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29429] fuota: deleting multicast-group deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f
INFO[29429] finished client unary call grpc.code=OK grpc.method=Delete grpc.service=api.MulticastGroupService grpc.time_ms=20.304 span.kind=client system=grpc
INFO[29429] fuota: multicast-group deleted deployment_id=e9c4106a-1069-46a3-84de-e107f3a0669f multicast_group_id=5c106f7b-bad6-4d6d-bb51-9b5e70aa2346