Fix port allocation scoped per-site for transport services#296
Draft
Fix port allocation scoped per-site for transport services#296
Conversation
Agent-Logs-Url: https://github.com/mieweb/opensource-server/sessions/c6615a50-b38a-469f-b541-ae051418f881 Co-authored-by: runleveldev <44057501+runleveldev@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix port allocation shared across sites
Fix port allocation scoped per-site for transport services
May 6, 2026
runleveldev
requested changes
May 6, 2026
Collaborator
runleveldev
left a comment
There was a problem hiding this comment.
@copilot there is a unique constraint on (protocol, externalPort) in the TransportServices model. To support this change, the unique constraint should instead be on (siteId, protocol, externalPort). There is a one-to-one relationship from TransportService to Sites via TransportService(serviceId)->Service(containerId)->Container(nodeId)->Node(siteId). Denormalization of the TransportService model may be nessecary to apply this change.
… port constraint Agent-Logs-Url: https://github.com/mieweb/opensource-server/sessions/755f5326-8e1f-43d8-8b0b-8426d4f6f98c Co-authored-by: runleveldev <44057501+runleveldev@users.noreply.github.com>
Contributor
Author
Done in 5cb4f1c.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port allocation for TCP/UDP transport services was global — port numbers from site 1 were treated as unavailable when allocating for site 2, causing unexpectedly high ports in new sites.
Changes
migrations/20260506000000-transport-service-site-scoped-port-constraint.js(new)siteIdcolumn toTransportServices, backfilled viaService → Container(protocol, externalPort)unique index(siteId, protocol, externalPort)unique indexmodels/transport-service.jssiteIdfield added to the model with abelongsTo SiteassociationnextAvailablePortInRangenow requiressiteIdand filters directly on theTransportServicestable — no joins neededrouters/containers.jssiteIdtonextAvailablePortInRangeand include it inTransportService.create()65565→65535(valid TCP/UDP ceiling)