infrastructure/machines/nixos/storage01/garage.nix
sinavir e6906a0aa3
All checks were successful
Check meta / check_dns (pull_request) Successful in 15s
Check meta / check_meta (pull_request) Successful in 15s
Check workflows / check_workflows (pull_request) Successful in 16s
Build all the nodes / ap01 (pull_request) Successful in 1m8s
Build all the nodes / bridge01 (pull_request) Successful in 1m47s
Build all the nodes / geo02 (pull_request) Successful in 1m53s
Build all the nodes / hypervisor01 (pull_request) Successful in 1m37s
Build all the nodes / geo01 (pull_request) Successful in 2m44s
Build all the nodes / build01 (pull_request) Successful in 3m1s
Build all the nodes / netcore02 (pull_request) Successful in 31s
Build all the nodes / hypervisor02 (pull_request) Successful in 1m37s
Build all the nodes / compute01 (pull_request) Successful in 3m26s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m42s
Build all the nodes / tower01 (pull_request) Successful in 1m46s
Build all the nodes / vault01 (pull_request) Successful in 1m40s
Build the shell / build-shell (pull_request) Successful in 34s
Build all the nodes / web02 (pull_request) Successful in 1m32s
Build all the nodes / rescue01 (pull_request) Successful in 3m5s
Run pre-commit on all files / pre-commit (pull_request) Successful in 38s
Build all the nodes / storage01 (pull_request) Successful in 3m24s
Build all the nodes / web03 (pull_request) Successful in 1m42s
Build all the nodes / web01 (pull_request) Successful in 3m50s
Build all the nodes / ap01 (push) Successful in 33s
Build all the nodes / netcore02 (push) Successful in 27s
Build all the nodes / geo01 (push) Successful in 1m36s
Build all the nodes / storage01 (push) Successful in 2m3s
Build all the nodes / bridge01 (push) Successful in 2m55s
Build all the nodes / hypervisor03 (push) Successful in 2m48s
Build all the nodes / hypervisor01 (push) Successful in 2m56s
Build the shell / build-shell (push) Successful in 36s
Build all the nodes / build01 (push) Successful in 3m17s
Run pre-commit on all files / pre-commit (push) Successful in 23s
Build all the nodes / tower01 (push) Successful in 1m42s
Build all the nodes / geo02 (push) Successful in 3m28s
Build all the nodes / compute01 (push) Successful in 3m32s
Build all the nodes / hypervisor02 (push) Successful in 3m42s
Build all the nodes / web03 (push) Successful in 1m52s
Build all the nodes / rescue01 (push) Successful in 3m23s
Build all the nodes / web01 (push) Successful in 2m22s
Build all the nodes / vault01 (push) Successful in 3m39s
Build all the nodes / web02 (push) Successful in 3m43s
feat(garage): Use a module and replicate on tower01
2025-01-14 09:52:42 +01:00

96 lines
2.2 KiB
Nix

# SPDX-FileCopyrightText: 2024 Maurice Debray <maurice.debray@dgnum.eu>
# SPDX-FileCopyrightText: 2024 Tom Hubrecht <tom.hubrecht@dgnum.eu>
# SPDX-FileContributor: Ryan Lahfa <ryan.lahfa@dgnum.eu>
#
# SPDX-License-Identifier: EUPL-1.2
let
host = "s3.dgnum.eu";
webHost = "cdn.dgnum.eu";
domains = [
"bandarretdurgence.ens.fr"
"boussole-sante.normalesup.eu"
"lanuit.ens.fr"
"simi.normalesup.eu"
"pub.dgnum.eu"
];
buckets = [
"monorepo-terraform-state"
"banda-website"
"castopod-dgnum"
"hackens-website"
"nuit-website"
"peertube-videos-dgnum"
"landing-website"
] ++ domains;
mkHosted = host: builtins.map (b: "${b}.${host}");
ports = {
admin_api = 3903;
k2v_api = 3904;
rpc = 3901;
s3_api = 3900;
s3_web = 3902;
};
in
{
dgn-s3 = {
enable = true;
inherit ports;
data_dir = "/data/slow/garage/data";
metadata_dir = "/data/fast/garage/meta";
};
services.garage.settings = {
s3_api.root_domain = ".${host}";
s3_web.root_domain = ".${webHost}";
};
services.nginx.virtualHosts = {
"s3-admin.dgnum.eu" = {
enableACME = true;
forceSSL = true;
locations."/".extraConfig = ''
proxy_pass http://127.0.0.1:${builtins.toString ports.admin_api};
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
'';
};
${host} = {
enableACME = true;
forceSSL = true;
serverAliases = mkHosted host buckets;
locations."/".extraConfig = ''
proxy_pass http://127.0.0.1:${builtins.toString ports.s3_api};
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
# Disable buffering to a temporary file.
proxy_max_temp_file_size 0;
client_max_body_size 5G;
'';
};
${webHost} = {
enableACME = true;
forceSSL = true;
serverAliases = domains ++ (mkHosted webHost buckets);
locations."/".extraConfig = ''
proxy_pass http://127.0.0.1:${builtins.toString ports.s3_web};
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
'';
};
};
}