1.9 KiB
Module Binding Notes
Legacy rollout flags (Module/Rollout) have been removed. Hubs now bind to modules solely through their Type values, which map 1:1 to registered modules (docker, npm, go, pypi, composer, debian, apk, ...).
Migrating to a New Module
-
Register the module
Implement the new module underinternal/hubmodule/<type>/, callhubmodule.MustRegisterininit(), and register hooks viahooks.MustRegister. -
Expose a handler
New modules continue to reuse the shared proxy handler registered viaproxy.RegisterModule. No per-module handler wiring is required unless the module supplies a bespoke handler. -
Update the config schema
Add the new type tointernal/config/validation.go’ssupportedHubTypes, then redeploy. Every hub that should use the new module only needsType = "<type>"plus the usualDomain/Upstreamfields. -
Verify diagnostics
curl http://127.0.0.1:<port>/-/modulesto ensure the new type appears undermodules[]and that the desired hubs showmodule_key="<type>". -
Monitor logs
Structured logs still carrymodule_key, making it easy to confirm that traffic is flowing through the expected module. Example:{"action":"proxy","hub":"npm","module_key":"npm","cache_hit":false,"upstream_status":200} -
Rollback
Since modules are now type-driven, rollback is as simple as reverting theTypevalue (or config deployment) back to the previous module’s type.
Troubleshooting
module_not_foundin diagnostics → ensure the module registered viahubmodule.MustRegisterbefore the hub references its type.- Hooks missing →
/-/modulesexposeshook_registry; confirm the new type reportsregistered. - Unexpected module key in logs → confirm the running binary includes your module (imported in
internal/config/modules.go) and that the config/--configpath matches the deployed file.