infra icon indicating copy to clipboard operation
infra copied to clipboard

Use go.uber.org/fx to organize orchestrator's `main`

Open djeebus opened this issue 2 months ago • 0 comments

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 optional clickhouse/redis.
    • Graceful startup/shutdown: draining, cmux-managed listeners, wait-on-sandboxes, dot-graph dump; add ioc.New/Validate and startup/shutdown test.
    • API changes: server.New now returns (*Server, error); hyperloopserver.NewHyperloopServer(port, logger, sandboxes) (no ctx); network Storage adds Setup(ctx); Pool.Populate(ctx) returns error; NewStorageLocal(config) signature; KV/Memory storages implement Setup; ServiceInfo constructor no longer needs ctx; Sandbox.Factory tracks active sandboxes (Wait/Add/Subtract).
  • Build/Bench:
    • Update cmd/build-template and benchmarks to new network/storage signatures and error handling; return errors on pool population.
  • Template Cache/Build:
    • Tolerate ENOENT on cache cleanup; add diagnostic dump utility in tests.
  • CI/Docs/Config:
    • CI: enable NBD and udev rules; DEV-LOCAL steps refined; add .env.local; ignore graph.dot.
  • Dependencies:
    • Add go.uber.org/fx; adjust golang.org/x/*, Docker/Testcontainers versions; scripts update e2b and add dotenv.

Written by Cursor Bugbot for commit 277ba6c9dba4796a01702475f91c4c7abe95d5dc. This will update automatically on new commits. Configure here.

djeebus avatar Nov 17 '25 19:11 djeebus