Merge pull request #7857 from rushmorem/marathon-module-update

Update Marathon module
This commit is contained in:
Arseniy Seroka 2015-05-21 16:52:14 +03:00
commit f134150180
3 changed files with 42 additions and 12 deletions

View file

@ -17,6 +17,7 @@
<itemizedlist>
<listitem><para><literal>brltty</literal></para></listitem>
<listitem><para><literal>marathon</literal></para></listitem>
</itemizedlist>
</para>

View file

@ -196,7 +196,6 @@
nylon = 168;
apache-kafka = 169;
panamax = 170;
marathon = 171;
exim = 172;
#fleet = 173; # unused
#input = 174; # unused
@ -391,7 +390,6 @@
gitlab = 165;
nylon = 168;
panamax = 170;
#marathon = 171; # unused
exim = 172;
fleet = 173;
input = 174;

View file

@ -12,27 +12,56 @@ in {
options.services.marathon = {
enable = mkOption {
description = "Whether to enable the marathon mesos framework.";
default = false;
type = types.uniq types.bool;
default = false;
description = ''
Whether to enable the marathon mesos framework.
'';
};
httpPort = mkOption {
description = "Marathon listening port";
default = 8080;
type = types.int;
default = 8080;
description = ''
Marathon listening port for HTTP connections.
'';
};
master = mkOption {
description = "Marathon mesos master zookeeper address";
default = "zk://${head cfg.zookeeperHosts}/mesos";
type = types.str;
default = "zk://${concatStringsSep "," cfg.zookeeperHosts}/mesos";
example = "zk://1.2.3.4:2181,2.3.4.5:2181,3.4.5.6:2181/mesos";
description = ''
Mesos master address. See <link xlink:href="https://mesosphere.github.io/marathon/docs/"/> for details.
'';
};
zookeeperHosts = mkOption {
description = "Marathon mesos zookepper addresses";
default = [ "localhost:2181" ];
type = types.listOf types.str;
default = [ "localhost:2181" ];
example = [ "1.2.3.4:2181" "2.3.4.5:2181" "3.4.5.6:2181" ];
description = ''
ZooKeeper hosts' addresses.
'';
};
extraCmdLineOptions = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "--https_port=8443" "--zk_timeout=10000" "--marathon_store_timeout=2000" ];
description = ''
Extra command line options to pass to Marathon.
See <link xlink:href="https://mesosphere.github.io/marathon/docs/command-line-flags.html"/> for all possible flags.
'';
};
environment = mkOption {
default = { };
type = types.attrs;
example = { JAVA_OPTS = "-Xmx512m"; MESOSPHERE_HTTP_CREDENTIALS = "username:password"; };
description = ''
Environment variables passed to Marathon.
'';
};
};
@ -41,17 +70,19 @@ in {
config = mkIf cfg.enable {
systemd.services.marathon = {
description = "Marathon Service";
environment = cfg.environment;
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" "zookeeper.service" "mesos-master.service" "mesos-slave.service" ];
serviceConfig = {
ExecStart = "${pkgs.marathon}/bin/marathon --master ${cfg.master} --zk zk://${head cfg.zookeeperHosts}/marathon";
ExecStart = "${pkgs.marathon}/bin/marathon --master ${cfg.master} --zk zk://${concatStringsSep "," cfg.zookeeperHosts}/marathon --http_port ${toString cfg.httpPort} ${concatStringsSep " " cfg.extraCmdLineOptions}";
User = "marathon";
Restart = "always";
RestartSec = "2";
};
};
users.extraUsers.marathon = {
uid = config.ids.uids.marathon;
description = "Marathon mesos framework user";
};
};