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}
cleanup-period-ms=${toString cfg.zkCleanupPeriod}
servers-spec=${concatStringsSep "," cfg.zkServersSpec}
auto-manage-instances=${toString cfg.autoManageInstances}
auto-manage-instances=${lib.boolToString cfg.autoManageInstances}
${cfg.extraConf}
'';
configDir = pkgs.writeTextDir "exhibitor.properties" exhibitorConfig;
@ -24,6 +24,13 @@ let
defaultconfig = "${configDir}/exhibitor.properties";
port = toString cfg.port;
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; };
cliOptionsPerConfig = {
@ -95,6 +102,57 @@ in
'';
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 {
type = types.bool;
description = ''
@ -213,21 +271,21 @@ in
'';
default = 10000;
};
zkConfigRetry = mkOption {
type = types.submodule {
options = {
sleepMs = mkOption {
type = types.int;
};
retryQuantity = mkOption {
type = types.int;
};
};
zkConfigRetry = {
sleepMs = mkOption {
type = types.int;
default = 1000;
description = ''
Retry sleep time connecting to the ZooKeeper config
'';
};
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 {
type = types.str;
@ -238,29 +296,25 @@ in
};
# Config options for s3 configType
s3Config = mkOption {
type = types.submodule {
options = {
bucketName = mkOption {
type = types.str;
description = ''
Bucket name to store config
'';
};
objectKey = mkOption {
type = types.str;
description = ''
S3 key name to store the config
'';
};
configPrefix = mkOption {
type = types.str;
description = ''
When using AWS S3 shared config files, the prefix to use for values such as locks
'';
default = "exhibitor-";
};
};
s3Config = {
bucketName = mkOption {
type = types.str;
description = ''
Bucket name to store config
'';
};
objectKey = mkOption {
type = types.str;
description = ''
S3 key name to store the config
'';
};
configPrefix = mkOption {
type = types.str;
description = ''
When using AWS S3 shared config files, the prefix to use for values such as locks
'';
default = "exhibitor-";
};
};

View File

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