swarm-victoriametrics: own network namespace, gateway over a unix socket
The metrics store's container gets privateNetwork = true with no interface but loopback. VictoriaMetrics listens on unix:/run/swarm-victoriametrics/victoriametrics.sock, a host directory (root:nginx 0770) bind-mounted into the container, and every vhost location that forwarded to 127.0.0.1:8428 now forwards to that socket. The store runs as a static user whose primary group is nginx's gid, with UMask 0007, so the socket it creates is 0770 group nginx. This relies on VictoriaMetrics >= 1.153.0 honouring the umask (the locked nixpkgs ships 1.153.0). nixpkgs' readiness loop curls a TCP URL, so postStart is replaced with the same loop over --unix-socket. swarm.victoriametrics.port is removed (nothing binds it any more), with a mkRemovedOptionModule entry, and dropped from swarm-otel's host port-collision assertion. The container's resolver unit is dropped: there is no interface to reach the bridge resolver through, and the store resolves no names. The collector scrape, the collector push and Grafana's datasource already reach the store by its published domain, so they are unchanged. Refs #4815 Refs #3560
This commit is contained in:
parent
065933b83e
commit
5e653ab9b5
1 changed files with 139 additions and 59 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# The swarm's metrics store as every hive sees it: the name it answers on and
|
||||
# its port, identical on every host. What the host running it decides, and the
|
||||
# The swarm's metrics store as every hive sees it: the name it answers on,
|
||||
# identical on every host. What the host running it decides, and the
|
||||
# container itself, are in ./swarm-victoriametrics.nix.
|
||||
{
|
||||
lib,
|
||||
|
|
@ -16,8 +16,8 @@ let
|
|||
domainBase = if swarmDomain == null then "invalid" else swarmDomain;
|
||||
in
|
||||
{
|
||||
# What the store IS from any hive's point of view: the name it answers on and
|
||||
# the port. `enable`, `package` and `retentionPeriod` are decisions of the
|
||||
# What the store IS from any hive's point of view: the name it answers on.
|
||||
# `enable`, `package` and `retentionPeriod` are decisions of the
|
||||
# host that runs it and live under `deploy.*`.
|
||||
options.services.hyperhive.swarm.victoriametrics = {
|
||||
machine = lib.mkOption {
|
||||
|
|
@ -42,18 +42,5 @@ in
|
|||
child decides which CA may sign it.
|
||||
'';
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8428;
|
||||
description = ''
|
||||
Port VictoriaMetrics listens on, bound to loopback only on the
|
||||
host that runs it: its write endpoint is unauthenticated, so the
|
||||
gateway's vhost there is the only route to it. Upstream's own
|
||||
default, kept so an operator reading VictoriaMetrics
|
||||
documentation finds what they expect.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue