about summary refs log tree commit diff
path: root/nixos/modules/services/misc/mesos-slave.nix
diff options
context:
space:
mode:
authorRagnar Dahlén <r.dahlen@gmail.com>2015-04-20 21:54:58 +0100
committerRagnar Dahlén <r.dahlen@gmail.com>2015-05-28 06:58:12 +0100
commit045e93e0a660e2db58403ee3bf40ada2d351971e (patch)
tree18d612474d71d545f72472117199728768e2e755 /nixos/modules/services/misc/mesos-slave.nix
parent4c01e6d91993b6de128795f4fbdd25f6227fb870 (diff)
downloadnixlib-045e93e0a660e2db58403ee3bf40ada2d351971e.tar
nixlib-045e93e0a660e2db58403ee3bf40ada2d351971e.tar.gz
nixlib-045e93e0a660e2db58403ee3bf40ada2d351971e.tar.bz2
nixlib-045e93e0a660e2db58403ee3bf40ada2d351971e.tar.lz
nixlib-045e93e0a660e2db58403ee3bf40ada2d351971e.tar.xz
nixlib-045e93e0a660e2db58403ee3bf40ada2d351971e.tar.zst
nixlib-045e93e0a660e2db58403ee3bf40ada2d351971e.zip
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.
Diffstat (limited to 'nixos/modules/services/misc/mesos-slave.nix')
-rw-r--r--nixos/modules/services/misc/mesos-slave.nix25
1 files changed, 20 insertions, 5 deletions
diff --git a/nixos/modules/services/misc/mesos-slave.nix b/nixos/modules/services/misc/mesos-slave.nix
index 26fb3fdb00c9..811aa812c8d9 100644
--- a/nixos/modules/services/misc/mesos-slave.nix
+++ b/nixos/modules/services/misc/mesos-slave.nix
@@ -12,6 +12,8 @@ let
   attribsArg = optionalString (cfg.attributes != {})
                               "--attributes=${mkAttributes cfg.attributes}";
 
+  containerizers = [ "mesos" ] ++ (optional cfg.withDocker "docker");
+
 in {
 
   options.services.mesos = {
@@ -22,8 +24,14 @@ in {
         type = types.uniq types.bool;
       };
 
+      ip = mkOption {
+        description = "IP address to listen on.";
+        default = "0.0.0.0";
+        type = types.string;
+      };
+
       port = mkOption {
-        description = "Mesos Slave port";
+        description = "Port to listen on.";
         default = 5051;
         type = types.int;
       };
@@ -43,6 +51,12 @@ in {
         type = types.bool;
       };
 
+      withDocker = mkOption {
+        description = "Enable the docker containerizer.";
+        default = config.virtualisation.docker.enable;
+        type = types.bool;
+      };
+
       workDir = mkOption {
         description = "The Mesos work directory.";
         default = "/var/lib/mesos/slave";
@@ -92,17 +106,18 @@ in {
       description = "Mesos Slave";
       wantedBy = [ "multi-user.target" ];
       after = [ "network-interfaces.target" ];
-      environment.MESOS_CONTAINERIZERS = "docker,mesos";
+      environment.MESOS_CONTAINERIZERS = concatStringsSep "," containerizers;
       serviceConfig = {
         ExecStart = ''
           ${pkgs.mesos}/bin/mesos-slave \
+            --ip=${cfg.ip} \
             --port=${toString cfg.port} \
             --master=${cfg.master} \
-            ${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
-            ${attribsArg} \
             --work_dir=${cfg.workDir} \
             --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}
         '';
         PermissionsStartOnly = true;