Commit Graph

35 Commits

Author SHA1 Message Date
Vincent Bernat
bd37c1d553 common/httpserver: listen on an abstract Unix socket
And make healthcheck command use it by default. This makes the
healthcheck command works whatever port the user has configured for the
HTTP service.
2025-11-24 11:29:45 +01:00
Vincent Bernat
abca5e983d chore: modernize some code 2025-11-14 23:22:02 +01:00
Vincent Bernat
d4ea88067e cmd: log an event when orchestrator should be restarted
Some checks failed
CI / 🤖 Check dependabot status (push) Has been cancelled
CI / 🐧 Test on Linux (${{ github.ref_type == 'tag' }}, misc) (push) Has been cancelled
CI / 🐧 Test on Linux (coverage) (push) Has been cancelled
CI / 🐧 Test on Linux (regular) (push) Has been cancelled
CI / ❄️ Build on Nix (push) Has been cancelled
CI / 🍏 Build and test on macOS (push) Has been cancelled
CI / 🧪 End-to-end testing (push) Has been cancelled
CI / 🔍 Upload code coverage (push) Has been cancelled
CI / 🔬 Test only Go (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 20) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 22) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 24) (push) Has been cancelled
CI / ⚖️ Check licenses (push) Has been cancelled
CI / 🐋 Build Docker images (push) Has been cancelled
CI / 🐋 Tag Docker images (push) Has been cancelled
CI / 🚀 Publish release (push) Has been cancelled
Update Nix dependency hashes / Update dependency hashes (push) Has been cancelled
2025-10-17 16:55:17 +02:00
Vincent Bernat
0f72ffd676 cmd: automatic restart of orchestrator on configuration change 2025-09-19 21:53:01 +02:00
Vincent Bernat
7caae8f991 cmd: add a diode to avoid log blocking 2025-09-12 14:39:48 +02:00
Vincent Bernat
98eb1bdba5 chore: make a run of gofumpt 2025-08-05 06:21:34 +02:00
Vincent Bernat
332435d650 docs: Netflow → NetFlow 2025-07-31 09:13:37 +02:00
Vincent Bernat
ac68c5970e inlet: split inlet into new inlet and outlet
This change split the inlet component into a simpler inlet and a new
outlet component. The new inlet component receive flows and put them in
Kafka, unparsed. The outlet component takes them from Kafka and resume
the processing from here (flow parsing, enrichment) and puts them in
ClickHouse.

The main goal is to ensure the inlet does a minimal work to not be late
when processing packets (and restart faster). It also brings some
simplification as the number of knobs to tune everything is reduced: for
inlet, we only need to tune the queue size for UDP, the number of
workers and a few Kafka parameters; for outlet, we need to tune a few
Kafka parameters, the number of workers and a few ClickHouse parameters.

The outlet component features a simple Kafka input component. The core
component becomes just a callback function. There is also a new
ClickHouse component to push data to ClickHouse using the low-level
ch-go library with batch inserts.

This processing has an impact on the internal representation of a
FlowMessage. Previously, it was tailored to dynamically build the
protobuf message to be put in Kafka. Now, it builds the batch request to
be sent to ClickHouse. This makes the FlowMessage structure hides the
content of the next batch request and therefore, it should be reused.
This also changes the way we decode flows as they don't output
FlowMessage anymore, they reuse one that is provided to each worker.

The ClickHouse tables are slightly updated. Instead of using Kafka
engine, the Null engine is used instead.

Fix #1122
2025-07-27 21:44:28 +02:00
Vincent Bernat
d60a714b8c orchestrator/clickhouse: do not embed clickhouse database settings
Instead, properly use them from the clickhousedb component. Also provide
some automatic migration.
2025-07-08 09:06:31 +02:00
Vincent Bernat
445039896e cmd/orchestrator: use default GeoIP configuration 2025-07-06 11:01:41 +02:00
Vincent Bernat
fb3f5f976b common: use slices from standard library instead of x/exp/slices 2025-06-15 13:58:30 +02:00
Vincent Bernat
8686e1cbd2 cmd/orchestrator: override ClickHouse/Kafka configurations when not set
The orchestrator overrides the ClickHouse and Kafka configuration for
the inlet and the console. This changes the behaviour to only do that if
`servers` or `brokers` key are not set.

Fix #1645
2025-02-15 15:20:14 +01:00
Vincent Bernat
e08331a286 common/helpers: switch to a blessed fork of mapstructure 2025-02-15 14:51:17 +01:00
Vincent Bernat
a449736a62 build: use Go 1.22 range over ints
Done with:

```
git grep -l 'for.*:= 0.*++' \
  | xargs sed -i -E 's/for (.*) := 0; \1 < (.*); \1\+\+/for \1 := range \2/'
```

And a few manual fixes due to unused variables. There is something fishy
in BMP rib test. Add a comment about that. This is not equivalent (as
with range, random is evaluated once, while in the original loop, it is
evaluated at each iteration). I believe the intent was to behave like
with range.
2024-08-14 10:11:35 +02:00
Gregor Düster
706b792e0d Fix some typos 2024-06-16 17:31:03 +02:00
Vincent Bernat
e40da3da9c cmd: no need to duplicate ClickHouseDB configuration in orchestrator
Instantiate ClickHouseDB component from the configuration contained in
the ClickHouse component.
2024-06-12 11:19:50 +02:00
Vincent Bernat
318c6de17c orchestrator: move geoip as a top-level component
It is easier if we have a flat model for components.
2024-03-13 11:43:22 +01:00
Vincent Bernat
30ffb00252 cmd: add migration of geoip component from inlet to orchestrator 2024-03-11 17:57:04 +01:00
Francois Espinet
87a57bf82e Do geoip enrich in clickhouse instead of inlet
One solution to https://github.com/akvorado/akvorado/issues/62
2024-03-11 15:29:09 +01:00
Vincent Bernat
62521e629d common/http: rename to common/httpserver
This is a preparation to introduce an httpclient common package. And it
makes it easier to use http from the standard library.
2023-05-28 09:08:29 +02:00
Vincent Bernat
72d51d0512 common/schema: make enabled/disabled columns configurable 2023-01-19 18:53:21 +01:00
Vincent Bernat
c6a9319b57 common/schema: turns into a component
This is a first step to make it accept configuration. Most of the
changes are quite trivial, but I also ran into some difficulties with
query columns and filters. They need the schema for parsing, but parsing
happens before dependencies are instantiated (and even if it was not the
case, parsing is stateless). Therefore, I have added a `Validate()`
method that must be called after instantiation. Various bits `panic()`
if not validated to ensure we catch all cases.

The alternative to make the component manages a global state would have
been simpler but it would break once we add the ability to add or
disable columns.
2023-01-18 12:22:10 +01:00
Vincent Bernat
743c98a78f cmd/config: better validation
With maps and slices, we need to explicitely use `dive` to validate
the inner structs.
2022-08-24 00:34:24 +02:00
Vincent Bernat
684a219fac cmd: replace fake-exporter by demo-exporter
Also propagate this rename to configuration and code. It makes easier
to understand the purpose of such a command in the provided
`docker-compose` file.
2022-07-26 17:42:16 +02:00
Vincent Bernat
916674655a fakeexporter: for demo purpose, provide a fake exporter component
Also, add a complete docker-compose.yaml to improve out-of-the-box
experience.
2022-07-07 21:34:56 +02:00
Vincent Bernat
22eab774a4 cmd: change how default configuration values are built
For the orchestrator, we need to build default values for slice of
configurations. We introduce a Reset() method that will be called by
mapstructure.
2022-07-07 20:55:33 +02:00
Vincent Bernat
f67d2493b0 orchestrator: allow to register several configuration for a given service
Use the first one by default and if the index is not known. Remove
service registration as this is not used yet.
2022-06-29 15:45:59 +02:00
Vincent Bernat
8be1bca4fd license: AGPL-3.0-only
```
git ls-files \*.js \*.go \
  | xargs sed -i '1i // SPDX-FileCopyrightText: 2022 Free Mobile\n// SPDX-License-Identifier: AGPL-3.0-only\n'
git ls-files \*.vue \
  | xargs sed -i '1i <!-- SPDX-FileCopyrightText: 2022 Free Mobile -->\n<!-- SPDX-License-Identifier: AGPL-3.0-only -->\n'
```
2022-06-29 11:42:28 +02:00
Vincent Bernat
ff4d4f5702 cmd: make main subcomponent configuration inline 2022-06-13 09:50:43 +02:00
Vincent Bernat
ee26a468b0 orchestrator: move broker component as orchestrator
We can have one main subcomponent per component. We don't do that for
the inlet component as there is more configuration.
2022-06-13 09:50:43 +02:00
Vincent Bernat
4be33c70ba console: add an API to get the last received flow 2022-04-14 10:06:01 +02:00
Vincent Bernat
b44836aa97 common/clickhousedb: turn into a complete component
This enables us to mock it.
2022-04-12 23:33:22 +02:00
Vincent Bernat
270e54dea7 common/clickhouse: initialize 2022-04-12 11:58:15 +02:00
Vincent Bernat
2fed10c8d2 orchestrator/broker: implement the broker component
Currently, it only exposes the configuration to other components. In
the future, it should be able to interact with them somehow.
2022-04-10 17:43:15 +02:00
Vincent Bernat
93da599adf cmd: take configuration as a mandatory argument (+ other changes)
The other changes are:
 - rename configure service to orchestrator service
 - turn DefaultConfiguration variables into functions
2022-04-10 15:14:39 +02:00