Phase7
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 9s
CI / Go — node-agent tests (push) Failing after 8s
CI / Go — edge-gateway build (push) Successful in 14s

This commit is contained in:
smueller
2026-06-26 13:20:55 +02:00
parent 49a98ee31d
commit ab21f53cdd
86 changed files with 1207 additions and 63 deletions

View File

@@ -2,53 +2,54 @@
Last updated: 2026-06-26
## Current phase: Phase 6Multi-Node and queue
## Current phase: Phase 7Idle shutdown and free tier
### Phase 6 completed
### Phase 7 completed
| Area | Status | Notes |
|------|--------|-------|
| `@hexahost/scheduler` | Done | Node scoring, RAM/slot capacity, least-loaded placement |
| Prisma start queue + node capacity | Done | `ServerStartQueueEntry`, `maxRamMb`, `platformRamMb`, `QUEUED`/`UNKNOWN` |
| `@hexahost/contracts` phase 6 | Done | `nodes.ts`, queue schemas, extended server status |
| Worker scheduler integration | Done | Provisioning uses `selectNodeForAllocation` |
| Start queue | Done | API enqueue + worker tick dispatch |
| Node health tick | Done | Heartbeat timeout → `UNREACHABLE`, servers → `UNKNOWN` |
| Drain / maintenance | Done | Admin `POST /admin/nodes/:id/drain` and `/maintenance` |
| Allocation release | Done | Released on provision failure |
| Dev seed | Done | Second node `local-dev-2` for multi-node tests |
| `@hexahost/metering` | Done | RAM-GB-minute credits, Minecraft `list` parser |
| Prisma billing models | Done | `CreditWallet`, `CreditTransaction`, `UsageRecord` |
| Plan idle/quota fields | Done | Timeouts, countdown, `maxServersPerUser`, `queuePriority` |
| Idle controller (worker) | Done | Player poll, countdown, auto-stop |
| Usage metering (worker) | Done | 60s tick debits wallet, writes `UsageRecord` |
| API billing | Done | `GET /account/wallet`, `GET /account/usage` |
| API idle | Done | `GET /servers/:id/idle`, `POST .../idle/extend` |
| Quotas & credits | Done | Server create/start guards |
| Web | Done | Credit balance on dashboard, idle countdown on server card |
### Abnahmekriterium Phase 6
### Abnahmekriterium Phase 7
- [x] Scheduler distributes servers across eligible nodes (least loaded RAM)
- [x] Resource reservation via `GameServerAllocation` + node RAM budget
- [x] Start queue when node lacks capacity
- [x] Drain excludes node from new allocations
- [x] Maintenance mode blocks scheduling
- [x] Node heartbeat loss marks servers `UNKNOWN`
- [ ] Manual E2E with two agents on different nodes
- [x] Empty running server triggers idle countdown and auto-stop
- [x] Player connection cancels countdown (via `list` poll)
- [x] Usage debited to credit wallet with ledger + usage records
- [x] Free plan grants credits on signup
- [x] Server quota per plan enforced
- [ ] Manual E2E: start server, wait idle, verify stop + usage
### Local test (two nodes)
### Local test
1. `pnpm db:seed` — note both enrollment tokens
2. Start agent 1 with `NODE_ID=...001` and agent 2 with `NODE_ID=...002`
3. Create several servers and start them — verify different `nodeId` in API responses
4. Saturate one node RAM (`maxRamMb` low) → next server lands on other node
5. `POST /admin/nodes/:id/drain` — new provisions skip drained node
1. `pnpm db:migrate && pnpm db:seed`
2. Register/login → dashboard shows **5000 credits** (free plan)
3. Create & start server → credits decrease while running
4. Leave server empty → after ~10 min idle + 60s countdown → auto-stop
5. `GET /account/usage` shows RAM-GB-minute records
### Known limitations
### Free plan defaults (seed)
- Offline migration not implemented (manual re-provision only)
- No admin UI for nodes yet (API only)
- Queue priority uses plan metadata placeholder (`priority=0`)
- CPU overcommit not configurable yet
- `idleTimeoutMinutes`: 10
- `idleCountdownSeconds`: 60
- `monthlyCreditGrant`: 5000
- `maxServersPerUser`: 3
---
## Phase 6 — Multi-Node and queue ✅
---
## Phase 5 — Software & add-ons ✅
Modrinth catalog, addon install/remove, SHA512 verify.
---
## Phase 4 — Worlds & backups ✅
@@ -69,6 +70,6 @@ Modrinth catalog, addon install/remove, SHA512 verify.
## Phase 0 — Monorepo foundation ✅
### Next phase: Phase 7Idle shutdown and free tier
### Next phase: Phase 8DNS and join-to-start
- Player detection, auto-stop, quotas, credits, usage metering
- Port pools, DNS-SRV, edge gateway, start on connect