forked from mirrors/nixpkgs
minio service: add inital service
features: - change listen port and address - configure config and data directory - basic test to check if minio server starts
This commit is contained in:
parent
e5def4442e
commit
aa66c9ad37
|
@ -295,6 +295,7 @@
|
|||
aria2 = 277;
|
||||
clickhouse = 278;
|
||||
rslsync = 279;
|
||||
minio = 280;
|
||||
|
||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||
|
||||
|
@ -559,6 +560,7 @@
|
|||
aria2 = 277;
|
||||
clickhouse = 278;
|
||||
rslsync = 279;
|
||||
minio = 280;
|
||||
|
||||
# When adding a gid, make sure it doesn't match an existing
|
||||
# uid. Users and groups with the same name should have equal
|
||||
|
|
|
@ -588,6 +588,7 @@
|
|||
./services/web-servers/lighttpd/default.nix
|
||||
./services/web-servers/lighttpd/gitweb.nix
|
||||
./services/web-servers/lighttpd/inginious.nix
|
||||
./services/web-servers/minio.nix
|
||||
./services/web-servers/nginx/default.nix
|
||||
./services/web-servers/phpfpm/default.nix
|
||||
./services/web-servers/shellinabox.nix
|
||||
|
|
69
nixos/modules/services/web-servers/minio.nix
Normal file
69
nixos/modules/services/web-servers/minio.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.minio;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ maintainers.bachp ];
|
||||
|
||||
options.services.minio = {
|
||||
enable = mkEnableOption "Minio Object Storage";
|
||||
|
||||
listenAddress = mkOption {
|
||||
default = ":9000";
|
||||
type = types.str;
|
||||
description = "Listen on a specific IP address and port.";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
default = "/var/lib/minio/data";
|
||||
type = types.path;
|
||||
description = "The data directory, for storing the objects.";
|
||||
};
|
||||
|
||||
configDir = mkOption {
|
||||
default = "/var/lib/minio/config";
|
||||
type = types.path;
|
||||
description = "The config directory, for the access keys and other settings.";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
default = pkgs.minio;
|
||||
defaultText = "pkgs.minio";
|
||||
type = types.package;
|
||||
description = "Minio package to use.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.minio = {
|
||||
description = "Minio Object Storage";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
# Make sure directories exist with correct owner
|
||||
mkdir -p ${cfg.configDir}
|
||||
chown -R minio:minio ${cfg.configDir}
|
||||
mkdir -p ${cfg.dataDir}
|
||||
chown minio:minio ${cfg.dataDir}
|
||||
'';
|
||||
serviceConfig = {
|
||||
PermissionsStartOnly = true;
|
||||
ExecStart = "${cfg.package}/bin/minio server --address ${cfg.listenAddress} --config-dir=${cfg.configDir} ${cfg.dataDir}";
|
||||
Type = "simple";
|
||||
User = "minio";
|
||||
Group = "minio";
|
||||
LimitNOFILE = 65536;
|
||||
};
|
||||
};
|
||||
|
||||
users.extraUsers.minio = {
|
||||
group = "minio";
|
||||
uid = config.ids.uids.minio;
|
||||
};
|
||||
|
||||
users.extraGroups.minio.gid = config.ids.uids.minio;
|
||||
};
|
||||
}
|
19
nixos/tests/minio.nix
Normal file
19
nixos/tests/minio.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
import ./make-test.nix ({ pkgs, ...} : {
|
||||
name = "minio";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ bachp ];
|
||||
};
|
||||
|
||||
machine = { config, pkgs, ... }: {
|
||||
services.minio.enable = true;
|
||||
};
|
||||
|
||||
testScript =
|
||||
''
|
||||
startAll;
|
||||
$machine->waitForUnit("minio.service");
|
||||
$machine->waitForOpenPort(9000);
|
||||
$machine->succeed("curl --fail http://localhost:9000/minio/index.html");
|
||||
$machine->shutdown;
|
||||
'';
|
||||
})
|
Loading…
Reference in a new issue