From 9ffc4ad790dbbfcb0ac061d650c1df943b9e084d Mon Sep 17 00:00:00 2001 From: Indiscipline Date: Sat, 10 Apr 2021 14:42:47 +0300 Subject: [PATCH] nixos/minio: allow multiple data directories for erasure coding --- nixos/doc/manual/release-notes/rl-2105.xml | 6 ++++++ nixos/modules/services/web-servers/minio.nix | 11 +++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2105.xml b/nixos/doc/manual/release-notes/rl-2105.xml index b5290b374f9d..d6cab4afa2a7 100644 --- a/nixos/doc/manual/release-notes/rl-2105.xml +++ b/nixos/doc/manual/release-notes/rl-2105.xml @@ -658,6 +658,12 @@ environment.systemPackages = [ Environment variables can be set using . + + + changed type to a list of paths, required for specifiyng multiple data directories for using with erasure coding. + Currently, the service doesn't enforce nor checks the correct number of paths to correspond to minio requirements. + + diff --git a/nixos/modules/services/web-servers/minio.nix b/nixos/modules/services/web-servers/minio.nix index cd123000f009..381a55faff16 100644 --- a/nixos/modules/services/web-servers/minio.nix +++ b/nixos/modules/services/web-servers/minio.nix @@ -18,9 +18,9 @@ in }; dataDir = mkOption { - default = "/var/lib/minio/data"; - type = types.path; - description = "The data directory, for storing the objects."; + default = [ "/var/lib/minio/data" ]; + type = types.listOf types.path; + description = "The list of data directories for storing the objects. Use one path for regular operation and the minimum of 4 endpoints for Erasure Code mode."; }; configDir = mkOption { @@ -74,15 +74,14 @@ in config = mkIf cfg.enable { systemd.tmpfiles.rules = [ "d '${cfg.configDir}' - minio minio - -" - "d '${cfg.dataDir}' - minio minio - -" - ]; + ] ++ (map (x: "d '" + x + "' - minio minio - - ") cfg.dataDir); systemd.services.minio = { description = "Minio Object Storage"; after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { - ExecStart = "${cfg.package}/bin/minio server --json --address ${cfg.listenAddress} --config-dir=${cfg.configDir} ${cfg.dataDir}"; + ExecStart = "${cfg.package}/bin/minio server --json --address ${cfg.listenAddress} --config-dir=${cfg.configDir} ${toString cfg.dataDir}"; Type = "simple"; User = "minio"; Group = "minio";