nixos-config/config/services/minio.nix

62 lines
1.9 KiB
Nix
Raw Normal View History

2022-01-26 11:15:46 +00:00
{ pkgs, config, ... }:
2022-01-17 07:02:56 +00:00
let
listenIPs = (import ../../utils/getInternalIP.nix config).listenIPs;
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" = {
forceSSL = true;
http2 = true;
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;
};
};
services.nginx.virtualHosts."minio-console.int.chir.rs" = {
forceSSL = true;
http2 = true;
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;
};
};
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
}