depot/cluster/services/storage/default.nix

107 lines
2.3 KiB
Nix
Raw Normal View History

{ config, depot, lib, ... }:
2023-08-28 03:32:08 +03:00
let
meshIpForNode = name: config.vars.mesh.${name}.meshIp;
in
2023-07-05 21:53:04 +03:00
{
imports = [
./options.nix
];
2023-07-05 21:53:04 +03:00
services.storage = {
nodes = {
external = [ "prophet" ];
heresy = [ "VEGAS" ];
garage = [ "grail" "prophet" "VEGAS" ];
garageConfig = [ "grail" "prophet" "VEGAS" ];
2023-08-28 03:32:08 +03:00
garageInternal = [ "VEGAS" ];
garageExternal = [ "grail" "prophet" ];
};
nixos = {
external = [
./external.nix
./s3ql-upgrades.nix
];
heresy = [
./heresy.nix
./s3ql-upgrades.nix
];
2023-08-28 03:32:08 +03:00
garage = [
./garage.nix
./garage-options.nix
2023-08-28 03:32:08 +03:00
./garage-layout.nix
];
garageConfig = [
./garage-gateway.nix
./garage-metrics.nix
{
services.garage = {
inherit (config.garage) buckets keys;
};
}
2023-08-28 03:32:08 +03:00
];
garageInternal = [ ./garage-internal.nix ];
garageExternal = [ ./garage-external.nix ];
};
2023-07-05 21:53:04 +03:00
};
2023-08-28 03:32:08 +03:00
links = {
garageS3 = {
hostname = "garage.${depot.lib.meta.domain}";
port = 443;
protocol = "https";
url = with config.links.garageS3; lib.mkForce "${protocol}://${hostname}";
};
garageWeb = {
hostname = "web.garage.${depot.lib.meta.domain}";
port = 443;
protocol = "https";
url = with config.links.garageWeb; lib.mkForce "${protocol}://${hostname}";
};
};
2023-08-28 03:32:08 +03:00
hostLinks = lib.genAttrs config.services.storage.nodes.garage (name: {
garageRpc = {
ipv4 = meshIpForNode name;
};
garageS3 = {
protocol = "http";
ipv4 = meshIpForNode name;
};
garageWeb = {
protocol = "http";
ipv4 = meshIpForNode name;
};
2023-08-28 03:32:08 +03:00
});
monitoring.blackbox.targets.garage = {
address = "https://garage.${depot.lib.meta.domain}/health";
module = "https2xx";
};
garage = {
keys.storage-prophet = {};
buckets.storage-prophet = {
allow.storage-prophet = [ "read" "write" ];
};
};
ways = {
garage = {
consulService = "garage";
extras.extraConfig = ''
client_max_body_size 4G;
'';
};
"web.garage" = {
consulService = "garage-web";
wildcard = true;
extras.locations."/".extraConfig = ''
proxy_set_header Host "$1.${config.links.garageWeb.hostname}";
'';
};
};
2023-07-05 21:53:04 +03:00
}