From c72c1efdebddd1d8d6c37c8efd360e1c3fcda90b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 16 Feb 2022 21:34:18 +0300 Subject: refactor(ops/modules): Rename git-serving -> josh cgit has its own module now Change-Id: I9b4cc322374517b8bd3db43345831e2bf43c4bb1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5295 Autosubmit: tazjin Tested-by: BuildkiteCI Reviewed-by: sterni --- ops/machines/whitby/default.nix | 4 ++-- ops/modules/git-serving.nix | 33 --------------------------------- ops/modules/josh.nix | 33 +++++++++++++++++++++++++++++++++ ops/modules/www/code.tvl.fyi.nix | 2 +- 4 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 ops/modules/git-serving.nix create mode 100644 ops/modules/josh.nix diff --git a/ops/machines/whitby/default.nix b/ops/machines/whitby/default.nix index 66f5890f8b..1965a661f9 100644 --- a/ops/machines/whitby/default.nix +++ b/ops/machines/whitby/default.nix @@ -11,8 +11,8 @@ in "${depot.path}/ops/modules/cgit/default.nix" "${depot.path}/ops/modules/clbot.nix" "${depot.path}/ops/modules/gerrit-queue.nix" - "${depot.path}/ops/modules/git-serving.nix" "${depot.path}/ops/modules/irccat.nix" + "${depot.path}/ops/modules/josh.nix" "${depot.path}/ops/modules/monorepo-gerrit.nix" "${depot.path}/ops/modules/nixery.nix" "${depot.path}/ops/modules/oauth2_proxy.nix" @@ -394,7 +394,7 @@ in # Run cgit & josh to serve git cgit.enable = true; - git-serving.enable = true; + josh.enable = true; # Configure backups to GleSYS restic = { diff --git a/ops/modules/git-serving.nix b/ops/modules/git-serving.nix deleted file mode 100644 index 57f08cbc5f..0000000000 --- a/ops/modules/git-serving.nix +++ /dev/null @@ -1,33 +0,0 @@ -# Configures the public josh instance for serving the depot. -{ config, depot, lib, pkgs, ... }: - -let - cfg = config.services.depot.git-serving; -in -{ - options.services.depot.git-serving = with lib; { - enable = mkEnableOption "Enable cgit & josh configuration"; - - joshPort = mkOption { - description = "Port on which josh should listen"; - type = types.int; - default = 5674; - }; - }; - - config = lib.mkIf cfg.enable { - # Run josh for the depot. - systemd.services.josh = { - description = "josh - partial cloning of monorepos"; - wantedBy = [ "multi-user.target" ]; - path = [ pkgs.git pkgs.bash ]; - - serviceConfig = { - DynamicUser = true; - StateDirectory = "josh"; - Restart = "always"; - ExecStart = "${depot.third_party.josh}/bin/josh-proxy --no-background --local /var/lib/josh --port ${toString cfg.joshPort} --remote https://cl.tvl.fyi/"; - }; - }; - }; -} diff --git a/ops/modules/josh.nix b/ops/modules/josh.nix new file mode 100644 index 0000000000..be9e9e966e --- /dev/null +++ b/ops/modules/josh.nix @@ -0,0 +1,33 @@ +# Configures the public josh instance for serving the depot. +{ config, depot, lib, pkgs, ... }: + +let + cfg = config.services.depot.josh; +in +{ + options.services.depot.josh = with lib; { + enable = mkEnableOption "Enable josh for serving the depot"; + + port = mkOption { + description = "Port on which josh should listen"; + type = types.int; + default = 5674; + }; + }; + + config = lib.mkIf cfg.enable { + # Run josh for the depot. + systemd.services.josh = { + description = "josh - partial cloning of monorepos"; + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.git pkgs.bash ]; + + serviceConfig = { + DynamicUser = true; + StateDirectory = "josh"; + Restart = "always"; + ExecStart = "${depot.third_party.josh}/bin/josh-proxy --no-background --local /var/lib/josh --port ${toString cfg.port} --remote https://cl.tvl.fyi/"; + }; + }; + }; +} diff --git a/ops/modules/www/code.tvl.fyi.nix b/ops/modules/www/code.tvl.fyi.nix index 4c182d34f2..3f34a9422c 100644 --- a/ops/modules/www/code.tvl.fyi.nix +++ b/ops/modules/www/code.tvl.fyi.nix @@ -22,7 +22,7 @@ # Git operations on depot.git hit josh location /depot.git { - proxy_pass http://localhost:${toString config.services.depot.git-serving.joshPort}; + proxy_pass http://localhost:${toString config.services.depot.josh.port}; } # Git clone operations on '/' should be redirected to josh now. -- cgit 1.4.1