nixos-config/config/services/minio.nix

63 lines
2 KiB
Nix
Raw Normal View History

2022-02-09 14:35:39 +00:00
{ pkgs, lib, config, ... }:
2022-01-17 07:02:56 +00:00
let
listenIPs = (import ../../utils/getInternalIP.nix config).listenIPs;
2022-02-09 14:38:35 +00:00
listenStatements = lib.concatStringsSep "\n" (builtins.map (ip: "listen ${ip}:443 http3;") listenIPs) + ''
add_header Alt-Svc 'h3=":443"';
'';
2022-01-17 07:02:56 +00:00
in
{
2022-01-16 16:44:30 +00:00
services.minio = {
2022-01-26 11:22:14 +00:00
enable = false;
rootCredentialsFile = "/run/secrets/security/minio/credentials_file";
2022-01-16 16:44:30 +00:00
};
2022-01-17 07:02:56 +00:00
services.nginx.virtualHosts."minio.int.chir.rs" = {
listenAddresses = listenIPs;
sslCertificate = "/var/lib/acme/int.chir.rs/cert.pem";
sslCertificateKey = "/var/lib/acme/int.chir.rs/key.pem";
locations."/" = {
proxyPass = "http://127.0.0.1:9000";
proxyWebsockets = true;
};
2022-02-09 14:35:39 +00:00
extraConfig = listenStatements;
};
services.nginx.virtualHosts."minio-console.int.chir.rs" = {
listenAddresses = listenIPs;
sslCertificate = "/var/lib/acme/int.chir.rs/cert.pem";
sslCertificateKey = "/var/lib/acme/int.chir.rs/key.pem";
locations."/" = {
2022-01-17 07:02:56 +00:00
proxyPass = "http://127.0.0.1:9001";
proxyWebsockets = true;
};
2022-02-09 14:35:39 +00:00
extraConfig = listenStatements;
2022-01-17 07:02:56 +00:00
};
sops.secrets."security/minio/credentials_file" = { };
2022-01-26 11:22:14 +00:00
systemd.services.minio = {
enable = true;
description = "Minio Object Storage";
after = [ "network.target" ];
environment = {
MINIO_BROWSER = "on";
MINIO_REGION = "eu-west-1";
MINIO_CACHE = "on";
MINIO_CACHE_DRIVES = "/var/cache/minio";
MINIO_CACHE_QUOTA = "80";
MINIO_CACHE_WATERMARK_LOW = "70";
MINIO_CACHE_WATERMARK_HIGH = "90";
};
serviceConfig = {
2022-01-26 12:41:04 +00:00
Type = "simple";
User = "minio";
Group = "minio";
LimitNOFILE = 65536;
2022-01-26 11:22:14 +00:00
EnvironmentFile = "/run/secrets/security/minio/credentials_file";
ExecStart = "${pkgs.minio}/bin/minio gateway s3 --json --address :9000 --console-address :9001 --config-dir=/var/lib/minio/config http://[fd00:e621:e621:2::2]:9000";
};
wantedBy = [ "multi-user.target" ];
2022-01-26 11:17:33 +00:00
};
2022-01-26 12:41:04 +00:00
users.users.minio = {
group = "minio";
uid = config.ids.uids.minio;
};
users.groups.minio.gid = config.ids.gids.minio;
2022-01-16 16:44:30 +00:00
}