exhibitor: Fix bugs in previous package

The previous package didn't build properly due to a bug in the build
script, and the nixos module didn't evaluate due to missing descriptions
in the options. This fixes both issues.

It also adds missing command-line options that weren't able to be set
and properly converts bools to the strings exhibitor expects.
This commit is contained in:
Joel Thompson 2017-07-21 16:10:44 -04:00
parent 1ef6fc96c8
commit 9dc51dc00d
2 changed files with 94 additions and 40 deletions

View File

@ -15,7 +15,7 @@ let
election-port=${toString cfg.zkElectionPort} election-port=${toString cfg.zkElectionPort}
cleanup-period-ms=${toString cfg.zkCleanupPeriod} cleanup-period-ms=${toString cfg.zkCleanupPeriod}
servers-spec=${concatStringsSep "," cfg.zkServersSpec} servers-spec=${concatStringsSep "," cfg.zkServersSpec}
auto-manage-instances=${toString cfg.autoManageInstances} auto-manage-instances=${lib.boolToString cfg.autoManageInstances}
${cfg.extraConf} ${cfg.extraConf}
''; '';
configDir = pkgs.writeTextDir "exhibitor.properties" exhibitorConfig; configDir = pkgs.writeTextDir "exhibitor.properties" exhibitorConfig;
@ -24,6 +24,13 @@ let
defaultconfig = "${configDir}/exhibitor.properties"; defaultconfig = "${configDir}/exhibitor.properties";
port = toString cfg.port; port = toString cfg.port;
hostname = cfg.hostname; hostname = cfg.hostname;
headingtext = if (cfg.headingText != null) then (lib.escapeShellArg cfg.headingText) else null;
nodemodification = lib.boolToString cfg.nodeModification;
configcheckms = toString cfg.configCheckMs;
jquerystyle = cfg.jqueryStyle;
loglines = toString cfg.logLines;
servo = lib.boolToString cfg.servo;
timeout = toString cfg.timeout;
}; };
s3CommonOptions = { s3region = cfg.s3Region; s3credentials = cfg.s3Credentials; }; s3CommonOptions = { s3region = cfg.s3Region; s3credentials = cfg.s3Credentials; };
cliOptionsPerConfig = { cliOptionsPerConfig = {
@ -95,6 +102,57 @@ in
''; '';
default = null; default = null;
}; };
nodeModification = mkOption {
type = types.bool;
description = ''
Whether the Explorer UI will allow nodes to be modified (use with caution).
'';
default = true;
};
configCheckMs = mkOption {
type = types.int;
description = ''
Period (ms) to check for shared config updates.
'';
default = 30000;
};
headingText = mkOption {
type = types.nullOr types.str;
description = ''
Extra text to display in UI header
'';
default = null;
};
jqueryStyle = mkOption {
type = types.enum [ "red" "black" "custom" ];
description = ''
Styling used for the JQuery-based UI.
'';
default = "red";
};
logLines = mkOption {
type = types.int;
description = ''
Max lines of logging to keep in memory for display.
'';
default = 1000;
};
servo = mkOption {
type = types.bool;
description = ''
ZooKeeper will be queried once a minute for its state via the 'mntr' four
letter word (this requires ZooKeeper 3.4.x+). Servo will be used to publish
this data via JMX.
'';
default = false;
};
timeout = mkOption {
type = types.int;
description = ''
Connection timeout (ms) for ZK connections.
'';
default = 30000;
};
autoManageInstances = mkOption { autoManageInstances = mkOption {
type = types.bool; type = types.bool;
description = '' description = ''
@ -213,21 +271,21 @@ in
''; '';
default = 10000; default = 10000;
}; };
zkConfigRetry = mkOption { zkConfigRetry = {
type = types.submodule { sleepMs = mkOption {
options = { type = types.int;
sleepMs = mkOption { default = 1000;
type = types.int; description = ''
}; Retry sleep time connecting to the ZooKeeper config
retryQuantity = mkOption { '';
type = types.int; };
}; retryQuantity = mkOption {
}; type = types.int;
default = 3;
description = ''
Retries connecting to the ZooKeeper config
'';
}; };
description = ''
The retry values to use
'';
default = { sleepMs = 1000; retryQuantity = 3; };
}; };
zkConfigZPath = mkOption { zkConfigZPath = mkOption {
type = types.str; type = types.str;
@ -238,29 +296,25 @@ in
}; };
# Config options for s3 configType # Config options for s3 configType
s3Config = mkOption { s3Config = {
type = types.submodule { bucketName = mkOption {
options = { type = types.str;
bucketName = mkOption { description = ''
type = types.str; Bucket name to store config
description = '' '';
Bucket name to store config };
''; objectKey = mkOption {
}; type = types.str;
objectKey = mkOption { description = ''
type = types.str; S3 key name to store the config
description = '' '';
S3 key name to store the config };
''; configPrefix = mkOption {
}; type = types.str;
configPrefix = mkOption { description = ''
type = types.str; When using AWS S3 shared config files, the prefix to use for values such as locks
description = '' '';
When using AWS S3 shared config files, the prefix to use for values such as locks default = "exhibitor-";
'';
default = "exhibitor-";
};
};
}; };
}; };

View File

@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
name = "exhibitor-${version}-maven-deps"; name = "exhibitor-${version}-maven-deps";
inherit src nativeBuildInputs; inherit src nativeBuildInputs;
buildPhase = '' buildPhase = ''
cd $pomFileDir; cd ${pomFileDir};
while timeout --kill-after=21m 20m mvn package -Dmaven.repo.local=$out/.m2; [ $? = 124 ]; do while timeout --kill-after=21m 20m mvn package -Dmaven.repo.local=$out/.m2; [ $? = 124 ]; do
echo "maven hangs while downloading :(" echo "maven hangs while downloading :("
done done
@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ maven ]; nativeBuildInputs = [ maven ];
buildInputs = [ makeWrapper ]; buildInputs = [ makeWrapper ];
buildPhase = '' buildPhase = ''
cd $pomFileDir cd ${pomFileDir}
mvn package --offline -Dmaven.repo.local=$(cp -dpR ${fetchedMavenDeps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2 mvn package --offline -Dmaven.repo.local=$(cp -dpR ${fetchedMavenDeps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {