@cryptotaxi247 / infra-1 / commits / e655fb09

pluto: make {grafana,prometheus}.nixos.org the canonical names

We'll keep support for the old paths in tact for the foreseeable future. Only the CORS headers might be removed, once status.nixos.org has moved on.

Martin Weinelt committed Feb 26, 2024 at 22:48 UTC e655fb09b593a08511ca6aa8a45c3148e0f653ea
3 files changed +15 -7
delft/pluto/grafana.nix
+2 -2
@@ -8,7 +8,7 @@
8 auth.anonymous.enable = true;
9 users.allowSignUp = true;
10 addr = "0.0.0.0";
11 - domain = "monitoring.nixos.org";
12 - rootUrl = "https://monitoring.nixos.org/grafana/";
11 + domain = "grafana.nixos.org";
12 + rootUrl = "https://grafana.nixos.org";
13 };
14 }
delft/pluto/nginx.nix
+12 -4
@@ -18,20 +18,28 @@
18 forceSSL = true;
19 default = true;
20 locations."/".return = "302 https://status.nixos.org";
21 - locations."/prometheus/".proxyPass = "http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}";
22 - locations."/grafana/".proxyPass = "http://${config.services.grafana.addr}:${toString config.services.grafana.port}/";
21 + locations."~ ^/prometheus/(?<action>[^\\s]+)" = {
22 + return = "301 https://prometheus.nixos.org/$action$is_args$args";
23 + # TODO: Remove after https://github.com/NixOS/nixos-status/pull/21
24 + extraConfig = ''
25 + add_header Access-Control-Allow-Origin "*" always;
26 + '';
27 + };
28 + locations."~ ^/grafana/(?<action>[^\\s]+)".return = "301 https://grafana.nixos.org/$action$is_args$args";
29 };
30
31 virtualHosts."prometheus.nixos.org" = {
32 enableACME = true;
33 forceSSL = true;
28 - locations."/".proxyPass = "http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}";
34 + locations."/" = {
35 + proxyPass = "http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}";
36 + };
37 };
38
39 virtualHosts."grafana.nixos.org" = {
40 enableACME = true;
41 forceSSL = true;
34 - locations."/".proxyPass = "http://${config.services.grafana.addr}:${toString config.services.grafana.port}/";
42 + locations."/".proxyPass = "http://${config.services.grafana.addr}:${toString config.services.grafana.port}";
43 };
44 };
45 }
delft/pluto/prometheus/default.nix
+1 -1
@@ -42,7 +42,7 @@
42 enable = true;
43 extraFlags = [
44 "--storage.tsdb.retention=${toString (150 * 24)}h"
45 - "--web.external-url=https://monitoring.nixos.org/prometheus/"
45 + "--web.external-url=https://prometheus.nixos.org/"
46 ];
47 globalConfig.scrape_interval = "15s";
48 };