Compare commits
1 commit
master
...
pr-flake-u
Author | SHA1 | Date | |
---|---|---|---|
46164098c2 |
23 changed files with 130 additions and 185 deletions
|
@ -3,14 +3,12 @@
|
||||||
{
|
{
|
||||||
hostLinks = lib.pipe config.services [
|
hostLinks = lib.pipe config.services [
|
||||||
(lib.filterAttrs (_: svc: svc.meshLinks != {}))
|
(lib.filterAttrs (_: svc: svc.meshLinks != {}))
|
||||||
(lib.mapAttrsToList (svcName: svc:
|
(lib.mapAttrsToList (svcName: svc: lib.mapAttrsToList (name: cfg: lib.genAttrs svc.nodes.${name} (hostName: {
|
||||||
lib.mapAttrsToList (groupName: links:
|
${cfg.name} = { ... }: {
|
||||||
lib.genAttrs svc.nodes.${groupName} (hostName: lib.mapAttrs (_: cfg: { ... }: {
|
imports = [ cfg.link ];
|
||||||
imports = [ cfg.link ];
|
ipv4 = config.vars.mesh.${hostName}.meshIp;
|
||||||
ipv4 = config.vars.mesh.${hostName}.meshIp;
|
};
|
||||||
}) links)
|
})) svc.meshLinks))
|
||||||
) svc.meshLinks
|
|
||||||
))
|
|
||||||
(map lib.mkMerge)
|
(map lib.mkMerge)
|
||||||
lib.mkMerge
|
lib.mkMerge
|
||||||
];
|
];
|
||||||
|
|
|
@ -38,8 +38,12 @@ in
|
||||||
};
|
};
|
||||||
meshLinks = mkOption {
|
meshLinks = mkOption {
|
||||||
description = "Create host links on the mesh network.";
|
description = "Create host links on the mesh network.";
|
||||||
type = types.attrsOf (types.attrsOf (types.submodule {
|
type = types.attrsOf (types.submodule ({ name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
|
name = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "${serviceName}-${name}";
|
||||||
|
};
|
||||||
link = mkOption {
|
link = mkOption {
|
||||||
type = types.deferredModule;
|
type = types.deferredModule;
|
||||||
default = {};
|
default = {};
|
||||||
|
|
|
@ -74,7 +74,7 @@ in
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartMaxDelaySec = 30;
|
RestartMaxDelaySec = 30;
|
||||||
RestartSteps = 5;
|
RestartStesp = 5;
|
||||||
RestartMode = "direct";
|
RestartMode = "direct";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,10 @@
|
||||||
./nar-serve.nix
|
./nar-serve.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
meshLinks.server.attic.link.protocol = "http";
|
meshLinks.server = {
|
||||||
|
name = "attic";
|
||||||
|
link.protocol = "http";
|
||||||
|
};
|
||||||
secrets = let
|
secrets = let
|
||||||
inherit (config.services.attic) nodes;
|
inherit (config.services.attic) nodes;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -80,7 +80,6 @@ in
|
||||||
mode = if isMonolith then "manual" else "direct";
|
mode = if isMonolith then "manual" else "direct";
|
||||||
definition = {
|
definition = {
|
||||||
name = "atticd";
|
name = "atticd";
|
||||||
id = "atticd-${config.services.atticd.mode}";
|
|
||||||
address = link.ipv4;
|
address = link.ipv4;
|
||||||
inherit (link) port;
|
inherit (link) port;
|
||||||
checks = [
|
checks = [
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
services.forge = {
|
services.forge = {
|
||||||
nodes.server = [ "VEGAS" ];
|
nodes.server = [ "VEGAS" ];
|
||||||
nixos.server = ./server.nix;
|
nixos.server = ./server.nix;
|
||||||
meshLinks.server.forge.link.protocol = "http";
|
meshLinks.server = {
|
||||||
|
name = "forge";
|
||||||
|
link.protocol = "http";
|
||||||
|
};
|
||||||
secrets = with config.services.forge.nodes; {
|
secrets = with config.services.forge.nodes; {
|
||||||
oidcSecret = {
|
oidcSecret = {
|
||||||
nodes = server;
|
nodes = server;
|
||||||
|
|
|
@ -33,9 +33,6 @@ in
|
||||||
ldapbindaddress = "${ldapLink.ipv4}:${ldapLink.portStr}";
|
ldapbindaddress = "${ldapLink.ipv4}:${ldapLink.portStr}";
|
||||||
origin = frontendLink.url;
|
origin = frontendLink.url;
|
||||||
inherit domain;
|
inherit domain;
|
||||||
online_backup = {
|
|
||||||
versions = 7;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,10 @@
|
||||||
io-tweaks = [ "VEGAS" ];
|
io-tweaks = [ "VEGAS" ];
|
||||||
remote-api = [ "VEGAS" ];
|
remote-api = [ "VEGAS" ];
|
||||||
};
|
};
|
||||||
meshLinks.gateway.ipfsGateway.link.protocol = "http";
|
meshLinks.gateway = {
|
||||||
|
name = "ipfsGateway";
|
||||||
|
link.protocol = "http";
|
||||||
|
};
|
||||||
nixos = {
|
nixos = {
|
||||||
node = [
|
node = [
|
||||||
./node.nix
|
./node.nix
|
||||||
|
|
|
@ -9,7 +9,7 @@ in
|
||||||
environment = {
|
environment = {
|
||||||
OTEL_TRACES_EXPORTER = "otlp";
|
OTEL_TRACES_EXPORTER = "otlp";
|
||||||
OTEL_EXPORTER_OTLP_PROTOCOL = "grpc";
|
OTEL_EXPORTER_OTLP_PROTOCOL = "grpc";
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT = "${cluster.config.ways.ingest-traces-otlp.url}:443";
|
OTEL_EXPORTER_OTLP_ENDPOINT = cluster.config.links.tempo-otlp-grpc.url;
|
||||||
OTEL_TRACES_SAMPLER = "parentbased_traceidratio";
|
OTEL_TRACES_SAMPLER = "parentbased_traceidratio";
|
||||||
OTEL_TRACES_SAMPLER_ARG = "0.50";
|
OTEL_TRACES_SAMPLER_ARG = "0.50";
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,7 @@ in {
|
||||||
name = "logging";
|
name = "logging";
|
||||||
positions.filename = "\${STATE_DIRECTORY:/tmp}/logging-positions.yaml";
|
positions.filename = "\${STATE_DIRECTORY:/tmp}/logging-positions.yaml";
|
||||||
clients = singleton {
|
clients = singleton {
|
||||||
url = "${cluster.config.ways.ingest-logs.url}/loki/api/v1/push";
|
url = "${cluster.config.ways.monitoring-logs.url}/loki/api/v1/push";
|
||||||
};
|
};
|
||||||
scrape_configs = singleton {
|
scrape_configs = singleton {
|
||||||
job_name = "journal";
|
job_name = "journal";
|
||||||
|
|
|
@ -18,6 +18,26 @@ in
|
||||||
protocol = "http";
|
protocol = "http";
|
||||||
ipv4 = meshIpFor "server";
|
ipv4 = meshIpFor "server";
|
||||||
};
|
};
|
||||||
|
tempo = {
|
||||||
|
protocol = "http";
|
||||||
|
ipv4 = meshIpFor "server";
|
||||||
|
};
|
||||||
|
tempo-grpc = {
|
||||||
|
protocol = "http";
|
||||||
|
ipv4 = "127.0.0.1";
|
||||||
|
};
|
||||||
|
tempo-otlp-http = {
|
||||||
|
protocol = "http";
|
||||||
|
ipv4 = meshIpFor "server";
|
||||||
|
};
|
||||||
|
tempo-otlp-grpc = {
|
||||||
|
protocol = "http";
|
||||||
|
ipv4 = meshIpFor "server";
|
||||||
|
};
|
||||||
|
tempo-zipkin-http = {
|
||||||
|
protocol = "http";
|
||||||
|
ipv4 = meshIpFor "server";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
hostLinks = lib.genAttrs config.services.monitoring.nodes.grafana (name: {
|
hostLinks = lib.genAttrs config.services.monitoring.nodes.grafana (name: {
|
||||||
grafana = {
|
grafana = {
|
||||||
|
@ -31,7 +51,6 @@ in
|
||||||
blackbox = [ "checkmate" "grail" "prophet" ];
|
blackbox = [ "checkmate" "grail" "prophet" ];
|
||||||
grafana = [ "VEGAS" "prophet" ];
|
grafana = [ "VEGAS" "prophet" ];
|
||||||
logging = [ "VEGAS" "grail" ];
|
logging = [ "VEGAS" "grail" ];
|
||||||
tracing = [ "VEGAS" "grail" ];
|
|
||||||
server = [ "VEGAS" ];
|
server = [ "VEGAS" ];
|
||||||
};
|
};
|
||||||
nixos = {
|
nixos = {
|
||||||
|
@ -42,19 +61,14 @@ in
|
||||||
./provisioning/dashboards.nix
|
./provisioning/dashboards.nix
|
||||||
];
|
];
|
||||||
logging = ./logging.nix;
|
logging = ./logging.nix;
|
||||||
tracing = ./tracing.nix;
|
|
||||||
server = [
|
server = [
|
||||||
./server.nix
|
./server.nix
|
||||||
|
./tracing.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
meshLinks = {
|
meshLinks.logging = {
|
||||||
logging.loki.link.protocol = "http";
|
name = "loki";
|
||||||
tracing = {
|
link.protocol = "http";
|
||||||
tempo.link.protocol = "http";
|
|
||||||
tempo-otlp-http.link.protocol = "http";
|
|
||||||
tempo-otlp-grpc.link.protocol = "grpc";
|
|
||||||
tempo-zipkin-http.link.protocol = "http";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,51 +82,29 @@ in
|
||||||
nodes = config.services.monitoring.nodes.logging;
|
nodes = config.services.monitoring.nodes.logging;
|
||||||
format = "envFile";
|
format = "envFile";
|
||||||
};
|
};
|
||||||
tempo-ingest.locksmith = {
|
tempo = { };
|
||||||
nodes = config.services.monitoring.nodes.tracing;
|
|
||||||
format = "envFile";
|
|
||||||
};
|
|
||||||
tempo-query.locksmith = {
|
|
||||||
nodes = config.services.monitoring.nodes.tracing;
|
|
||||||
format = "envFile";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
buckets = {
|
buckets = {
|
||||||
loki-chunks.allow = {
|
loki-chunks.allow = {
|
||||||
loki-ingest = [ "read" "write" ];
|
loki-ingest = [ "read" "write" ];
|
||||||
loki-query = [ "read" ];
|
loki-query = [ "read" ];
|
||||||
};
|
};
|
||||||
tempo-chunks.allow = {
|
tempo-chunks.allow.tempo = [ "read" "write" ];
|
||||||
tempo-ingest = [ "read" "write" ];
|
|
||||||
tempo-query = [ "read" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ways = let
|
ways = config.lib.forService "monitoring" {
|
||||||
query = consulService: {
|
monitoring = {
|
||||||
inherit consulService;
|
consulService = "grafana";
|
||||||
internal = true;
|
extras.locations."/".proxyWebsockets = true;
|
||||||
extras.extraConfig = ''
|
|
||||||
proxy_read_timeout 3600s;
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
ingest = consulService: {
|
monitoring-logs = {
|
||||||
inherit consulService;
|
|
||||||
internal = true;
|
internal = true;
|
||||||
|
consulService = "loki";
|
||||||
extras.extraConfig = ''
|
extras.extraConfig = ''
|
||||||
client_max_body_size 4G;
|
client_max_body_size 4G;
|
||||||
proxy_read_timeout 3600s;
|
proxy_read_timeout 3600s;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in config.lib.forService "monitoring" {
|
|
||||||
monitoring = {
|
|
||||||
consulService = "grafana";
|
|
||||||
extras.locations."/".proxyWebsockets = true;
|
|
||||||
};
|
|
||||||
monitoring-logs = query "loki";
|
|
||||||
monitoring-traces = query "tempo";
|
|
||||||
ingest-logs = ingest "loki";
|
|
||||||
ingest-traces-otlp = ingest "tempo-ingest-otlp-grpc" // { grpc = true; };
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,16 +73,6 @@ in
|
||||||
inherit (cluster.config.ways.monitoring-logs) url;
|
inherit (cluster.config.ways.monitoring-logs) url;
|
||||||
type = "loki";
|
type = "loki";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
name = "Tempo";
|
|
||||||
uid = "P214B5B846CF3925F";
|
|
||||||
inherit (cluster.config.ways.monitoring-traces) url;
|
|
||||||
type = "tempo";
|
|
||||||
jsonData = {
|
|
||||||
serviceMap.datasourceUid = "PBFA97CFB590B2093";
|
|
||||||
nodeGraph.enabled = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
16
cluster/services/monitoring/secrets/tempo-secrets.age
Normal file
16
cluster/services/monitoring/secrets/tempo-secrets.age
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 NO562A KhCGp7PAMGrEdzRxBrsW4tRk30JwpI+4lPzrRCUhSw4
|
||||||
|
8s7WqA5c3zS1euN5R+jfFNBdvr8OQW8P4NFeqtNsIKo
|
||||||
|
-> ssh-ed25519 5/zT0w 79hJQ2H76EZTW7YcQFCtKaS5Kbssx4Z8dPFjIVzRgFk
|
||||||
|
A1fDJbUnyIRy+kWa3PhJNj/SdRPlcEy6FYsAfnuZ2AQ
|
||||||
|
-> ssh-ed25519 d3WGuA aylkdL1KliM1NfrYDGlG8X6YjXvVUCU4sV90I+a840U
|
||||||
|
6sXdqIPjtoNSylZRh1DCghHOwDo+fC7WB4QWQoWmG48
|
||||||
|
-> //gd+2-grease baUWA$3 z-qs3W O/2.1W
|
||||||
|
Sfq3+rkMJhpUTTmcos5TaaUtX2Ip9pciHAZLiWPix+C9N7ccac/1W5RNedMJCLsq
|
||||||
|
MQ+xKzexf8+hgNVhKOksvbKBBROXqk1bUOKk8w3OgFPmmByzmCBUwkdkeu5DFTYR
|
||||||
|
rg
|
||||||
|
--- kUl1uIPRkM5y7C68kdN22pMKXP7gazyha4PE+ap0Jqw
|
||||||
|
w>×Àè¥
|
||||||
|
<15>CÈ,\‰ßœI¯ˆúHxG@^Çá“PåÃþÙÏlw6µŽ{þ’rb‘é5æ†T>Êñ
|
||||||
|
ÚWܤX4Kp(ß?9ˆß^^oP3f </v3N$ê¤sÓbŽ¾>O™÷œ+òN0άïµàDtêŽ5Vº#è ¶³‘Uã îŸ#y|›@ŒGzSi»ô*·HùüŽ]
|
||||||
|
ꎀ5›
|
|
@ -1,16 +1,14 @@
|
||||||
{ cluster, config, pkgs, ... }:
|
{ cluster, config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (cluster.config.links) prometheus-ingest;
|
inherit (cluster.config) links;
|
||||||
inherit (config.links) tempo-grpc;
|
|
||||||
links = cluster.config.hostLinks.${config.networking.hostName};
|
|
||||||
dataDir = "/srv/storage/private/tempo";
|
dataDir = "/srv/storage/private/tempo";
|
||||||
tempoConfig = {
|
tempoConfig = {
|
||||||
server = {
|
server = {
|
||||||
http_listen_address = links.tempo.ipv4;
|
http_listen_address = links.tempo.ipv4;
|
||||||
http_listen_port = links.tempo.port;
|
http_listen_port = links.tempo.port;
|
||||||
grpc_listen_address = tempo-grpc.ipv4;
|
grpc_listen_address = links.tempo-grpc.ipv4;
|
||||||
grpc_listen_port = tempo-grpc.port;
|
grpc_listen_port = links.tempo-grpc.port;
|
||||||
};
|
};
|
||||||
distributor.receivers = {
|
distributor.receivers = {
|
||||||
otlp = {
|
otlp = {
|
||||||
|
@ -21,7 +19,7 @@ let
|
||||||
};
|
};
|
||||||
zipkin.endpoint = links.tempo-zipkin-http.tuple;
|
zipkin.endpoint = links.tempo-zipkin-http.tuple;
|
||||||
};
|
};
|
||||||
querier.frontend_worker.frontend_address = tempo-grpc.tuple;
|
querier.frontend_worker.frontend_address = links.tempo-grpc.tuple;
|
||||||
ingester = {
|
ingester = {
|
||||||
trace_idle_period = "30s";
|
trace_idle_period = "30s";
|
||||||
max_block_bytes = 1000000;
|
max_block_bytes = 1000000;
|
||||||
|
@ -58,7 +56,7 @@ let
|
||||||
path = "${dataDir}/generator/wal";
|
path = "${dataDir}/generator/wal";
|
||||||
remote_write = [
|
remote_write = [
|
||||||
{
|
{
|
||||||
url = "${prometheus-ingest.url}/api/v1/write";
|
url = "${links.prometheus-ingest.url}/api/v1/write";
|
||||||
send_exemplars = true;
|
send_exemplars = true;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -70,11 +68,7 @@ let
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
links.tempo-grpc.protocol = "http";
|
age.secrets.tempoSecrets.file = ./secrets/tempo-secrets.age;
|
||||||
|
|
||||||
services.locksmith.waitForSecrets.tempo = [
|
|
||||||
"garage-tempo-ingest"
|
|
||||||
];
|
|
||||||
|
|
||||||
users.users.tempo = {
|
users.users.tempo = {
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
|
@ -87,53 +81,24 @@ in {
|
||||||
|
|
||||||
systemd.services.tempo = {
|
systemd.services.tempo = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
distributed = {
|
|
||||||
enable = true;
|
|
||||||
registerServices = [
|
|
||||||
"tempo"
|
|
||||||
"tempo-ingest-otlp-grpc"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = "tempo";
|
User = "tempo";
|
||||||
Group = "tempo";
|
Group = "tempo";
|
||||||
ExecStart = "${pkgs.tempo}/bin/tempo -config.file=${pkgs.writeText "tempo.yaml" (builtins.toJSON tempoConfig)}";
|
ExecStart = "${pkgs.tempo}/bin/tempo -config.file=${pkgs.writeText "tempo.yaml" (builtins.toJSON tempoConfig)}";
|
||||||
PrivateTmp = true;
|
PrivateTmp = true;
|
||||||
EnvironmentFile = "/run/locksmith/garage-tempo-ingest";
|
EnvironmentFile = config.age.secrets.tempoSecrets.path;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
services.grafana.provision.datasources.settings.datasources = [
|
||||||
consul.services = {
|
{
|
||||||
tempo = {
|
name = "Tempo";
|
||||||
mode = "manual";
|
uid = "P214B5B846CF3925F";
|
||||||
definition = {
|
inherit (links.tempo) url;
|
||||||
name = "tempo";
|
type = "tempo";
|
||||||
address = links.tempo.ipv4;
|
jsonData = {
|
||||||
inherit (links.tempo) port;
|
serviceMap.datasourceUid = "PBFA97CFB590B2093"; # prometheus
|
||||||
checks = [
|
nodeGraph.enabled = true;
|
||||||
{
|
|
||||||
name = "Tempo";
|
|
||||||
id = "service:tempo:backend";
|
|
||||||
interval = "5s";
|
|
||||||
http = "${links.tempo.url}/ready";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
tempo-ingest-otlp-grpc = {
|
];
|
||||||
mode = "manual";
|
|
||||||
definition = {
|
|
||||||
name = "tempo-ingest-otlp-grpc";
|
|
||||||
address = links.tempo-otlp-grpc.ipv4;
|
|
||||||
inherit (links.tempo-otlp-grpc) port;
|
|
||||||
checks = [
|
|
||||||
{
|
|
||||||
name = "Tempo Service Status";
|
|
||||||
id = "service:tempo-ingest-otlp-grpc:tempo";
|
|
||||||
alias_service = "tempo";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, depot, ... }:
|
{ depot, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
services.sso = {
|
services.sso = {
|
||||||
|
@ -18,12 +18,4 @@
|
||||||
login.target = ssoAddr;
|
login.target = ssoAddr;
|
||||||
account.target = ssoAddr;
|
account.target = ssoAddr;
|
||||||
};
|
};
|
||||||
|
|
||||||
patroni = config.lib.forService "sso" {
|
|
||||||
databases.keycloak = {};
|
|
||||||
users.keycloak.locksmith = {
|
|
||||||
nodes = config.services.sso.nodes.host;
|
|
||||||
format = "raw";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,12 @@ in
|
||||||
{
|
{
|
||||||
links.keycloak.protocol = "http";
|
links.keycloak.protocol = "http";
|
||||||
|
|
||||||
services.locksmith.waitForSecrets.keycloak = [
|
age.secrets.keycloak-dbpass = {
|
||||||
"patroni-keycloak"
|
file = ../../../secrets/keycloak-dbpass.age;
|
||||||
];
|
owner = "root";
|
||||||
|
group = "root";
|
||||||
|
mode = "0400";
|
||||||
|
};
|
||||||
services.nginx.virtualHosts = {
|
services.nginx.virtualHosts = {
|
||||||
"${login}" = lib.recursiveUpdate (vhosts.proxy kc.url) {
|
"${login}" = lib.recursiveUpdate (vhosts.proxy kc.url) {
|
||||||
locations = {
|
locations = {
|
||||||
|
@ -34,7 +36,7 @@ in
|
||||||
host = patroni.ipv4;
|
host = patroni.ipv4;
|
||||||
inherit (patroni) port;
|
inherit (patroni) port;
|
||||||
useSSL = false;
|
useSSL = false;
|
||||||
passwordFile = "/run/locksmith/patroni-keycloak";
|
passwordFile = config.age.secrets.keycloak-dbpass.path;
|
||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
http-host = kc.ipv4;
|
http-host = kc.ipv4;
|
||||||
|
@ -52,7 +54,7 @@ in
|
||||||
"-Dotel.traces.exporter=otlp"
|
"-Dotel.traces.exporter=otlp"
|
||||||
];
|
];
|
||||||
OTEL_EXPORTER_OTLP_PROTOCOL = "grpc";
|
OTEL_EXPORTER_OTLP_PROTOCOL = "grpc";
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT = cluster.config.ways.ingest-traces-otlp.url;
|
OTEL_EXPORTER_OTLP_ENDPOINT = cluster.config.links.tempo-otlp-grpc.url;
|
||||||
OTEL_TRACES_SAMPLER = "parentbased_traceidratio";
|
OTEL_TRACES_SAMPLER = "parentbased_traceidratio";
|
||||||
OTEL_TRACES_SAMPLER_ARG = "0.50";
|
OTEL_TRACES_SAMPLER_ARG = "0.50";
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,9 +36,10 @@ in
|
||||||
inherit (linkWeb) port;
|
inherit (linkWeb) port;
|
||||||
checks = [
|
checks = [
|
||||||
{
|
{
|
||||||
name = "Garage Service Status";
|
name = "Garage Node";
|
||||||
id = "service:garage-web:garage";
|
id = "service:garage-web:node";
|
||||||
alias_service = "garage";
|
interval = "5s";
|
||||||
|
http = "${config.links.garageMetrics.url}/health";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,14 +25,7 @@ in
|
||||||
];
|
];
|
||||||
locations = lib.mkMerge [
|
locations = lib.mkMerge [
|
||||||
{
|
{
|
||||||
"/" = if cfg.grpc then {
|
"/".proxyPass = cfg.target;
|
||||||
extraConfig = ''
|
|
||||||
set $nix_proxy_grpc_target ${cfg.target};
|
|
||||||
grpc_pass $nix_proxy_grpc_target;
|
|
||||||
'';
|
|
||||||
} else {
|
|
||||||
proxyPass = cfg.target;
|
|
||||||
};
|
|
||||||
"${cfg.healthCheckPath}".extraConfig = "access_log off;";
|
"${cfg.healthCheckPath}".extraConfig = "access_log off;";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,12 +35,6 @@ with lib;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
grpc = mkOption {
|
|
||||||
description = "Whether this endpoint is a gRPC service.";
|
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
target = mkOption {
|
target = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
};
|
};
|
||||||
|
@ -107,7 +101,7 @@ with lib;
|
||||||
(lib.mkIf options.consulService.isDefined {
|
(lib.mkIf options.consulService.isDefined {
|
||||||
useConsul = true;
|
useConsul = true;
|
||||||
nginxUpstreamName = "ways_upstream_${builtins.hashString "md5" options.consulService.value}";
|
nginxUpstreamName = "ways_upstream_${builtins.hashString "md5" options.consulService.value}";
|
||||||
target = "${if config.grpc then "grpc" else "http"}://${options.nginxUpstreamName.value}";
|
target = "http://${options.nginxUpstreamName.value}";
|
||||||
})
|
})
|
||||||
(lib.mkIf options.bucket.isDefined {
|
(lib.mkIf options.bucket.isDefined {
|
||||||
consulService = "garage-web";
|
consulService = "garage-web";
|
||||||
|
|
36
flake.lock
36
flake.lock
|
@ -10,11 +10,11 @@
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722339003,
|
"lastModified": 1723293904,
|
||||||
"narHash": "sha256-ZeS51uJI30ehNkcZ4uKqT4ZDARPyqrHADSKAwv5vVCU=",
|
"narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=",
|
||||||
"owner": "ryantm",
|
"owner": "ryantm",
|
||||||
"repo": "agenix",
|
"repo": "agenix",
|
||||||
"rev": "3f1dae074a12feb7327b4bf43cbac0d124488bb7",
|
"rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -40,11 +40,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722472866,
|
"lastModified": 1724226964,
|
||||||
"narHash": "sha256-GJIz4M5HDB948Ex/8cPvbkrNzl/eKUE7/c21JBu4lb8=",
|
"narHash": "sha256-cltFh4su2vcFidxKp7LuEgX3ZGLfPy0DCdrQZ/QTe68=",
|
||||||
"owner": "zhaofengli",
|
"owner": "zhaofengli",
|
||||||
"repo": "attic",
|
"repo": "attic",
|
||||||
"rev": "e127acbf9a71ebc0c26bc8e28346822e0a6e16ba",
|
"rev": "6d9aeaef0a067d664cb11bb7704f7ec373d47fb2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -76,11 +76,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1717025063,
|
"lastModified": 1722960479,
|
||||||
"narHash": "sha256-dIubLa56W9sNNz0e8jGxrX3CAkPXsq7snuFA/Ie6dn8=",
|
"narHash": "sha256-NhCkJJQhD5GUib8zN9JrmYGMwt4lCRp6ZVNzIiYCl0Y=",
|
||||||
"owner": "ipetkov",
|
"owner": "ipetkov",
|
||||||
"repo": "crane",
|
"repo": "crane",
|
||||||
"rev": "480dff0be03dac0e51a8dfc26e882b0d123a450e",
|
"rev": "4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -268,11 +268,11 @@
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720223941,
|
"lastModified": 1723736589,
|
||||||
"narHash": "sha256-QDbU8LZzcUSqBp1CBqDj/f5Wd/sdgQ8pZwRWueoMUL4=",
|
"narHash": "sha256-/Vdg5ZKtP71ZEKVV6JXlrOEu0CM2Flcs+nwDmWRzgjQ=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "hercules-ci-agent",
|
"repo": "hercules-ci-agent",
|
||||||
"rev": "2e10fb21fc2e07edf40763b73443e5934bd40947",
|
"rev": "c303cc8e437c0fd26b9452472e7df5aa374e9177",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -399,11 +399,11 @@
|
||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722409392,
|
"lastModified": 1723717449,
|
||||||
"narHash": "sha256-8QuMS00EutmqzAIPxyJEPxM8EHiWlSKs6E2Htoh3Kes=",
|
"narHash": "sha256-i+9i1D5zEz2c3o5RuH+X/jDRmA12vgU8UxxE0/TPvtE=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "nar-serve",
|
"repo": "nar-serve",
|
||||||
"rev": "9d0eff868d328fe67c60c26c8ba50e0b9d8de867",
|
"rev": "846cb9d55aee9af7c7a1eaf7016f2c5b9e01cc6e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -504,11 +504,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_4": {
|
"nixpkgs_4": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1722539632,
|
"lastModified": 1724221631,
|
||||||
"narHash": "sha256-g4L+I8rDl7RQy5x8XcEMqNO49LFhrHTzVBqXtG2+FGo=",
|
"narHash": "sha256-zf3gNf0nX2yOb++h4jW9l4iG8R/LfazWZD+KhmW6fcc=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "f2d6c7123138044e0c68902268bd8f37dd7e2fa7",
|
"rev": "ac2df85f4d5c580786c7b4db031c199554152681",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -26,13 +26,11 @@ in
|
||||||
|
|
||||||
cfg = v.distributed;
|
cfg = v.distributed;
|
||||||
|
|
||||||
svcs = map (x: config.consul.services.${x}) cfg.registerServices;
|
svc = config.consul.services.${cfg.registerService};
|
||||||
|
|
||||||
runWithRegistration = pkgs.writeShellScript "run-with-registration" ''
|
runWithRegistration = pkgs.writeShellScript "run-with-registration" ''
|
||||||
trap '${lib.concatStringsSep ";" (map (svc: svc.commands.deregister) svcs)}' EXIT
|
trap '${svc.commands.deregister}' EXIT
|
||||||
${lib.concatStringsSep "\n" (
|
${svc.commands.register}
|
||||||
map (svc: svc.commands.register) svcs
|
|
||||||
)}
|
|
||||||
''${@}
|
''${@}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -51,10 +49,10 @@ in
|
||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=${waitForConsul} 'services/${n}%i'
|
ExecStartPre=${waitForConsul} 'services/${n}%i'
|
||||||
ExecStart=
|
ExecStart=
|
||||||
ExecStart=${consul}/bin/consul lock --name=${n} --n=${toString cfg.replicas} --shell=false --child-exit-code 'services/${n}%i' ${optionalString (cfg.registerServices != []) runWithRegistration} ${ExecStart}
|
ExecStart=${consul}/bin/consul lock --name=${n} --n=${toString cfg.replicas} --shell=false --child-exit-code 'services/${n}%i' ${optionalString (cfg.registerService != null) runWithRegistration} ${ExecStart}
|
||||||
Environment="CONSUL_HTTP_ADDR=${consulHttpAddr}"
|
Environment="CONSUL_HTTP_ADDR=${consulHttpAddr}"
|
||||||
${optionalString (v.serviceConfig ? RestrictAddressFamilies) "RestrictAddressFamilies=AF_NETLINK"}
|
${optionalString (v.serviceConfig ? RestrictAddressFamilies) "RestrictAddressFamilies=AF_NETLINK"}
|
||||||
${optionalString (cfg.registerServices != []) (lib.concatStringsSep "\n" (map (svc: "ExecStopPost=${svc.commands.deregister}") svcs))}
|
${optionalString (cfg.registerService != null) "ExecStopPost=${svc.commands.deregister}"}
|
||||||
''))
|
''))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,6 @@ with lib;
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
registerServices = mkOption {
|
|
||||||
description = "Consul services to register when this service gets started.";
|
|
||||||
type = with types; listOf str;
|
|
||||||
default = if config.distributed.registerService == null then [ ] else [ config.distributed.registerService ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
BIN
secrets/keycloak-dbpass.age
Normal file
BIN
secrets/keycloak-dbpass.age
Normal file
Binary file not shown.
Loading…
Reference in a new issue