about summary refs log tree commit diff
path: root/ops/modules/livegrep.nix
diff options
context:
space:
mode:
Diffstat (limited to 'ops/modules/livegrep.nix')
-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"
+        ];
+      };
+    };
   };
 }