authoravatarclover caruso<git@paperclover.net>2026-11-22 13:23:26-08:00
committeravatarclover caruso<git@paperclover.net>2026-11-22 20:28:52-08:00
loga2539c07f874120f95bf837528a1d40dbc61e8ec
treef73b8bda625dc2b8ef1af88581e1da4ec87e09fb
parent6f74560e1efd492076d18c4f79ca691a64be6aa4
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

Run Spacebar on the sandbox network

Jobs select the CNI network with a group network mode, and Nomad publishes their ports instead of the Podman driver. Assisted-by: claude-sonnet-5.5

5 files changed, 15 insertions(+), 2 deletions(-)

config/Service.pkl+2
......@@ -90,6 +90,8 @@ class Container {
9090 devices: Listing<String> = new {}
9191 extraHosts: Listing<String> = new {}
9292 hostNetwork: Boolean = false
93 /// Nomad CNI `sandbox` network: public internet and PostgreSQL only, no other host or LAN address.
94 restrictedEgress: Boolean = false
9395 imageUser: Boolean = false
9496 /// Prestart tasks finish first; prestart sidecars stay up for the main tasks.
9597 lifecycle: "main"|"prestart"|"prestartSidecar" = "main"
service/spacebar/service.pkl+1
......@@ -27,6 +27,7 @@ secrets {
2727
2828container {
2929 build = "build"
30 restrictedEgress = true
3031 cpu = 1000
3132 memory = 3072
3233
tools/__pycache__/snowglobe.cpython-39.pyc created
Binary files /dev/null and b/tools/__pycache__/snowglobe.cpython-39.pyc differ
tools/snowglobe.py+7-2
......@@ -284,6 +284,9 @@ def render(data, definitions):
284284 host_network = any(task["hostNetwork"] for task in data["containers"].values())
285285 if host_network and not all(task["hostNetwork"] for task in data["containers"].values()):
286286 raise ValueError("mixed host and bridge networking in one group")
287 restricted = any(task["restrictedEgress"] for task in data["containers"].values())
288 if restricted and (host_network or not all(task["restrictedEgress"] for task in data["containers"].values())):
289 raise ValueError("restricted egress must cover every container in a bridge group")
287290 for task_name, task in data["containers"].items():
288291 for kind, endpoint in [("http", task.get("http")), *((port["name"], port) for port in task["tcp"])]:
289292 if endpoint:
......@@ -299,10 +302,12 @@ def render(data, definitions):
299302 if endpoint.get("loopback") or (not task["hostNetwork"] and kind == "http" and endpoint.get("hostPort") is None):
300303 network.append(' host_network = "loopback"')
301304 network.append(" }")
302 if network:
305 if network or restricted:
303306 lines.append(" network {")
304307 if host_network:
305308 lines.append(' mode = "host"')
309 elif restricted:
310 lines.append(' mode = "cni/sandbox"')
306311 lines += network + [" }"]
307312 for provider_id in sorted(dependencies(data)):
308313 provider = definitions[provider_id]
......@@ -403,7 +408,7 @@ def render(data, definitions):
403408 if task.get("readOnlyRoot"):
404409 lines.append(' readonly_rootfs = true')
405410 task_ports = [label for (owner, _), label in ports.items() if owner == task_name]
406 if task_ports and not task["hostNetwork"]:
411 if task_ports and not task["hostNetwork"] and not restricted:
407412 lines.append(f" ports = {q(task_ports)}")
408413 for field, values in (("cap_add", task["capAdd"]), ("devices", task["devices"]), ("extra_hosts", task["extraHosts"])):
409414 if values:
tools/spacebar.md+5
......@@ -70,3 +70,8 @@ Snow Globe's tailnet address as upstream. Its gateway relay sets
7070`X-Snowcord-Voice-Relay: phoenix-loopback` so voice advertises the VM's loopback
7171address. The guest profile lets Phoenix bind and receive UDP on its temporary
7272ports and send UDP only to the local relay port.
73
74The container runs on the `sandbox` CNI network (`restrictedEgress`), so the API,
75voice processes and SFU reach the public internet and PostgreSQL only. Forwarded
76traffic to private, tailnet and link-local addresses is dropped in the raw table
77(`nixos/snowglobe.nix`), including Snow Globe's own sshd and the router.