2023-11-03 22:45:36 +02:00
|
|
|
{ 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
|
|
|
{
|
2023-10-31 19:41:40 +02:00
|
|
|
imports = [
|
|
|
|
./options.nix
|
|
|
|
];
|
|
|
|
|
2023-07-05 21:53:04 +03:00
|
|
|
services.storage = {
|
2023-08-23 01:57:35 +03:00
|
|
|
nodes = {
|
|
|
|
external = [ "prophet" ];
|
|
|
|
heresy = [ "VEGAS" ];
|
2023-11-04 02:38:35 +02:00
|
|
|
garage = [ "grail" "prophet" "VEGAS" ];
|
|
|
|
garageConfig = [ "grail" "prophet" "VEGAS" ];
|
2023-08-28 03:32:08 +03:00
|
|
|
garageInternal = [ "VEGAS" ];
|
2023-11-04 02:38:35 +02:00
|
|
|
garageExternal = [ "grail" "prophet" ];
|
2023-08-23 01:57:35 +03:00
|
|
|
};
|
|
|
|
nixos = {
|
2024-06-07 03:53:53 +03:00
|
|
|
external = [
|
|
|
|
./external.nix
|
|
|
|
./s3ql-upgrades.nix
|
|
|
|
];
|
|
|
|
heresy = [
|
|
|
|
./heresy.nix
|
|
|
|
./s3ql-upgrades.nix
|
|
|
|
];
|
2023-08-28 03:32:08 +03:00
|
|
|
garage = [
|
|
|
|
./garage.nix
|
2023-09-03 22:21:31 +03:00
|
|
|
./garage-options.nix
|
2023-08-28 03:32:08 +03:00
|
|
|
./garage-layout.nix
|
2023-11-03 21:57:35 +02:00
|
|
|
];
|
|
|
|
garageConfig = [
|
2023-11-03 21:40:34 +02:00
|
|
|
./garage-gateway.nix
|
2023-11-04 20:46:30 +02:00
|
|
|
./garage-metrics.nix
|
2023-10-31 19:41:40 +02:00
|
|
|
{
|
|
|
|
services.garage = {
|
|
|
|
inherit (config.garage) buckets keys;
|
|
|
|
};
|
|
|
|
}
|
2023-08-28 03:32:08 +03:00
|
|
|
];
|
|
|
|
garageInternal = [ ./garage-internal.nix ];
|
|
|
|
garageExternal = [ ./garage-external.nix ];
|
2023-08-23 01:57:35 +03:00
|
|
|
};
|
2023-07-05 21:53:04 +03:00
|
|
|
};
|
2023-08-28 03:32:08 +03:00
|
|
|
|
2024-04-22 00:40:21 +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-11-03 22:45:36 +02:00
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
};
|
2024-04-22 00:40:21 +03:00
|
|
|
garageWeb = {
|
|
|
|
protocol = "http";
|
|
|
|
ipv4 = meshIpForNode name;
|
|
|
|
};
|
2023-08-28 03:32:08 +03:00
|
|
|
});
|
2023-11-02 04:22:28 +02:00
|
|
|
|
2023-11-09 22:42:13 +02:00
|
|
|
monitoring.blackbox.targets.garage = {
|
|
|
|
address = "https://garage.${depot.lib.meta.domain}/health";
|
|
|
|
module = "https2xx";
|
|
|
|
};
|
|
|
|
|
2023-11-02 04:22:28 +02:00
|
|
|
garage = {
|
|
|
|
keys.storage-prophet = {};
|
|
|
|
buckets.storage-prophet = {
|
|
|
|
allow.storage-prophet = [ "read" "write" ];
|
|
|
|
};
|
|
|
|
};
|
2023-11-03 21:40:34 +02:00
|
|
|
|
|
|
|
dns.records.garage.consulService = "garage";
|
2024-04-22 00:40:21 +03:00
|
|
|
dns.records."^[^_].+\\.web\\.garage" = {
|
|
|
|
consulService = "garage-web";
|
|
|
|
rewrite.type = "regex";
|
|
|
|
};
|
2023-07-05 21:53:04 +03:00
|
|
|
}
|