Skip to content

Assign random ports at configuration start (not later) #42986

Description

Description

When we set a port configuration like quarkus.http.port to 0, we want Quarkus to assign a random port.

The issue is the particular case of quarkus.http.port, the port generation and assignment are delegated to Vert.x. Why is this an issue?

Because we rely on the Config system to lookup the real quarkus.http.port, we have to mutate the configuration after the configuration is already loaded. We use SystemProperties, but this does not guarantee an override because there may be higher ordinal sources in the Config system that references quarkus.http.port.

Also, we need configuration to be loaded to start Vert.x. Once we load the configuration objects, we cache them for obvious reasons: for performance and to ensure everyone sees the exact copy of the configuration. This becomes another problem when we reference ${quarkus.http.port} as an expression, which at the time of evaluation will be set to 0.

We observed some of these issues in:

Implementation ideas

Ideally, we should move all random port assignments before loading the configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions