nixos/cassandra: Prepare for cassandra 4
Its scripts disagree a bit with our flexible logging approach and our default logging config. Might want to revisit this at some point. The `mkdir` failures in the log are harmless.
This commit is contained in:
parent
90b1c9fa10
commit
5775cfa4b8
1 changed files with 21 additions and 3 deletions
|
@ -21,6 +21,7 @@ let
|
||||||
|
|
||||||
atLeast3 = versionAtLeast cfg.package.version "3";
|
atLeast3 = versionAtLeast cfg.package.version "3";
|
||||||
atLeast3_11 = versionAtLeast cfg.package.version "3.11";
|
atLeast3_11 = versionAtLeast cfg.package.version "3.11";
|
||||||
|
atLeast4 = versionAtLeast cfg.package.version "4";
|
||||||
|
|
||||||
defaultUser = "cassandra";
|
defaultUser = "cassandra";
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ let
|
||||||
cassandraLogbackConfig = pkgs.writeText "logback.xml" cfg.logbackConfig;
|
cassandraLogbackConfig = pkgs.writeText "logback.xml" cfg.logbackConfig;
|
||||||
|
|
||||||
passAsFile = [ "extraEnvSh" ];
|
passAsFile = [ "extraEnvSh" ];
|
||||||
inherit (cfg) extraEnvSh;
|
inherit (cfg) extraEnvSh package;
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
|
@ -83,6 +84,10 @@ let
|
||||||
|
|
||||||
# Delete default password file
|
# Delete default password file
|
||||||
sed -i '/-Dcom.sun.management.jmxremote.password.file=\/etc\/cassandra\/jmxremote.password/d' "$out/cassandra-env.sh"
|
sed -i '/-Dcom.sun.management.jmxremote.password.file=\/etc\/cassandra\/jmxremote.password/d' "$out/cassandra-env.sh"
|
||||||
|
|
||||||
|
${lib.optionalString atLeast4 ''
|
||||||
|
cp $package/conf/jvm*.options $out/
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,8 +103,20 @@ let
|
||||||
"-Dcom.sun.management.jmxremote.password.file=${cfg.jmxRolesFile}"
|
"-Dcom.sun.management.jmxremote.password.file=${cfg.jmxRolesFile}"
|
||||||
] ++ optionals cfg.remoteJmx [
|
] ++ optionals cfg.remoteJmx [
|
||||||
"-Djava.rmi.server.hostname=${cfg.rpcAddress}"
|
"-Djava.rmi.server.hostname=${cfg.rpcAddress}"
|
||||||
|
] ++ optionals atLeast4 [
|
||||||
|
# Historically, we don't use a log dir, whereas the upstream scripts do
|
||||||
|
# expect this. We override those by providing our own -Xlog:gc flag.
|
||||||
|
"-Xlog:gc=warning,heap*=warning,age*=warning,safepoint=warning,promotion*=warning"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
commonEnv = {
|
||||||
|
# Sufficient for cassandra 2.x, 3.x
|
||||||
|
CASSANDRA_CONF = "${cassandraEtc}";
|
||||||
|
|
||||||
|
# Required since cassandra 4
|
||||||
|
CASSANDRA_LOGBACK_CONF = "${cassandraEtc}/logback.xml";
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.cassandra = {
|
options.services.cassandra = {
|
||||||
|
@ -489,8 +506,7 @@ in
|
||||||
systemd.services.cassandra = {
|
systemd.services.cassandra = {
|
||||||
description = "Apache Cassandra service";
|
description = "Apache Cassandra service";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
environment = {
|
environment = commonEnv // {
|
||||||
CASSANDRA_CONF = "${cassandraEtc}";
|
|
||||||
JVM_OPTS = builtins.concatStringsSep " " fullJvmOptions;
|
JVM_OPTS = builtins.concatStringsSep " " fullJvmOptions;
|
||||||
MAX_HEAP_SIZE = toString cfg.maxHeapSize;
|
MAX_HEAP_SIZE = toString cfg.maxHeapSize;
|
||||||
HEAP_NEWSIZE = toString cfg.heapNewSize;
|
HEAP_NEWSIZE = toString cfg.heapNewSize;
|
||||||
|
@ -511,6 +527,7 @@ in
|
||||||
description = "Perform a full repair on this Cassandra node";
|
description = "Perform a full repair on this Cassandra node";
|
||||||
after = [ "cassandra.service" ];
|
after = [ "cassandra.service" ];
|
||||||
requires = [ "cassandra.service" ];
|
requires = [ "cassandra.service" ];
|
||||||
|
environment = commonEnv;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
|
@ -539,6 +556,7 @@ in
|
||||||
description = "Perform an incremental repair on this cassandra node.";
|
description = "Perform an incremental repair on this cassandra node.";
|
||||||
after = [ "cassandra.service" ];
|
after = [ "cassandra.service" ];
|
||||||
requires = [ "cassandra.service" ];
|
requires = [ "cassandra.service" ];
|
||||||
|
environment = commonEnv;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
Group = cfg.group;
|
Group = cfg.group;
|
||||||
|
|
Loading…
Reference in a new issue