Commit Graph

604 Commits

Author SHA1 Message Date
Orne Brocaar
c62f2b6474 Immediately return PG conn after use.
Same as the previous commit, this will returns the PG connection back to
the pool after usage, avoiding the risk that we are holding the conn
longer than needed.
2023-12-12 11:22:15 +00:00
Orne Brocaar
fccf762c39 Immediately return Redis conn after use.
Before the Redis connection would be returned once variable c went out
of scope, in most cases at the return of the function. This would mean
that during the execution of the remaining code within the function,
the Redis connection would be reserved.

With this change, the Redis connection is immediately returned to the
pool after usage.
2023-12-12 11:02:29 +00:00
Orne Brocaar
f57aa32f23 ui: Update dependencies. 2023-12-11 16:14:13 +00:00
Orne Brocaar
fb29d7f58d Update rdkafka dependency. 2023-12-11 11:37:12 +00:00
Orne Brocaar
f0987af114 Update prometheus-client. 2023-12-11 11:33:19 +00:00
Orne Brocaar
691cee7beb Upgrade jsonwebtoken dependency.
Since v9 setting the audience is mandatory.
2023-12-11 11:23:52 +00:00
Orne Brocaar
0ff05a9285 Update dependencies (cargo update). 2023-12-11 11:10:06 +00:00
Orne Brocaar
2774c51ea2 Refactor client-cert generator to use rustls/rcgen.
This refactors the last bit of code that depends on the OpenSSL C
library. Note that the openssl-probe does not depend on OpenSSL, it only
tries to detect the CA certificate directory on the host system.
2023-12-11 10:55:36 +00:00
Orne Brocaar
fe98673bbb Fix uncommited configuration change. 2023-12-11 10:55:36 +00:00
Orne Brocaar
a0d4e80720 Fix remaining blocking code after async Redis refactor.
This code still used channel.blocking_send(..) and sleep from std::time.
As async anonymous functions are not (yet) supported, this moves the
stream handling into a separate async function.
2023-12-11 10:55:36 +00:00
Orne Brocaar
53a570b0b0 Update httpmock (dev dep) to 0.7.0-rc.1.
This version removes the isahc depencency, which causes openssl to be
added as a dependency. Version 0.7 makes this dependency optional.
2023-12-11 10:55:36 +00:00
Orne Brocaar
5108f4451c Implement MQTT shared-subscription for gw backend. 2023-12-11 10:55:36 +00:00
Orne Brocaar
5b6d037469 Refactor gateway MQTT backend to use rumqttc. 2023-12-11 10:55:36 +00:00
Orne Brocaar
ed06de231e Refactor getting PostgreSQL ca certs. 2023-12-11 10:55:36 +00:00
Orne Brocaar
17f0d8c495 Refactor MQTT integration to use rumqttc. 2023-12-11 10:55:36 +00:00
Orne Brocaar
345d0d8462 Refactor code to use async redis. 2023-12-11 10:55:36 +00:00
Orne Brocaar
8e2eda3d5b Refactor code to use diesel-async.
This still depends on unreleased diesel and diesel-async code. As soon
as new diesel and diesel-async code has been released, we can remove
the [patch.crates-io] from Cargo.toml.
2023-12-11 10:55:35 +00:00
Orne Brocaar
3f57609981 Update code examples. 2023-12-07 09:43:57 +00:00
Orne Brocaar
8e3f2aa3d2 Bump chirpstack_integration version. 2023-12-07 09:22:19 +00:00
Orne Brocaar
f647949c05 Bump version to 4.6.0 2023-12-07 09:13:36 +00:00
Orne Brocaar
20e28407d0 Bump version to 4.6.0-test.4 2023-11-28 13:01:40 +00:00
Orne Brocaar
1a153b01f4 Change v4_migrate default to false.
This flag helps to migrate from v3 to v4 and adds a compatibility layer
to support ChirpStack Gateway Bridge v3.14+. The plan was to default
this to false in an earlier release, but this change never happened.
2023-11-27 09:09:37 +00:00
Orne Brocaar
1b0deedb64 ui: Update dependencies. 2023-11-23 15:54:00 +00:00
Orne Brocaar
20ab51052d Update dependencies. 2023-11-23 15:27:20 +00:00
Orne Brocaar
8797df2e05 Return err if ThingsBoardAccessToken is missing.
Before this would default to an empty string, which would return in an
invalid URL.

Fixes #277.
2023-11-23 15:14:40 +00:00
Orne Brocaar
687d0b1c62 Add assume_email_verified option for OIDC.
Fixes #302.
2023-11-23 15:05:27 +00:00
Orne Brocaar
0f9674ec0a Change log from warn > debug.
This was changed from error to warn, but a debug is better as there is
not really something to warn the user about and with many devices
this might become very noisy.
2023-11-23 13:25:06 +00:00
Orne Brocaar
8e6079ec9c Fix sending empty downlink to Relay (adr_ack_req=true).
In case a Relay would send an uplink with adr_ack_req=true, this would
not result in an empty downlink in case there is no downlink to relay
back to the relay end-device.
2023-11-23 13:10:10 +00:00
Orne Brocaar
3538145e3d Add allow roaming option to device-profile. 2023-11-23 08:53:47 +00:00
Orne Brocaar
f13a5f492c Bump version to 4.6.0-test.3 2023-11-22 11:28:00 +00:00
Orne Brocaar
c0cd3a3361 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).
2023-11-22 11:10:13 +00:00
Orne Brocaar
5fd56e7e3c Bump version to 4.6.0-test.2 2023-11-20 12:33:52 +00:00
Orne Brocaar
940790add1 Update Rust to 1.74.0. 2023-11-20 12:09:02 +00:00
Orne Brocaar
1e619f90a0 Fix fmt issue. 2023-11-15 12:58:22 +00:00
Orne Brocaar
f7cd5a5a58 Get all device data in one query.
Instead of querying the device, device-profile, tenant and application
in separate queries.
2023-11-15 12:49:13 +00:00
Orne Brocaar
f81b868a31 ui: Reload device on change event.
Fixes #319.
2023-11-13 14:17:45 +00:00
Orne Brocaar
464937169b ui: Make device metric name optional.
If enabled, metrics will be automatically detected and created based on
the decoded payload. The key will be set, but the name is left blank for
the user to configure. This can be confusing as it leads to validation
errors in the device-profile form if the name is not filled in.
The UI does show that one of the fields failed to validate, but even
with such notification, it is not clear that users have to check one
of the form tabs which they didn't edit on save.

This makes the name optional and uses the key as fallback such that
saving the form no longer fails in case the name is still blank.

Closes #313.
2023-11-10 16:50:17 +00:00
Conny Andersson
b0ed12a1f5
Add the misspelled UnkownReceiver as a valid ResultCode in BE (#317) 2023-11-10 15:56:01 +00:00
Orne Brocaar
64277b1d9f Simplify AWS SNS integration / reduce dependencies.
This removes the aws-sdk-sns crate (+ dependencies) and refactors the
AWS SNS integration to use reqwest for the API call + aws-sign-v4 for
creating the AWS request signature.
2023-11-09 13:22:10 +00:00
Orne Brocaar
d24c830cd5 backend: Add sender_id to log span. 2023-11-07 12:02:55 +00:00
Orne Brocaar
4d822b56ef backend: Improve request logging. 2023-11-07 11:58:21 +00:00
Orne Brocaar
3b5627f43e Fix join-accept log span.
This shows the actual downlink_id of the join-accept downlink, which can
be correlated with the other log messages (e.g. tx_ack).
2023-11-07 11:15:51 +00:00
Orne Brocaar
500fd0f099 Add additional uplink metrics. 2023-11-07 09:46:02 +00:00
Orne Brocaar
9ea174910f Use unbounded MQTT client channel.
Even with the messages being handled async (tokio::spawn(...)), during
high throughput or a burst of messages, the channel might still fill up
causing messages to be discarded without any error being printed.
2023-11-07 09:46:02 +00:00
Orne Brocaar
b6d390b6ad ui: Fix setting initial tagsMap in TenantForm. 2023-11-07 09:46:02 +00:00
Conny Andersson
3f86bf6e71
backend: Skip serde serialization for Option<T> fields with None value. (#316) 2023-11-06 09:23:22 +00:00
Orne Brocaar
575cf45953 Use Error::Abort for Class-C downlink without first uplink. 2023-11-03 14:30:09 +00:00
Orne Brocaar
529e0cfed2 Use alternate error formatting in ToStatus trait impl. 2023-11-03 14:15:49 +00:00
Orne Brocaar
612662cd0b Fix :: > : in Redis key. 2023-11-02 15:30:34 +00:00
Orne Brocaar
07a6ce8c60 api: Update Go dependencies. 2023-11-02 14:23:31 +00:00