1
0
Fork 0

Revert to loki v2 (#230)

This is needed because v3 requires manual intervention to upgrade
otherwise Loki refuses to start. So until there's a fix, reverting is
the easiest fix.
This commit is contained in:
Pierre Penninckx 2024-04-21 23:07:32 -07:00 committed by GitHub
parent 425e511792
commit 222dfa755c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 41 additions and 0 deletions

9
CHANGELOG.md Normal file
View file

@ -0,0 +1,9 @@
# Upcoming
- Revert Loki to major version 2 because upgrading to version 3 required manual intervention as Loki
refuses to start. So until this issue is tackled, reverting is the best immediate fix.
See https://github.com/NixOS/nixpkgs/commit/8f95320f39d7e4e4a29ee70b8718974295a619f4
# 0.1.0
Creation of CHANGELOG.md

View file

@ -47,6 +47,16 @@ in
default = 3002; default = 3002;
}; };
lokiMajorVersion = lib.mkOption {
type = lib.types.enum [ 2 3 ];
description = ''
Switching from version 2 to 3 requires manual intervention
https://grafana.com/docs/loki/latest/setup/upgrade/#main--unreleased. So this let's the user
upgrade at their own pace.
'';
default = 2;
};
debugLog = lib.mkOption { debugLog = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
description = "Set to true to enable debug logging of the infrastructure serving Grafana."; description = "Set to true to enable debug logging of the infrastructure serving Grafana.";
@ -266,6 +276,28 @@ in
services.loki = { services.loki = {
enable = true; enable = true;
dataDir = "/var/lib/loki"; dataDir = "/var/lib/loki";
package = if cfg.lokiMajorVersion == 3 then pkgs.grafana-loki else
# Comes from https://github.com/NixOS/nixpkgs/commit/8f95320f39d7e4e4a29ee70b8718974295a619f4
(pkgs.grafana-loki.overrideAttrs (finalAttrs: previousAttrs: rec {
version = "2.9.6";
src = pkgs.fetchFromGitHub {
owner = "grafana";
repo = "loki";
rev = "v${version}";
hash = "sha256-79hK7axHf6soku5DvdXkE/0K4WKc4pnS9VMbVc1FS2I=";
};
ldflags = let t = "github.com/grafana/loki/pkg/util/build"; in [
"-s"
"-w"
"-X ${t}.Version=${version}"
"-X ${t}.BuildUser=nix@nixpkgs"
"-X ${t}.BuildDate=unknown"
"-X ${t}.Branch=unknown"
"-X ${t}.Revision=unknown"
];
}));
configuration = { configuration = {
auth_enabled = false; auth_enabled = false;