mesos-slave: docker and IP address config options
- Usage of docker containerizer is currently hardcoded, this PR makes it optional. Default is to enable it if docker is enabled. - Make IP address to listen on part of service configuration.
This commit is contained in:
parent
4c01e6d919
commit
045e93e0a6
nixos/modules/services/misc
|
@ -12,6 +12,8 @@ let
|
||||||
attribsArg = optionalString (cfg.attributes != {})
|
attribsArg = optionalString (cfg.attributes != {})
|
||||||
"--attributes=${mkAttributes cfg.attributes}";
|
"--attributes=${mkAttributes cfg.attributes}";
|
||||||
|
|
||||||
|
containerizers = [ "mesos" ] ++ (optional cfg.withDocker "docker");
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
options.services.mesos = {
|
options.services.mesos = {
|
||||||
|
@ -22,8 +24,14 @@ in {
|
||||||
type = types.uniq types.bool;
|
type = types.uniq types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ip = mkOption {
|
||||||
|
description = "IP address to listen on.";
|
||||||
|
default = "0.0.0.0";
|
||||||
|
type = types.string;
|
||||||
|
};
|
||||||
|
|
||||||
port = mkOption {
|
port = mkOption {
|
||||||
description = "Mesos Slave port";
|
description = "Port to listen on.";
|
||||||
default = 5051;
|
default = 5051;
|
||||||
type = types.int;
|
type = types.int;
|
||||||
};
|
};
|
||||||
|
@ -43,6 +51,12 @@ in {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
withDocker = mkOption {
|
||||||
|
description = "Enable the docker containerizer.";
|
||||||
|
default = config.virtualisation.docker.enable;
|
||||||
|
type = types.bool;
|
||||||
|
};
|
||||||
|
|
||||||
workDir = mkOption {
|
workDir = mkOption {
|
||||||
description = "The Mesos work directory.";
|
description = "The Mesos work directory.";
|
||||||
default = "/var/lib/mesos/slave";
|
default = "/var/lib/mesos/slave";
|
||||||
|
@ -92,17 +106,18 @@ in {
|
||||||
description = "Mesos Slave";
|
description = "Mesos Slave";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-interfaces.target" ];
|
after = [ "network-interfaces.target" ];
|
||||||
environment.MESOS_CONTAINERIZERS = "docker,mesos";
|
environment.MESOS_CONTAINERIZERS = concatStringsSep "," containerizers;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = ''
|
ExecStart = ''
|
||||||
${pkgs.mesos}/bin/mesos-slave \
|
${pkgs.mesos}/bin/mesos-slave \
|
||||||
|
--ip=${cfg.ip} \
|
||||||
--port=${toString cfg.port} \
|
--port=${toString cfg.port} \
|
||||||
--master=${cfg.master} \
|
--master=${cfg.master} \
|
||||||
${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
|
|
||||||
${attribsArg} \
|
|
||||||
--work_dir=${cfg.workDir} \
|
--work_dir=${cfg.workDir} \
|
||||||
--logging_level=${cfg.logLevel} \
|
--logging_level=${cfg.logLevel} \
|
||||||
--docker=${pkgs.docker}/libexec/docker/docker \
|
${attribsArg} \
|
||||||
|
${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
|
||||||
|
${optionalString cfg.withDocker "--docker=${pkgs.docker}/libexec/docker/docker"} \
|
||||||
${toString cfg.extraCmdLineOptions}
|
${toString cfg.extraCmdLineOptions}
|
||||||
'';
|
'';
|
||||||
PermissionsStartOnly = true;
|
PermissionsStartOnly = true;
|
||||||
|
|
Loading…
Reference in New Issue