diff --git a/knotmirror/xrpc/git_get_blob.go b/knotmirror/xrpc/git_get_blob.go --- a/knotmirror/xrpc/git_get_blob.go +++ b/knotmirror/xrpc/git_get_blob.go @@ -42,7 +42,7 @@ var file *object.File pprof.Do(r.Context(), pprof.Labels("repo", repo.String()), func(ctx context.Context) { file, err = x.getFile(ctx, repo, ref, path) }) - if err != nil { + if err != nil || file.Size > 1000*1000 { l.Warn("local mirror failed, trying proxy", "err", err) if x.proxyToKnot(w, r, repo) { return diff --git a/nix/modules/knotmirror.nix b/nix/modules/knotmirror.nix --- a/nix/modules/knotmirror.nix +++ b/nix/modules/knotmirror.nix @@ -30,6 +30,12 @@ default = "0.0.0.0:7000"; description = "Address to listen on"; }; + metricsListenAddr = mkOption { + type = types.str; + default = "127.0.0.1:7100"; + description = "Address to listen on"; + }; + adminListenAddr = mkOption { type = types.str; default = "127.0.0.1:7200"; @@ -149,7 +155,7 @@ "MIRROR_GIT_BASEPATH=/var/lib/knotmirror/repos" "MIRROR_KNOT_USE_SSL=${boolToString cfg.knotUseSSL}" "MIRROR_KNOT_SSRF=${boolToString cfg.knotSSRF}" "MIRROR_RESYNC_PARALLELISM=12" - "MIRROR_METRICS_LISTEN=127.0.0.1:7100" + "MIRROR_METRICS_LISTEN=${cfg.metricsListenAddr}" "MIRROR_ADMIN_LISTEN=${cfg.adminListenAddr}" "MIRROR_SLURPER_CONCURRENCY=4" ]; diff --git a/nix/vm.nix b/nix/vm.nix --- a/nix/vm.nix +++ b/nix/vm.nix @@ -76,6 +76,11 @@ from = "host"; host.port = 7200; guest.port = 7200; } + { + from = "host"; + host.port = 7100; + guest.port = 7100; + } ]; sharedDirectories = { # We can't use the 9p mounts directly for most of these @@ -151,6 +156,7 @@ }; services.tangled.knotmirror = { enable = true; listenAddr = "0.0.0.0:7000"; + metricsListenAddr = "0.0.0.0:7100"; adminListenAddr = "0.0.0.0:7200"; hostname = "localhost:7000"; dbUrl = "postgresql://tnglr@127.0.0.1:5432/mirror";