diff --git a/lib/maintainers.nix b/lib/maintainers.nix index d913a28c999d..89ab1f5c3cfe 100644 --- a/lib/maintainers.nix +++ b/lib/maintainers.nix @@ -159,6 +159,7 @@ roelof = "Roelof Wobben "; romildo = "José Romildo Malaquias "; rszibele = "Richard Szibele "; + rushmorem = "Rushmore Mushambi "; rycee = "Robert Helgesson "; sander = "Sander van der Burg "; schristo = "Scott Christopher "; diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index f3cda7b95416..390bab907b37 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -178,6 +178,7 @@ nylon = 168; apache-kafka = 169; panamax = 170; + marathon = 171; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 8ce1c6c20a36..e0255bbbe28e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -315,6 +315,7 @@ ./services/scheduling/chronos.nix ./services/scheduling/cron.nix ./services/scheduling/fcron.nix + ./services/scheduling/marathon.nix ./services/search/elasticsearch.nix ./services/search/solr.nix ./services/security/clamav.nix diff --git a/nixos/modules/services/scheduling/marathon.nix b/nixos/modules/services/scheduling/marathon.nix new file mode 100644 index 000000000000..8513d1174c38 --- /dev/null +++ b/nixos/modules/services/scheduling/marathon.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.marathon; + +in { + + ###### interface + + options.services.marathon = { + enable = mkOption { + description = "Whether to enable the marathon mesos framework."; + default = false; + type = types.uniq types.bool; + }; + + httpPort = mkOption { + description = "Marathon listening port"; + default = 8080; + type = types.int; + }; + + master = mkOption { + description = "Marathon mesos master zookeeper address"; + default = "zk://${head cfg.zookeeperHosts}/mesos"; + type = types.str; + }; + + zookeeperHosts = mkOption { + description = "Marathon mesos zookepper addresses"; + default = [ "localhost:2181" ]; + type = types.listOf types.str; + }; + }; + + ###### implementation + + config = mkIf cfg.enable { + systemd.services.marathon = { + description = "Marathon Service"; + 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"; + User = "marathon"; + }; + }; + + users.extraUsers.marathon = { + uid = config.ids.uids.marathon; + description = "Marathon mesos framework user"; + }; + }; +} diff --git a/pkgs/applications/networking/cluster/marathon/default.nix b/pkgs/applications/networking/cluster/marathon/default.nix new file mode 100644 index 000000000000..36ce79aaf341 --- /dev/null +++ b/pkgs/applications/networking/cluster/marathon/default.nix @@ -0,0 +1,30 @@ +{ stdenv, makeWrapper, jdk, mesos, fetchurl }: + +stdenv.mkDerivation rec { + name = "marathon-v${version}"; + version = "0.8.0"; + + src = fetchurl { + url = "https://downloads.mesosphere.com/marathon/v${version}/marathon-${version}.tgz"; + sha256 = "794c915e205aebd8273f2b40c6faea1517fc683cdc0169194c4a67ce8779fa41"; + }; + + buildInputs = [ makeWrapper jdk mesos ]; + + installPhase = '' + mkdir -p $out/{bin,libexec/marathon} + cp target/scala-*/marathon*.jar $out/libexec/marathon/${name}.jar + + makeWrapper ${jdk.jre}/bin/java $out/bin/marathon \ + --add-flags "-Xmx512m -jar $out/libexec/marathon/${name}.jar" \ + --prefix "MESOS_NATIVE_LIBRARY" : "$MESOS_NATIVE_LIBRARY" + ''; + + meta = with stdenv.lib; { + homepage = https://mesosphere.github.io/marathon; + description = "Cluster-wide init and control system for services in cgroups or Docker containers."; + license = licenses.asl20; + maintainers = with maintainers; [ rushmorem ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c43979a880f2..19838a7b7d29 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10013,6 +10013,8 @@ let magit = callPackage ../applications/editors/emacs-modes/magit { }; + marathon = callPackage ../applications/networking/cluster/marathon { }; + maudeMode = callPackage ../applications/editors/emacs-modes/maude { }; metaweblog = callPackage ../applications/editors/emacs-modes/metaweblog { };