infra
infra copied to clipboard
Use go.uber.org/fx to organize orchestrator's `main`
This helps us break apart the main function into components, which also helps us close cleanly.
[!NOTE] Refactors the orchestrator to an Uber FX-based modular app with graceful startup/shutdown, updates networking/storage APIs and callers, and refreshes CI/docs/dependencies.
- Orchestrator:
- Switch to Uber FX-based IOC: add modules for
grpc,cmux,health,hyperloop,network,observability,storage,sandboxes,template-manager,events, and optionalclickhouse/redis.- Graceful startup/shutdown: draining, cmux-managed listeners, wait-on-sandboxes, dot-graph dump; add
ioc.New/Validateand startup/shutdown test.- API changes:
server.Newnow returns(*Server, error);hyperloopserver.NewHyperloopServer(port, logger, sandboxes)(no ctx); networkStorageaddsSetup(ctx);Pool.Populate(ctx)returns error;NewStorageLocal(config)signature; KV/Memory storages implementSetup;ServiceInfoconstructor no longer needs ctx;Sandbox.Factorytracks active sandboxes (Wait/Add/Subtract).- Build/Bench:
- Update
cmd/build-templateand benchmarks to new network/storage signatures and error handling; return errors on pool population.- Template Cache/Build:
- Tolerate
ENOENTon cache cleanup; add diagnostic dump utility in tests.- CI/Docs/Config:
- CI: enable NBD and udev rules; DEV-LOCAL steps refined; add
.env.local; ignoregraph.dot.- Dependencies:
- Add
go.uber.org/fx; adjustgolang.org/x/*, Docker/Testcontainers versions; scripts updatee2band adddotenv.Written by Cursor Bugbot for commit 277ba6c9dba4796a01702475f91c4c7abe95d5dc. This will update automatically on new commits. Configure here.