2022-01-20 00:31:44 +02:00
|
|
|
{ config, inputs, lib, pkgs, tools, ... }:
|
2021-10-16 20:59:06 +03:00
|
|
|
with tools.nginx;
|
|
|
|
let
|
2022-05-26 23:52:49 +03:00
|
|
|
minioPort = config.portsStr.minio;
|
|
|
|
consolePort = config.portsStr.minioConsole;
|
2021-10-16 20:59:06 +03:00
|
|
|
in
|
|
|
|
{
|
2022-05-26 23:52:49 +03:00
|
|
|
reservePortsFor = [ "minio" "minioConsole" ];
|
2021-11-29 02:38:59 +02:00
|
|
|
|
2021-10-16 20:59:06 +03:00
|
|
|
age.secrets.minio-root-credentials = {
|
|
|
|
file = ../../../../secrets/minio-root-credentials.age;
|
|
|
|
owner = "root";
|
|
|
|
group = "root";
|
|
|
|
mode = "0400";
|
|
|
|
};
|
|
|
|
services.minio = {
|
|
|
|
enable = true;
|
2021-12-02 22:46:52 +02:00
|
|
|
rootCredentialsFile = config.age.secrets.minio-root-credentials.path;
|
2021-10-16 20:59:06 +03:00
|
|
|
dataDir = [ "/srv/storage/objects" ];
|
|
|
|
browser = true;
|
2022-05-26 23:52:49 +03:00
|
|
|
listenAddress = "127.0.0.1:${minioPort}";
|
|
|
|
consoleAddress = "127.0.0.1:${consolePort}";
|
2021-10-16 20:59:06 +03:00
|
|
|
};
|
|
|
|
systemd.services.minio.serviceConfig = {
|
|
|
|
Slice = "remotefshost.slice";
|
|
|
|
};
|
|
|
|
services.nginx.virtualHosts = mappers.mapSubdomains {
|
|
|
|
# TODO: vhosts.proxy?
|
|
|
|
"object-storage" = vhosts.basic // {
|
|
|
|
locations = {
|
2022-05-26 23:52:49 +03:00
|
|
|
"/".proxyPass = "http://127.0.0.1:${minioPort}";
|
|
|
|
"= /dashboard".proxyPass = "http://127.0.0.1:${minioPort}";
|
2021-10-16 20:59:06 +03:00
|
|
|
};
|
2021-12-01 23:26:45 +02:00
|
|
|
extraConfig = "client_max_body_size 4G;";
|
2021-10-16 20:59:06 +03:00
|
|
|
};
|
|
|
|
"console.object-storage" = vhosts.basic // {
|
|
|
|
locations = {
|
2022-05-26 23:52:49 +03:00
|
|
|
"/".proxyPass = "http://127.0.0.1:${consolePort}";
|
2021-10-16 20:59:06 +03:00
|
|
|
};
|
|
|
|
};
|
2022-05-26 23:52:49 +03:00
|
|
|
"cdn" = lib.recursiveUpdate (vhosts.proxy "http://127.0.0.1:${minioPort}/content-delivery$request_uri") {
|
2021-10-16 20:59:06 +03:00
|
|
|
locations."= /".return = "302 /index.html";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
services.oauth2_proxy.nginx.virtualHosts = [ "console.object-storage.${tools.meta.domain}" ];
|
|
|
|
}
|