feat(ops/modules): configure builderball cache setup
Configures an experimental setup for a builderball-based public cache. This cache only includes the two build machines (whitby & nevsky), for the time period where both of them exist simultaneously. The idea is this: All participating hosts run a harmonia binary cache locally (whitby already does). They then run builderball instances pointing at each other's harmonia caches (through dedicated public hostnames). When a request comes in, the first matching cache address is returned and Nix will substitute from there. Change-Id: Ia7d5357fd5e04f77b460205544fa24e82b100230 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12975 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
6733b26ba5
commit
c948a26d7d
9 changed files with 214 additions and 11 deletions
51
ops/modules/builderball.nix
Normal file
51
ops/modules/builderball.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Configuration for builderball, the Nix cache proxy for substituting between
|
||||
# builders.
|
||||
#
|
||||
# This is in experimental state, not yet supporting any dynamic private builders.
|
||||
{ depot, config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.depot.builderball;
|
||||
description = "Nix cache proxy for distribution between builders";
|
||||
hostname = config.networing.hostName;
|
||||
in
|
||||
{
|
||||
options.services.depot.builderball = {
|
||||
enable = lib.mkEnableOption description;
|
||||
|
||||
caches = lib.mkOption {
|
||||
type = with lib.types; listOf string;
|
||||
description = "Public addresses of caches to use";
|
||||
|
||||
default = [
|
||||
"whitby.cache.tvl.fyi"
|
||||
"nevsky.cache.tvl.fyi"
|
||||
];
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
description = "port on which to listen locally";
|
||||
default = 26862; # bounc
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.builderball =
|
||||
let
|
||||
caches = lib.concatStringsSep " " (map (c: "-cache https://${c}") cfg.caches);
|
||||
in
|
||||
{
|
||||
inherit description;
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${depot.ops.builderball}/bin/builderball ${caches} -port ${toString cfg.port} -debug";
|
||||
DynamicUser = true;
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue