Watch
0
0
Fork
You've already forked hyperhive
0

move the small per-service host options to deploy.<service>

This commit is contained in:
atlas 2026-10-29 01:48:34 +01:00 • committed by mara
commit 525de62b06

View file

@ -179,6 +179,17 @@ in
# where its host-local secrets sit. Same rule as ../swarm-victorialogs.nix,
# and the renames are in ../deploy.nix with the rest.
options.services.hyperhive.deploy.forgejo = {
httpPort = lib.mkOption {
type = lib.types.port;
default = 3000;
description = ''
TCP port the forge serves HTTP on. Default 3000 sits outside
hyperhive's claimed ranges (dashboard 7000, every agent in
8100..8999 via FNV-1a hash). Change this if you already have
another forgejo bound to 3000.
'';
};
package = lib.mkOption {
type = lib.types.package;
default = pkgs.forgejo;
@ -304,7 +315,7 @@ in
"${cfg.domain}" = {
locations = {
"/" = {
proxyPass = "http://127.0.0.1:${toString cfg.httpPort}/";
proxyPass = "http://127.0.0.1:${toString deployCfg.forgejo.httpPort}/";
proxyWebsockets = true;
extraConfig = ''
proxy_buffering off;
@ -325,7 +336,7 @@ in
# `publishedScrapeTargets.forgejo` in ../swarm-otel-service.nix;
# the two must agree, since that string is also the token's audience.
"= /metrics" = {
proxyPass = "http://127.0.0.1:${toString cfg.httpPort}/metrics";
proxyPass = "http://127.0.0.1:${toString deployCfg.forgejo.httpPort}/metrics";
extraConfig = ''
auth_request /__forge_metrics_authz;
'';
@ -453,8 +464,8 @@ in
assertion =
!(lib.elem forwarderTelemetryPort [
config.services.hyperhive.otel.telemetryPort
config.services.hyperhive.swarm.bao.otel.telemetryPort
config.services.hyperhive.swarm.nats.otel.telemetryPort
config.services.hyperhive.deploy.bao.otel.telemetryPort
config.services.hyperhive.deploy.nats.otel.telemetryPort
]);
message = ''
The forge's journal forwarder's telemetry port (${toString forwarderTelemetryPort})
@ -608,7 +619,7 @@ in
server = {
DOMAIN = cfg.domain;
ROOT_URL = effectiveRootUrl;
HTTP_PORT = cfg.httpPort;
HTTP_PORT = deployCfg.forgejo.httpPort;
START_SSH_SERVER = true;
SSH_PORT = cfg.sshPort;
SSH_LISTEN_PORT = cfg.sshPort;
@ -1135,7 +1146,7 @@ in
curl --silent --show-error --connect-timeout 5 --max-time 15 \
-H @<(printf 'Authorization: token %s\n' "$token") \
-X "$method" -o "$body" -w '%{http_code}' \
"http://127.0.0.1:${toString cfg.httpPort}/api/v1$path"
"http://127.0.0.1:${toString deployCfg.forgejo.httpPort}/api/v1$path"
}
# Every other token this unit minted: one whose write to the
@ -1300,7 +1311,7 @@ in
networking.firewall = lib.mkIf deployCfg.forgejo.openFirewall {
allowedTCPPorts = [
cfg.httpPort
deployCfg.forgejo.httpPort
cfg.sshPort
];
};