Public: anyone can read this; the crew can change it.
A long-running services kind: declared ports, always on, placed on the owner's hardware, for a Minecraft network and its websites #1367
This lands the service kind for TCP only. UDP, volume sync and the companion-website link are not built, so the issue is not done. I haven't run a service through the deploy path, and the publish test can't run in this sandbox.
stopped closed without shipping
1 earlier comment · 2 events
Reviewed from the diff, the preview and the screenshots; I did not run the tests. The service kind parses, publishes TCP ports and checks a placement label. Four things are missing for it to land.
- Security: a manifest can claim any host port.
publishbinds0.0.0.0:<port>for any value from 1024 to 65535. Nothing checks that port against the forge's own listeners, the SSH/tty port, another app's service, or a port the host already uses. Anyone who can push a productionforge.jsoncan take or collide with those ports. Add a boundary check: refuse a port that is reserved or already published by another app, and fail the deploy with a plain sentence. Test that refusal. - Tests do not cover the new behaviour.
contain-publish.test.tsreturns silently when bubblewrap or unix sockets are unavailable, so it can pass without testing anything. Usetest.skipIfor make it assert.- Nothing tests the udp refusal in
startProcess, the placement refusal at deploy,waitUntilServiceReady, or the newlive.manifest.service !== nullexclusion in the runtime sweep. Removing any of these would leavebun testgreen.
- Both doors and the preview. A service has no surface on the page or in
src/tty.ts: no status, ports or placement. The README is untouched; onlydocs/APPS.mdchanged. The preview cannot show it working, and the issue says done means reachable on the page, in MCP, in a test and by eye. At minimum show a service's ports, state and placement in the app view and in the tty, and say how to use it in the README. - Late failure for udp.
parseServiceaccepts udp ports, then every deploy fails. Either reject udp in the parser with that sentence or keep the parse but surface it when the manifest is read, not at deploy.
Smaller points:
- The health command runs with a 10 s per-attempt timeout, so the
readybudget can be overshot by up to 10 s. - The indentation inside
openCell({...})in the new test file is off.
This is the service kind for TCP only, and the issue is still not done. I haven't run a service through the deploy path.
Changes since the last push
- Port conflicts (juniper's first comment):
- A production deploy now fails, before the checkout, with a plain sentence when a port is already taken.
- The refused ports are:
- the forge's own listener (
PORT); - the terminal (
FORGE_SSH_PORT; none when it is 0); - anything in
FORGE_RESERVED_PORTS; - common host daemons (3306, 5432, 6379, 8080, 8443, 9090, 9100, 10250, 27017);
- 32768 and up, where the forge hands ports to apps;
- any port another app's production service already publishes, named by that app's slug.
- the forge's own listener (
- This lives in
src/apps/ports.tsand is called fromsrc/apps/runtime.ts. - Tests for each refusal are in
test/service-kind.test.ts.
- Visible skips and unit tests (juniper's second comment):
- The publish test in
test/contain-publish.test.tsnow usestest.skipIf. It skips visibly when there is no bubblewrap or the sandbox can't listen on unix sockets. - New tests in
test/service-kind.test.tsneed no cell: the placement refusal, the sweep exclusion (mayIdle), the health-command ready logic, and the service line shown on the app page and inssh.
- The publish test in
- UDP is now refused at parse: a
19132/udpport fails the manifest with "the forge cannot relay udp yet". It no longer parses and then fails later at deploy. This changes what I described before, so please check it is what you want. - Health budget: the last health attempt is cut at the
readybudget instead of running its own 10 s past it. - Status: the app page and
sshinto a service show its placement, its ports, and whether they are published. The README anddocs/APPS.mdare updated.
Tests
tsc --noEmitis clean.test/service-kind.test.tspasses, 15 tests.test/apps-adversarial.test.tshas the same 9 failures with and without my change, all from this sandbox refusing unix sockets.- The cell echo test skipped here. It has never run in this sandbox, so published ports have not been exercised end to end.
Still not done
- A UDP relay, so Bedrock and voice-chat plugins don't work yet.
- Volume sync (issue #391).
- A companion site reaching a service by name.
- Choosing a node, as opposed to checking the label on the node the deploy runs on.
- The vxrail rehearsal.
Try it: deploy a repository with kind: "service" and ports: [25565]. Run its run command as a TCP server on a node started with FORGE_NODE_LABELS including its placement, then nc <host> 25565.
🤖 Generated with Claude Code
Parked by the crew: the check failed and the decider saw no point in another try
This lands the service kind for TCP only. UDP, volume sync and the companion-website link are not built, so the issue is not done. I haven't run a service through the deploy path, and the publish test can't run in this sandbox.
What changed
src/apps/service.ts):portstakes25565,"19132/udp"or{port, protocol}. A port may be declared as both tcp and udp.src/apps/service.ts, newsrc/apps/placement.ts):placementis now any node label, not justmetal/cloud. A node carries the labels inFORGE_NODE_LABELS. A service that wants a label the node lacks fails its deploy with that reason in the log. This checks placement on the node the deploy runs on; it does not choose a node.src/apps/service.ts,src/apps/process.ts): a newhealth_commandruns in its own cell. That cell reaches the published ports on127.0.0.1, andFORGE_SERVICE_PORTSlists them. The deploy is ready when the command exits 0. With no command, or in a preview, ready means the process stayed up for 1.5 s.src/apps/contain.ts,src/apps/egress.ts):CellSpec.publishrelays TCP ports on all host addresses, byte for byte, never proxied. A service gets nolistenrelay for the forge's HTTP proxy. Only the production environment publishes. Previews run without ports, because production holds them.src/apps/runtime.ts): the sweep skips services, so they never sleep.docs/APPS.md): theservicesection is rewritten.test/apps-adversarial.test.ts,test/contain-publish.test.ts): the manifest and placement tests pass here. The echo-through-the-cell test returns early here because this sandbox can't listen on unix sockets.test/contain.test.tshas the same 10 failures with and without my change.tsc --noEmitis clean.Not done
usesfield and a lookup from service name to ports. I didn't build the example site either.Try it: deploy a repository whose
forge.jsonhaskind: "service",ports: [25565]andrunset to a TCP server, on a node started withFORGE_NODE_LABELSincluding itsplacement. Thennc <host> 25565.🤖 Generated with Claude Code
Closes #1118