mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
Merge pull request #205865 from DeeUnderscore/fix/grafana-socket
This commit is contained in:
commit
6f8f1b0454
@ -1291,7 +1291,10 @@ in {
|
||||
SystemCallArchitectures = "native";
|
||||
# Upstream grafana is not setting SystemCallFilter for compatibility
|
||||
# reasons, see https://github.com/grafana/grafana/pull/40176
|
||||
SystemCallFilter = [ "@system-service" "~@privileged" ];
|
||||
SystemCallFilter = [
|
||||
"@system-service"
|
||||
"~@privileged"
|
||||
] ++ lib.optional (cfg.settings.server.protocol == "socket") [ "@chown" ];
|
||||
UMask = "0027";
|
||||
};
|
||||
preStart = ''
|
||||
|
@ -25,6 +25,22 @@ let
|
||||
extraNodeConfs = {
|
||||
sqlite = {};
|
||||
|
||||
socket = { config, ... }: {
|
||||
services.grafana.settings.server = {
|
||||
protocol = "socket";
|
||||
socket = "/run/grafana/sock";
|
||||
socket_gid = config.users.groups.nginx.gid;
|
||||
};
|
||||
|
||||
users.users.grafana.extraGroups = [ "nginx" ];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
virtualHosts."_".locations."/".proxyPass = "http://unix:/run/grafana/sock";
|
||||
};
|
||||
};
|
||||
|
||||
declarativePlugins = {
|
||||
services.grafana.declarativePlugins = [ pkgs.grafanaPlugins.grafana-clock-panel ];
|
||||
};
|
||||
@ -92,6 +108,17 @@ in {
|
||||
)
|
||||
sqlite.shutdown()
|
||||
|
||||
with subtest("Successful API query as admin user with sqlite db listening on socket"):
|
||||
socket.wait_for_unit("grafana.service")
|
||||
socket.wait_for_open_port(80)
|
||||
print(socket.succeed(
|
||||
"curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1/api/org/users -i"
|
||||
))
|
||||
socket.succeed(
|
||||
"curl -sSfN -u testadmin:snakeoilpwd http://127.0.0.1/api/org/users | grep admin\@localhost"
|
||||
)
|
||||
socket.shutdown()
|
||||
|
||||
with subtest("Successful API query as admin user with postgresql db"):
|
||||
postgresql.wait_for_unit("grafana.service")
|
||||
postgresql.wait_for_unit("postgresql.service")
|
||||
|
Loading…
Reference in New Issue
Block a user