Commit Graph

10 Commits

Author SHA1 Message Date
Orne Brocaar
c815c6be88 Update Rust + dev env. 2024-03-13 09:44:29 +00:00
Orne Brocaar
098f8db4c6 Migrate device-sessions from Redis to PostgreSQL.
This migrates the device-sessions from Redis into PostgreSQL. This fixes
a performance issue in case the same DevAddr is reused many times
(e.g. devices rejoining very often or a NetID with small DevAddr space).

There were two issues:

The Redis key containing the DevAddr -> DevEUIs mapping could contain
DevEUIs that no longer used the DevAddr. This mapping would only expire
from the Redis database after none of the devices would use the DevAddr
for more than the configured device_session_ttl.

The other issue with the previous approach was that on for example a
Type 7 NetID, a single DevAddr could be re-used multiple times. As each
device-session could be stored on a different Redis Cluster instance,
there was no option to retrieve all device-sessions at once. Thus a high
re-usage of a single DevAddr would cause an increase in Redis queries.

Both issues are solved by moving the device-session into PostgreSQL
as the DevAddr is a column of the device record and thus filtering on
this DevAddr would always result in the devices using that DevAddr, as
well all device-sessions for a DevAddr can be retrieved by a single
query.

Note that to migrate the device-sessions, you must run:

chirpstack -c path/to/config migrate-device-sessions-to-postgres

A nice side-effect is that a PostgreSQL backup / restore will also
restore the device connectivity.

Closes #362 and #74.
2024-02-27 16:17:15 +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
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
6f1638e87a Refactor UI to function elements & update React + Ant.
This refactor the UI components from class based element into function
based elements. This makes it possible to use hooks that are used now
by most React components. This also updates React and Ant to the latest
versions (+ other dependencies).
2023-07-27 13:07:00 +01:00
Orne Brocaar
e9be79e948 Set TZ correctly before running tests. 2023-07-05 11:06:36 +01:00
Orne Brocaar
a284a8179e Update shell.nix. 2023-06-05 12:35:00 +01:00
Orne Brocaar
4f90c87784 Add dotenv for test dependency config. 2023-05-30 12:13:52 +01:00
Orne Brocaar
1f89f30878 Refactor build scripts for cross-rs based cross compiling. 2023-05-30 12:13:52 +01:00
Orne Brocaar
e3383baa02 Add rust-toolchain.toml + shell.nix files.
This makes it easier to start a devshell without using Docker.
2023-05-17 14:46:13 +01:00