summary refs log tree commit diff
path: root/nixos/modules/services/misc/mesos-slave.nix
diff options
context:
space:
mode:
authorNathan Bijnens <nathan@nathan.gs>2014-08-26 20:56:54 +0200
committerJaka Hudoklin <jakahudoklin@gmail.com>2014-09-03 19:21:49 +0200
commit00ad13428416ef2c46d058166ee76c965609065f (patch)
treeb511e8f2164733636fd9ee75a37e6cea2607f8dd /nixos/modules/services/misc/mesos-slave.nix
parentb48c42f37b4a9ecfdaf7775f52ba69fa069fa6b0 (diff)
downloadnixlib-00ad13428416ef2c46d058166ee76c965609065f.tar
nixlib-00ad13428416ef2c46d058166ee76c965609065f.tar.gz
nixlib-00ad13428416ef2c46d058166ee76c965609065f.tar.bz2
nixlib-00ad13428416ef2c46d058166ee76c965609065f.tar.lz
nixlib-00ad13428416ef2c46d058166ee76c965609065f.tar.xz
nixlib-00ad13428416ef2c46d058166ee76c965609065f.tar.zst
nixlib-00ad13428416ef2c46d058166ee76c965609065f.zip
Mesos: services
Diffstat (limited to 'nixos/modules/services/misc/mesos-slave.nix')
-rw-r--r--nixos/modules/services/misc/mesos-slave.nix93
1 files changed, 93 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/mesos-slave.nix b/nixos/modules/services/misc/mesos-slave.nix
new file mode 100644
index 000000000000..e9a898167161
--- /dev/null
+++ b/nixos/modules/services/misc/mesos-slave.nix
@@ -0,0 +1,93 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.mesos.slave;
+  
+in {
+
+  options.services.mesos = {
+    slave = {
+      enable = mkOption {
+        description = "Whether to enable the Mesos Slave.";
+        default = false;
+        type = types.uniq types.bool;
+      };
+
+      port = mkOption {
+        description = "Mesos Slave port";
+        default = 5051;
+        type = types.int;
+      };
+
+      master = mkOption {
+        description = ''
+          May be one of:
+            zk://host1:port1,host2:port2,.../path
+            zk://username:password@host1:port1,host2:port2,.../path
+        '';
+        type = types.str;
+      };
+      
+      withHadoop = mkOption {
+	description = "Add the HADOOP_HOME to the slave.";
+	default = false;
+	type = types.bool;
+      };
+      
+      workDir = mkOption {
+        description = "The Mesos work directory.";
+        default = "/var/lib/mesos/slave";
+        type = types.str;
+      };
+      
+      extraCmdLineOptions = mkOption {
+        description = ''
+	  Extra command line options for Mesos Slave.
+	  
+	  See https://mesos.apache.org/documentation/latest/configuration/
+	'';
+        default = [ "" ];
+        type = types.listOf types.string;
+        example = [ "--gc_delay=3days" ];
+      };
+      
+      logLevel = mkOption {
+        description = ''
+          The logging level used. Possible values:
+            'INFO', 'WARNING', 'ERROR'
+        '';
+        default = "INFO";
+        type = types.str;
+      };
+
+    };
+
+  };
+
+
+  config = mkIf cfg.enable {
+    systemd.services.mesos-slave = {
+      description = "Mesos Slave";
+      wantedBy = [ "multi-user.target" ];
+      after = [ "network-interfaces.target" ];
+      serviceConfig = {
+	ExecStart = ''
+	  ${pkgs.mesos}/bin/mesos-slave \
+	    --port=${toString cfg.port} \
+	    --master=${cfg.master} \
+	    ${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
+	    --work_dir=${cfg.workDir} \
+	    --logging_level=${cfg.logLevel} \
+	    ${toString cfg.extraCmdLineOptions}
+	'';
+	PermissionsStartOnly = true;
+      };
+      preStart = ''
+	mkdir -m 0700 -p ${cfg.workDir}
+      '';
+    };
+  };
+  
+}
\ No newline at end of file