feat(ops/builderball): introduce bouncing Nix cache proxy
Adds a Nix cache proxy which can be used to send a Nix cache lookup to the first available cache that has the given NAR. We will use this for dynamically created builders. Relates to b/432. Change-Id: If970d2393e43ba032b5b7d653f2b92f6ac0eab63 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12949 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
45f8f7d39f
commit
3e802d3bdf
8 changed files with 534 additions and 0 deletions
42
ops/builderball/config/config.go
Normal file
42
ops/builderball/config/config.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
Host = flag.String("host", "localhost", "host on which to listen for incoming requests")
|
||||
Port = flag.Int("port", 2243, "port on which to listen for incoming requests")
|
||||
Debug = flag.Bool("debug", false, "whether debug logging should be enabled")
|
||||
JSON = flag.Bool("json", false, "whether logging should be in JSON format")
|
||||
Ticker = flag.Int("ticker", 5, "interval in seconds between statistics tickers")
|
||||
Priority = flag.Int("priority", 50, "Nix cache priority with which to serve clients")
|
||||
|
||||
Tailscale = flag.Bool("tailscale", false, "whether caches should be discovered on Tailscale")
|
||||
TSTag = flag.String("tailscale-tag", "tag:nix-cache", "Tailscale tag to use for discovery")
|
||||
|
||||
CachePort = flag.Int("cache-port", 80, "port at which to connect to binary cache on each node")
|
||||
CacheHost = flag.String("cache-host", "", "Host header to send to each binary cache")
|
||||
|
||||
Caches []string
|
||||
)
|
||||
|
||||
type stringSliceFlag []string
|
||||
|
||||
func (s *stringSliceFlag) String() string {
|
||||
if len(*s) == 0 {
|
||||
return "[ ]"
|
||||
}
|
||||
|
||||
return "[ " + strings.Join(*s, " ") + " ]"
|
||||
}
|
||||
|
||||
func (s *stringSliceFlag) Set(value string) error {
|
||||
*s = append(*s, value)
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
flag.Var((*stringSliceFlag)(&Caches), "cache", "Upstream cache URL (can be specified multiple times)")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue