Watch
0
0
Fork
You've already forked hyperhive
0

forge: its own netns, HTTP on a unix socket, git over HTTPS only

The hive-forge container leaves the host netns and listens on no TCP port: Forgejo serves HTTP on a unix socket the gateway proxies to, and the built-in SSH server is off. The httpPort, sshPort and openFirewall options are removed with a message each.
This commit is contained in:
maia 2026-11-22 19:44:19 +01:00 • committed by mara
commit fc70f538ac

View file

@ -157,31 +157,19 @@ Agents poll `HIVE_FORGE_URL` for Forgejo notifications and run every `hive-forge
## hive-forge container shape
Private Forgejo in a nixos-container named `hive-forge` (not `h-*`, so c0re's lifecycle scanner leaves it alone; manage it with the standard `nixos-container` CLI). The container keeps it from colliding with any `services.forgejo` the operator already runs on the host: separate systemd namespace, separate state dir, separate port.
Private Forgejo in a nixos-container named `hive-forge` (not `h-*`, so c0re's lifecycle scanner leaves it alone; manage it with the standard `nixos-container` CLI). The container keeps it from colliding with any `services.forgejo` the operator already runs on the host: separate systemd namespace, separate state dir, no host port.
It shares the host network namespace (`privateNetwork = false`): the container is for state and unit isolation, not network isolation. Agent containers, by contrast, are network-isolated and reach the forge through the gateway ([`HIVE_FORGE_URL`](#hive_forge_url-agents-reach-the-forge-via-the-gateway-by-domain)).
It has a network namespace of its own on the hive bridge (`privateNetwork = true`), like the other service containers. It listens on no TCP port at all: Forgejo serves HTTP on a unix socket, `/run/hive-forge/forgejo.sock`, in a directory the host bind-mounts into the container (mode `0770`, group `nginx`, so only the gateway and Forgejo itself get in). The vhost's `proxyPass` and the `= /metrics` location both name that socket. Agent containers reach the forge the same way an operator's browser does, through the gateway ([`HIVE_FORGE_URL`](#hive_forge_url-agents-reach-the-forge-via-the-gateway-by-domain)).
State lives at `/var/lib/nixos-containers/hive-forge/var/lib/forgejo/` and survives restarts and reboots; destroy the container to wipe it.
Only the swarm's forge host runs it (`services.hyperhive.deploy.forgejo.enable`, see [`2-handbook/swarm/services.md`](../../2-handbook/swarm/services.md)). Every other hive reaches that host's gateway by `forge.<swarm-domain>`.
### Network and port configuration
### Git over HTTPS only
```nix
# The SSH port is swarm-wide: every hive dials it. The HTTP port and whether
# THIS host opens them in its firewall are this host's deployment decisions.
services.hyperhive = {
swarm.forge.sshPort = 2222; # default — git-over-SSH, off the host's openssh on 22
deploy.forgejo = {
httpPort = 3000; # default — outside hyperhive's 7000 / 8100-8999
openFirewall = false; # default
};
};
```
The forge has no SSH server and no port options. Clone, push and pull over `https://<domain>/<owner>/<repo>.git`, through the gateway's vhost; no clone URL the forge shows offers SSH. Whether the gateway answers from outside the host is the gateway's own `openFirewall` option.
`sshPort` serves `git clone/push/pull` over SSH (`git@<domain>:owner/repo.git` with `-p 2222`). SSH goes straight to Forgejo, not through nginx.
`openFirewall` (default `false`) opens `httpPort` and `sshPort` on the host. Agents don't need it — they come through the gateway. Set it for a browser reaching `http://<host>:<httpPort>/` directly, or for external git clients pushing over SSH. Forge's gateway vhost doesn't need `openFirewall` — the gateway's own `openFirewall` option covers that path.
The old `swarm.forge.sshPort`, `swarm.forge.httpPort`, `deploy.forgejo.httpPort` and `deploy.forgejo.openFirewall` options no longer exist. A configuration that still sets one fails at evaluation with a message saying so.
### `rootUrl` override