Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c36f01d
The ledger's single-writer lock is held for the daemon's lifetime, no…
Annactswell Sep 11, 2026
23b9857
Server exports its auth, keyed queue, ledger lock and shutdown as sub…
Annactswell Sep 13, 2026
6bd61ab
lookupSandbox: a node answers "do you hold this sandbox?" by name or …
Annactswell Sep 13, 2026
bbfb3a8
A node checks in with its gateway every 15 seconds: readings, build a…
Annactswell Sep 13, 2026
bc0e761
packages/gateway: the fleet's one door — nodes check in, new names ar…
Annactswell Sep 13, 2026
7b560ef
A sandbox placed and destroyed inside one check-in interval no longer…
Annactswell Sep 13, 2026
2fc3ea9
e2e: the gateway exam — two daemons behind a real gateway, a third th…
Annactswell Sep 13, 2026
4c697dd
The gateway's systemd unit, its row in the README, and the shared cha…
Annactswell Sep 13, 2026
f2df652
main.ts: import order, as biome sorts it
Annactswell Sep 13, 2026
fceecef
Gateway review: a wake is not a placement, an invalid name is refused…
Annactswell Sep 13, 2026
6701d59
A node whose gateway is on another machine must set DORMICE_NODE_ENDP…
Annactswell Sep 13, 2026
042b265
lookupSandbox takes the name's slot in one step: locks.run already an…
Annactswell Sep 13, 2026
1c4f1a2
A node endpoint is an origin, and a redirected check-in is reported i…
Annactswell Sep 13, 2026
9180737
forwardStream sends nothing for a client that already left
Annactswell Sep 13, 2026
a9b735b
A creator confirms its cached node before waking there; removeNode an…
Annactswell Sep 13, 2026
d3cc130
forwardStream flushes the node's head as soon as it arrives
Annactswell Sep 13, 2026
4bb011a
The check-in's first CPU reading is an honest null, not a percentage …
Annactswell Sep 13, 2026
00f6e45
The lookup gives up in two seconds on a black-holed node too, and say…
Annactswell Sep 14, 2026
bafb602
A creator whose client left while it waited for the slot asks no node
Annactswell Sep 14, 2026
42f9bd6
install.sh builds the gateway with the daemon and restarts a hand-ins…
Annactswell Sep 14, 2026
fb058e8
A check-in refusal reaches the log whole
Annactswell Sep 14, 2026
4996ab2
The slot comment in the native face tells the truth about the daemon
Annactswell Sep 14, 2026
7b91476
The name cache is bounded, least recently used first
Annactswell Sep 14, 2026
e179090
A 409 for two node ids at one endpoint says they are one daemon, and …
Annactswell Sep 14, 2026
18024fc
The check-in log says why in the transport's word, and speaks again w…
Annactswell Sep 14, 2026
63dc74f
A node whose gateway is on another machine must state its own DORMICE…
Annactswell Sep 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gateway-check-in-and-lookup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@dormice/shared": minor
---

Wire schemas for a fleet behind a gateway: `lookupSandbox` (a node answers "do you hold this sandbox?" by name or id), the node check-in (`checkInRequestSchema`, readings, build; its `endpoint` is an origin — `endpointSchema` drops a trailing slash and refuses a path), and the gateway's `listNodes` / `removeNode`. The host-metrics schema is split into named parts (`hostReadingSchema`, `dataDiskSchema`, `sandboxStateCountsSchema`) that `hostMetricsResponseSchema` still composes unchanged.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ pnpm monorepo:
| `packages/sdk` | `@dormice/sdk` — TypeScript client for the native API |
| `packages/cli` | `dormice` command-line tool (`dor` for short) |
| `packages/console` | Web console: React SPA, served by the daemon at `/console` |
| `packages/gateway` | The fleet's one door in front of one or more daemons: places new sandboxes, finds existing ones by asking the nodes, forwards everything else |
| `e2e` | Black-box suite: boots the built daemon, drives it over the wire |
| `examples` | Runnable demos: the native SDK, the official `e2b` package, a resident agent |

Expand Down
26 changes: 26 additions & 0 deletions deploy/dormice-gateway.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dormice gateway: the fleet's one door in front of one or more daemons.
# Configuration lives in /etc/dormice/gateway.env (full-line comments only
# there — systemd's EnvironmentFile treats an inline comment as part of the
# value). install.sh does not install this unit yet: the two-role install
# (gateway + node on one machine, `--role node` elsewhere) is a later step;
# until then it is copied into place by hand (docs/测试机搭建手册.md). Once it
# is enabled, install.sh re-runs rebuild the gateway with the daemon and
# restart this unit before the daemon's, so both run one commit.
[Unit]
Description=Dormice gateway (fleet front door)
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/local/bin/node /opt/dormice/packages/gateway/dist/main.js
EnvironmentFile=/etc/dormice/gateway.env
# Crash-only: the gateway holds no sandbox state — nodes check in again
# within seconds and the cache refills by asking — so restarting it is
# always safe.
Restart=always
RestartSec=3
# One process per database file. The SQLite lock enforces this; never wrap
# the gateway in a process manager that forks workers.

[Install]
WantedBy=multi-user.target
24 changes: 19 additions & 5 deletions deploy/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,15 @@ build_repo() {
else
pnpm install --frozen-lockfile
fi
# Build only what a daemon host runs: the server (plus its workspace deps),
# the CLI, and the console SPA. The website package is the project's Next.js
# marketing site — building it here would cost minutes and import a frontend
# toolchain's failure modes into an installer whose job is the daemon.
pnpm --filter "@dormice/server..." --filter "@dormice/cli..." --filter "@dormice/console" build
# Build only what a Dormice host runs: the server (plus its workspace deps),
# the CLI, the console SPA — and the gateway, whose dist must move with the
# daemon's on a machine that runs both (the single-machine install is a
# fleet of one): a gateway left on an older dist runs it at its next
# restart, against a daemon whose check-in it may no longer parse. Seconds
# to build. The website package is the project's Next.js marketing site —
# building it here would cost minutes and import a frontend toolchain's
# failure modes into an installer whose job is the daemon.
pnpm --filter "@dormice/server..." --filter "@dormice/gateway..." --filter "@dormice/cli..." --filter "@dormice/console" build
}

log "Dormice code ($INSTALL_DIR)"
Expand Down Expand Up @@ -728,6 +732,16 @@ log 'systemd service'
cp "$INSTALL_DIR/deploy/dormice.service" /etc/systemd/system/dormice.service
systemctl daemon-reload
systemctl enable dormice >/dev/null 2>&1
# A gateway installed by hand on this machine (deploy/dormice-gateway.service;
# install.sh does not install it yet) was just rebuilt with the daemon and is
# restarted first, so the daemon's first check-in lands on the new one: the two
# processes of a fleet of one run one commit, never two. Running or enabled —
# a unit started by hand and never enabled is running the old dist just the
# same.
if systemctl is-active -q dormice-gateway 2>/dev/null || systemctl is-enabled -q dormice-gateway 2>/dev/null; then
systemctl restart dormice-gateway
note 'restarted dormice-gateway (hand-installed unit, rebuilt with the daemon)'
fi
# Restart, not start: a re-run just built fresh code, and the daemon is
# crash-only by design — restarting it is always safe.
systemctl restart dormice
Expand Down
1 change: 1 addition & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"e2b": "^2.31.0"
},
"devDependencies": {
"@dormice/gateway": "workspace:*",
"@dormice/server": "workspace:*"
}
}
Loading
Loading