From 6be42d6a35e08c53c12d934b489a193e88996712 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 17 Feb 2024 14:56:47 +0700 Subject: feat(ops/modules): reindex livegrap when depot refs change Change-Id: I917e628428171fa30a89e061cd9bf07e5a759081 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10950 Tested-by: BuildkiteCI Reviewed-by: flokli Autosubmit: tazjin --- ops/modules/livegrep.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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" + ]; + }; + }; }; } -- cgit 1.4.1