about summary refs log tree commit diff
path: root/ops/modules
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-02-17T07·56+0700
committerclbot <clbot@tvl.fyi>2024-02-18T08·20+0000
commit6be42d6a35e08c53c12d934b489a193e88996712 (patch)
treeeb85ba1d04a4387b560cc11e3c34317ac5bbfd57 /ops/modules
parent33e68496f25e2a060f72088284a90be5299c3ba5 (diff)
feat(ops/modules): reindex livegrap when depot refs change r/7549
Change-Id: I917e628428171fa30a89e061cd9bf07e5a759081
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10950
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'ops/modules')
-rw-r--r--ops/modules/livegrep.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/ops/modules/livegrep.nix b/ops/modules/livegrep.nix
index 796f6c38de4a..e25a3018291b 100644
--- a/ops/modules/livegrep.nix
+++ b/ops/modules/livegrep.nix
@@ -81,6 +81,23 @@ in
         # TODO(tazjin): docroot with styles etc.
       ];
     };
+
+    systemd.services.livegrep-reindex = {
+      script = "${pkgs.docker}/bin/docker exec livegrep-codesearch /livegrep/bin/livegrep-reload localhost:5427";
+      serviceConfig.Type = "oneshot";
+    };
+
+    systemd.paths.livegrep-reindex = {
+      description = "Executes a livegrep reindex if depot refs change";
+      wantedBy = [ "multi-user.target" ];
+
+      pathConfig = {
+        PathChanged = [
+          "/var/lib/gerrit/git/depot.git/packed-refs"
+          "/var/lib/gerrit/git/depot.git/refs"
+        ];
+      };
+    };
   };
 }