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
|
2024-08-16 22:57:24 +03:00
|
|
|
./incandescence.nix
|
2023-10-31 19:41:40 +02:00
|
|
|
];
|
|
|
|
|
2023-07-05 21:53:04 +03:00
|
|
|
services.storage = {
|
2023-08-23 01:57:35 +03:00
|
|
|
nodes = {
|
2024-07-17 20:35:37 +03:00
|
|
|
internal = lib.subtractLists config.services.storage.nodes.external (lib.attrNames depot.gods.fromLight);
|
2023-08-23 01:57:35 +03:00
|
|
|
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-07-17 20:35:37 +03:00
|
|
|
internal = [
|
|
|
|
./internal.nix
|
|
|
|
];
|
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 = {
|
2024-07-11 01:27:40 +03:00
|
|
|
address = "https://content-delivery.web.garage.${depot.lib.meta.domain}/";
|
2023-11-09 22:42:13 +02:00
|
|
|
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
|
|
|
|
2024-07-04 21:23:50 +03:00
|
|
|
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}";
|
|
|
|
'';
|
|
|
|
};
|
2024-04-22 00:40:21 +03:00
|
|
|
};
|
2023-07-05 21:53:04 +03:00
|
|
|
}
|