Skip to content

Commit

Permalink
nixos/graylog: change default package version to 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bbenno committed Nov 24, 2024
1 parent 2d7c550 commit 81127c7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
3 changes: 3 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
[v1.7.0](https://github.com/jtroo/kanata/releases/tag/v1.7.0)
for more information.

- `services.graylog.package` now defaults to `graylog-6_0` as previous default `graylog-5_1` is EOL and therefore removed.
Check the migration guides on [5.1→5.2](https://go2docs.graylog.org/5-2/upgrading_graylog/upgrading_to_graylog_5.2.x.htm) and [5.2→6.0](https://go2docs.graylog.org/6-0/upgrading_graylog/upgrading_to_graylog_6.0.x.html) for breaking changes.

- the notmuch vim plugin now lives in a separate output of the `notmuch`
package. Installing `notmuch` will not bring the notmuch vim package anymore,
add `vimPlugins.notmuch-vim` to your (Neo)vim configuration if you want the
Expand Down
39 changes: 29 additions & 10 deletions nixos/modules/services/logging/graylog.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{ config, lib, pkgs, ... }:
{ config
, lib
, pkgs
, ...
}:
let
cfg = config.services.graylog;

Expand Down Expand Up @@ -33,11 +37,8 @@ in

enable = lib.mkEnableOption "Graylog, a log management solution";

package = lib.mkOption {
type = lib.types.package;
default = if lib.versionOlder config.system.stateVersion "23.05" then pkgs.graylog-3_3 else pkgs.graylog-5_1;
defaultText = lib.literalExpression (if lib.versionOlder config.system.stateVersion "23.05" then "pkgs.graylog-3_3" else "pkgs.graylog-5_1");
description = "Graylog package to use.";
package = lib.mkPackageOption pkgs "graylog" {
example = "graylog-6_0";
};

user = lib.mkOption {
Expand Down Expand Up @@ -124,19 +125,34 @@ in
};
};


###### implementation

config = lib.mkIf cfg.enable {

# Note: when changing the default, make it conditional on
# ‘system.stateVersion’ to maintain compatibility with existing
# systems!
services.graylog.package =
let
mkThrow = ver: throw "graylog-${ver} was removed, please upgrade your graylog version.";
base =
if lib.versionAtLeast config.system.stateVersion "25.05" then
pkgs.graylog-6_0
else if lib.versionAtLeast config.system.stateVersion "23.05" then
mkThrow "5_1"
else
mkThrow "3_3";
in
lib.mkDefault base;

users.users = lib.mkIf (cfg.user == "graylog") {
graylog = {
isSystemUser = true;
group = "graylog";
description = "Graylog server daemon user";
};
};
users.groups = lib.mkIf (cfg.user == "graylog") { graylog = {}; };
users.groups = lib.mkIf (cfg.user == "graylog") { graylog = { }; };

systemd.tmpfiles.rules = [
"d '${cfg.messageJournalDir}' - ${cfg.user} - - -"
Expand All @@ -148,7 +164,10 @@ in
environment = {
GRAYLOG_CONF = "${confFile}";
};
path = [ pkgs.which pkgs.procps ];
path = [
pkgs.which
pkgs.procps
];
preStart = ''
rm -rf /var/lib/graylog/plugins || true
mkdir -p /var/lib/graylog/plugins -m 755
Expand All @@ -164,7 +183,7 @@ in
done
'';
serviceConfig = {
User="${cfg.user}";
User = "${cfg.user}";
StateDirectory = "graylog";
ExecStart = "${cfg.package}/bin/graylogctl run";
};
Expand Down

0 comments on commit 81127c7

Please sign in to comment.