mesos: add docker support

This commit is contained in:
Jaka Hudoklin 2014-12-02 12:10:15 +01:00
parent 36a5384ec9
commit a0cf449fa5

View File

@ -4,7 +4,7 @@ with lib;
let let
cfg = config.services.mesos.slave; cfg = config.services.mesos.slave;
in { in {
options.services.mesos = { options.services.mesos = {
@ -29,30 +29,30 @@ in {
''; '';
type = types.str; type = types.str;
}; };
withHadoop = mkOption { withHadoop = mkOption {
description = "Add the HADOOP_HOME to the slave."; description = "Add the HADOOP_HOME to the slave.";
default = false; default = false;
type = types.bool; 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";
type = types.str; type = types.str;
}; };
extraCmdLineOptions = mkOption { extraCmdLineOptions = mkOption {
description = '' description = ''
Extra command line options for Mesos Slave. Extra command line options for Mesos Slave.
See https://mesos.apache.org/documentation/latest/configuration/ See https://mesos.apache.org/documentation/latest/configuration/
''; '';
default = [ "" ]; default = [ "" ];
type = types.listOf types.string; type = types.listOf types.string;
example = [ "--gc_delay=3days" ]; example = [ "--gc_delay=3days" ];
}; };
logLevel = mkOption { logLevel = mkOption {
description = '' description = ''
The logging level used. Possible values: The logging level used. Possible values:
@ -72,6 +72,7 @@ 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";
serviceConfig = { serviceConfig = {
ExecStart = '' ExecStart = ''
${pkgs.mesos}/bin/mesos-slave \ ${pkgs.mesos}/bin/mesos-slave \
@ -80,6 +81,7 @@ in {
${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \ ${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
--work_dir=${cfg.workDir} \ --work_dir=${cfg.workDir} \
--logging_level=${cfg.logLevel} \ --logging_level=${cfg.logLevel} \
--docker=${pkgs.docker}/libexec/docker/docker \
${toString cfg.extraCmdLineOptions} ${toString cfg.extraCmdLineOptions}
''; '';
PermissionsStartOnly = true; PermissionsStartOnly = true;
@ -89,5 +91,5 @@ in {
''; '';
}; };
}; };
} }