feat(module): Add custom path info service option
This commit is contained in:
parent
fa45ea4779
commit
84e41704fd
2 changed files with 14 additions and 10 deletions
|
@ -58,6 +58,11 @@ in
|
||||||
default = name;
|
default = name;
|
||||||
defaultText = lib.literalMD "Defaults to attribute name in services.tvix-binary-cache.caches";
|
defaultText = lib.literalMD "Defaults to attribute name in services.tvix-binary-cache.caches";
|
||||||
};
|
};
|
||||||
|
path-info-service-addr = lib.mkOption {
|
||||||
|
type = with lib.types; str;
|
||||||
|
description = "Path info service path";
|
||||||
|
default = "sled://%S/%N/pathinfo.sled";
|
||||||
|
};
|
||||||
remote-path-info-service-addr = lib.mkOption {
|
remote-path-info-service-addr = lib.mkOption {
|
||||||
type = with lib.types; nullOr str;
|
type = with lib.types; nullOr str;
|
||||||
description = "Upstream cache to substitute from if nothing in ";
|
description = "Upstream cache to substitute from if nothing in ";
|
||||||
|
@ -113,7 +118,7 @@ in
|
||||||
++ (lib.mapAttrsToList (
|
++ (lib.mapAttrsToList (
|
||||||
name: cfg:
|
name: cfg:
|
||||||
let
|
let
|
||||||
stateDir = "tvix-binary-cache-${cfg.name}";
|
unitName = "tvix-store-${cfg.name}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
"nar-bridge-${cfg.name}" = {
|
"nar-bridge-${cfg.name}" = {
|
||||||
|
@ -121,13 +126,13 @@ in
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "tvix-store-${cfg.name}.service" ];
|
after = [ "tvix-store-${cfg.name}.service" ];
|
||||||
serviceConfig = rec {
|
serviceConfig = rec {
|
||||||
ExecStart = "${lib.getExe pkgs.nar-bridge-go} --otlp=false --listen-addr=\"[::1]:${builtins.toString cfg.port}\" --store-addr=\"unix://%t/${stateDir}/socket\"";
|
ExecStart = "${lib.getExe pkgs.nar-bridge-go} --otlp=false --listen-addr=\"[::1]:${builtins.toString cfg.port}\" --store-addr=\"unix://%t/${unitName}/socket\"";
|
||||||
|
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
User = "tvix-binary-cache";
|
User = "tvix-binary-cache";
|
||||||
} // systemdHardening;
|
} // systemdHardening;
|
||||||
};
|
};
|
||||||
"tvix-store-${cfg.name}" = {
|
${unitName} = {
|
||||||
wants = [ "tvix-castore.service" ];
|
wants = [ "tvix-castore.service" ];
|
||||||
after = [ "tvix-castore.service" ];
|
after = [ "tvix-castore.service" ];
|
||||||
environment = {
|
environment = {
|
||||||
|
@ -141,18 +146,17 @@ in
|
||||||
cfg.directory-service-addr
|
cfg.directory-service-addr
|
||||||
else
|
else
|
||||||
"grpc+unix://%t/tvix-castore/socket";
|
"grpc+unix://%t/tvix-castore/socket";
|
||||||
PATH_INFO_SERVICE_ADDR = "sled://%S/${stateDir}/pathinfo.sled";
|
PATH_INFO_SERVICE_ADDR = cfg.path-info-service-addr;
|
||||||
REMOTE_PATH_INFO_SERVICE_ADDR = lib.mkIf (
|
REMOTE_PATH_INFO_SERVICE_ADDR = lib.mkIf (
|
||||||
cfg.remote-path-info-service-addr != null
|
cfg.remote-path-info-service-addr != null
|
||||||
) cfg.remote-path-info-service-addr;
|
) cfg.remote-path-info-service-addr;
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.tvix-store}/bin/tvix-store --otlp=false daemon --listen-address=\"%t/${stateDir}/socket\"";
|
ExecStart = "${pkgs.tvix-store}/bin/tvix-store --otlp=false daemon --listen-address=\"%t/${unitName}/socket\"";
|
||||||
|
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
User = "tvix-binary-cache";
|
User = "tvix-binary-cache";
|
||||||
StateDirectory = stateDir;
|
StateDirectory = unitName;
|
||||||
RuntimeDirectory = stateDir;
|
RuntimeDirectory = unitName;
|
||||||
} // systemdHardening;
|
} // systemdHardening;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ let
|
||||||
} "jq -r \"{closure : .hello}\" < .attrs.json > $out"; # "jq -r '.hello' < .attrs.json > $out";
|
} "jq -r \"{closure : .hello}\" < .attrs.json > $out"; # "jq -r '.hello' < .attrs.json > $out";
|
||||||
in
|
in
|
||||||
pkgs.testers.runNixOSTest (_: {
|
pkgs.testers.runNixOSTest (_: {
|
||||||
name = "cache signature upload test";
|
name = "ingestion with tvix copy";
|
||||||
nodes = {
|
nodes = {
|
||||||
cache = {
|
cache = {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -43,7 +43,7 @@ pkgs.testers.runNixOSTest (_: {
|
||||||
cache.wait_for_unit("nginx.service")
|
cache.wait_for_unit("nginx.service")
|
||||||
cache.wait_for_unit("nar-bridge-cache.service")
|
cache.wait_for_unit("nar-bridge-cache.service")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
socket_addr = "grpc+unix:///run/tvix-binary-cache-cache/socket"
|
socket_addr = "grpc+unix:///run/tvix-store-cache/socket"
|
||||||
cache.succeed(f"BLOB_SERVICE_ADDR={socket_addr} DIRECTORY_SERVICE_ADDR={socket_addr} PATH_INFO_SERVICE_ADDR={socket_addr} tvix-store copy ${builtins.toString references}")
|
cache.succeed(f"BLOB_SERVICE_ADDR={socket_addr} DIRECTORY_SERVICE_ADDR={socket_addr} PATH_INFO_SERVICE_ADDR={socket_addr} tvix-store copy ${builtins.toString references}")
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue