-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add service_port_delta config for livehandler #5435
Add service_port_delta config for livehandler #5435
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks generally good but I think having to specify the port in the worker config should be avoided (as explained in an inline comment).
etc/openqa/openqa.ini
Outdated
## For the developer mode panel: if not accessing the web UI via Apache/NGINX reverse | ||
## proxy, then connect to the livehandler daemon at the <web UI port> + service_port_delta. | ||
## The livehandler daemon is supposed to run under the <web UI port> + 2. | ||
## If you want to keep using a reverse proxy while accessing the webUI through a custom port |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the sake of consistency:
## If you want to keep using a reverse proxy while accessing the webUI through a custom port | |
## If you want to keep using a reverse proxy while accessing the web UI through a custom port |
etc/openqa/openqa.ini
Outdated
## proxy, then connect to the livehandler daemon at the <web UI port> + service_port_delta. | ||
## The livehandler daemon is supposed to run under the <web UI port> + 2. | ||
## If you want to keep using a reverse proxy while accessing the webUI through a custom port | ||
## (e.g. 8080) then just set the service_port_delta = 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## (e.g. 8080) then just set the service_port_delta = 0. | |
## (e.g. 8080) then just set `service_port_delta` to 0. |
## (e.g. 8080) then just set the service_port_delta = 0. | |
## (e.g. 8080) then just set `service_port_delta = 0`. |
lib/OpenQA/Worker/Job.pm
Outdated
@@ -964,9 +964,11 @@ sub post_upload_progress_to_liveviewhandler { | |||
$self->{_progress_info} = \%new_progress_info; | |||
|
|||
my $job_id = $self->id; | |||
my $global_settings = OpenQA::Worker::Settings->new->global_settings; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I remember correctly, this would parse the INI file again. It would be more efficient to re-use the existing settings object:
my $global_settings = OpenQA::Worker::Settings->new->global_settings; | |
my $global_settings = $self->worker->settings->global_settings; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better, we don't have to retrieve the worker settings at all once the web UI is telling the worker what the service port config is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depends on where the worker will store that port. Probably you'd add another attribute on worker level for this so the code accessing it would become $self->worker->service_port_delta
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've add it as a attribute pretty much exactly the same as the worker_id that is also received from the web Ui when it registers a worker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch is coming as soon as i think it has a chance of passing the CI tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About CI failures: The javascript style issues should be fixed when you rebase your branch onto current master where a fix was applied. The other test failures are certainly related, e.g.
- https://app.circleci.com/pipelines/github/os-autoinst/openQA/12812/workflows/ba5fce3d-e4ab-466f-a823-86ba92b79cd0/jobs/119431 stating " # message => "http://localhost:9526/asset/6229f1fe02/bootstrap.js 269:246 "jQuery.Deferred exception: Failed to construct 'WebSocket': The URL 'ws:/localhost:NaN/liveviewhandler/tests/1/developer/ws-proxy' is invalid." "Error: Failed to construct 'WebSocket': The URL 'ws:/localhost:NaN/liveviewhandler/tests/1/developer/ws-proxy' is invalid.\n at establishWebSocketConnection (http://localhost:9526/asset/285cd7a70d/ws_console.js:9:48)\\n at setupWebSocketConsole (http://localhost:9526/asset/285cd7a70d/ws_console.js:15:230)\\n at HTMLDocument.\u003Canonymous> (http://localhost:9526/tests/1/developer/ws-console?proxy=1:34:17)\\n at mightThrow (http://localhost:9526/asset/6229f1fe02/bootstrap.js:259:18)\\n at process (http://localhost:9526/asset/6229f1fe02/bootstrap.js:261:89)\" undefined",
- https://app.circleci.com/pipelines/github/os-autoinst/openQA/12812/workflows/ba5fce3d-e4ab-466f-a823-86ba92b79cd0/jobs/119428 with
# Failed test '"test" configuration'
# at t/config.t line 184.
# Structures begin differing at:
# $got->{global}{service_port_delta} = '2'
# $expected->{global}{service_port_delta} = Does not exist
etc/openqa/workers.ini
Outdated
# Config for livehandler port; see service_port_delta in openqa.ini. | ||
# SERVICE_PORT_DELTA = 2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if that wasn't necessary. The web UI could tell the worker when the worker registers what the service port is. This way one would only have to configure this in one place and no mismatch was possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we put it in the JSON? Not sure if there's a better way to communicate state 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I meant. When the worker registers the JSON reply would contain the service port. (We still need a fallback to 2 so new workers still work when registering on an old web UI.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @deborahbrouwer, welcome to this project 💯 🎆 🥳 and thank you for your contribution. Same as Martchus I agree that this change can be helpful just needs "CI fixes" and the part about not needing the port delta stated explicitly in each and every worker config when the webUI can communicate what it needs to the worker.
And please rebase against the latest master branch because otherwise the JavaScript test will keep failing. (It was only fixed recently.) |
94403b2
to
20842c7
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5435 +/- ##
=======================================
Coverage 98.37% 98.37%
=======================================
Files 389 389
Lines 37744 37751 +7
=======================================
+ Hits 37132 37139 +7
Misses 612 612 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good; I only have minor nitpicks (see inline comments).
Instead of hard-coding the service port delta for the livehandler, make the service port delta configurable while still defaulting to the expected value of 2. This allows cloud and/or containerized setups to access the web UI through a non-standard port while continuing to access the livehandler through a reverse proxy just by setting the service port delta to 0. Issue: https://progress.opensuse.org/issues/153499
20842c7
to
07543d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. This looks great!
EDIT: I approved the CI run. As soon as all checks pass then mergify will automatically merge this PR.
Instead of hard-coding the service port delta for the livehandler, make the service port delta configurable while still defaulting to the expected value of 2. This allows cloud and/or containerized setups to access the web UI through a non-standard port while continuing to access the livehandler through a reverse proxy just by setting the service port delta to 0.
Issue: https://progress.opensuse.org/issues/153499