ship the cache's init units' journal from a host with no collector, with the cache's own client
This commit is contained in:
parent
5e5ff64b3c
commit
a3682a5e9a
1 changed files with 137 additions and 7 deletions
|
|
@ -119,6 +119,18 @@ let
|
|||
forwarderTelemetryPort = 8903;
|
||||
forwarderOtlpPort = 8905;
|
||||
|
||||
# The host's init units' journal. The hive collector ships it where one runs
|
||||
# (`otel.journalUnits`), and the swarm collector reads the whole journal where
|
||||
# that runs. A host with neither ships it with the forwarder module on the
|
||||
# host itself, as the cache's own client, so nothing new is registered. The
|
||||
# loopback port is the host's, apart from the container's own netns.
|
||||
initUnits = [
|
||||
"swarm-bao-attic-secret.service"
|
||||
"swarm-bao-attic-tokens.service"
|
||||
];
|
||||
shipsOwnJournal = !hyperhiveCfg.otel.collector.enable && !hyperhiveCfg.deploy.swarm-otel.enable;
|
||||
hostForwarderTelemetryPort = 8907;
|
||||
|
||||
# The exporter's unit and query. `V` is attic's stored value for a valid
|
||||
# chunk (`ChunkState::Valid`) and for a valid NAR (`NarState::Valid`).
|
||||
# `file_size` is the compressed size on disk, and each chunk is one row
|
||||
|
|
@ -169,6 +181,16 @@ in
|
|||
hostUnit = true;
|
||||
inherit (cfg) enable;
|
||||
})
|
||||
# The host's own forwarder below dials the swarm collector and authelia by
|
||||
# name, as the container's does.
|
||||
(caTrust.trustBundle {
|
||||
inherit pkgs;
|
||||
name = "swarm-attic-host-journal";
|
||||
consumers = [ "opentelemetry-collector" ];
|
||||
hostUnit = true;
|
||||
enable = cfg.enable && shipsOwnJournal;
|
||||
})
|
||||
../container-modules/swarm-journal-forwarder.nix
|
||||
];
|
||||
|
||||
options.services.hyperhive.deploy.attic = {
|
||||
|
|
@ -292,10 +314,30 @@ in
|
|||
# The init units' journal reaches the log store through the hive collector.
|
||||
# A host that also runs the swarm collector ships its whole journal already
|
||||
# (./swarm-otel.nix), so naming them there would send each line twice.
|
||||
services.hyperhive.otel.journalUnits = lib.optionals (!hyperhiveCfg.deploy.swarm-otel.enable) [
|
||||
"swarm-bao-attic-secret.service"
|
||||
"swarm-bao-attic-tokens.service"
|
||||
];
|
||||
services.hyperhive.otel.journalUnits = lib.optionals (
|
||||
!hyperhiveCfg.deploy.swarm-otel.enable
|
||||
) initUnits;
|
||||
|
||||
# A host with no collector of its own: the units' journal goes to the swarm
|
||||
# collector's route for the cache, which the cache's client and leaf
|
||||
# already reach (the container's forwarder below uses both).
|
||||
services.hyperhive.swarmJournalForwarder = lib.mkIf shipsOwnJournal {
|
||||
enable = true;
|
||||
serviceName = "attic-host";
|
||||
units = initUnits;
|
||||
endpoint = forwarderEndpoint;
|
||||
clientId = forwarderClientId;
|
||||
tokenUrl = "${toString autheliaCfg.url}/api/oidc/token";
|
||||
telemetryPort = hostForwarderTelemetryPort;
|
||||
store = {
|
||||
package = baoDeploy.package;
|
||||
addr = "https://${baoCfg.domain}:${toString baoCfg.port}";
|
||||
secretPath = "secret/swarm/services/${forwarderClientId}/oidc/client";
|
||||
clientCertFile = baoDeploy.atticClientCertFile;
|
||||
clientKeyFile = baoDeploy.atticClientKeyFile;
|
||||
caFile = baoDeploy.serverCaFile;
|
||||
};
|
||||
};
|
||||
|
||||
# This host serves the vhost, and the host's own resolver finds the name.
|
||||
services.hyperhive.gateway.enable = lib.mkDefault true;
|
||||
|
|
|
|||
Loading…
Reference in a new issue