grafana pod: open the database the earlier container left
The pod's volume is the earlier container's data directory, and the NixOS grafana module keeps its database at `<dataDir>/data/grafana.db`. The pod set `paths.data` to the directory itself, so it opened a new, empty `grafana.db` beside the carried one, and the secret-key guard read that new file. Datasources with secrets, API tokens, hand-made dashboards, users and teams of a switched host were orphaned. `paths.data` and the guard's database path are now `<dataDir>/data`. The VM test's earlier Grafana keeps its database in the NixOS layout, and the test asserts the carried file is the only `grafana.db` in the volume. Closes #6979
This commit is contained in:
parent
42199dfa76
commit
fe6221138c
1 changed files with 41 additions and 8 deletions
|
|
@ -379,7 +379,13 @@ let
|
|||
legacyKeyDir = "/var/lib/nixos-containers/swarm-grafana/var/lib/grafana-secret";
|
||||
legacyKeyClaim = "${service}-legacy-key";
|
||||
legacyKeyMount = "/legacy-secret-key";
|
||||
databasePath = "${dataDir}/grafana.db";
|
||||
# Grafana's `paths.data`, and so where its database is. It's the NixOS
|
||||
# grafana module's layout (`<dataDir>/data/grafana.db`), which is the earlier
|
||||
# container's, because the pod's volume is that container's data directory: a
|
||||
# `paths.data` of `dataDir` itself would open a new, empty database beside the
|
||||
# carried one.
|
||||
dataPath = "${dataDir}/data";
|
||||
databasePath = "${dataPath}/grafana.db";
|
||||
grafanaSecretKey = import ./lib/grafana-secret-key.nix { };
|
||||
|
||||
# The built-in `admin` account's password. Grafana's API takes basic auth
|
||||
|
|
@ -683,7 +689,7 @@ let
|
|||
};
|
||||
|
||||
paths = {
|
||||
data = dataDir;
|
||||
data = dataPath;
|
||||
plugins = pluginDir;
|
||||
provisioning = provisioningDir;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue