Skip to content
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

Simplify setup by removing path rewrite #4653

Merged
merged 1 commit into from
May 20, 2022
Merged

Conversation

baierjan
Copy link
Member

@baierjan baierjan commented May 13, 2022

Make websockets server understand the /api/v1/ws route which is
currently rewritten by a reverse-proxy to /ws. This should remove the
need for having a reverse-proxy as all paths are now handled as are.

There is no need to change anything in the setup as the other route
(i.e. /ws) is also handled in the same way.

Prerequisites:

@codecov
Copy link

codecov bot commented May 13, 2022

Codecov Report

Merging #4653 (dba08b6) into master (7b715e3) will decrease coverage by 0.00%.
The diff coverage is n/a.

❗ Current head dba08b6 differs from pull request most recent head 6b1b73a. Consider uploading reports for the commit 6b1b73a to get more accurate results

@@            Coverage Diff             @@
##           master    #4653      +/-   ##
==========================================
- Coverage   98.05%   98.05%   -0.01%     
==========================================
  Files         374      374              
  Lines       34545    34514      -31     
==========================================
- Hits        33874    33843      -31     
  Misses        671      671              
Impacted Files Coverage Δ
t/28-logging.t 100.00% <0.00%> (ø)
lib/OpenQA/Log.pm 100.00% <0.00%> (ø)
t/ui/23-audit-log.t 100.00% <0.00%> (ø)
t/24-worker-engine.t 100.00% <0.00%> (ø)
lib/OpenQA/Schema/Result/Comments.pm 100.00% <0.00%> (ø)
lib/OpenQA/Schema/ResultSet/Comments.pm 100.00% <0.00%> (ø)
lib/OpenQA/WebAPI/Controller/API/V1/Comment.pm 100.00% <0.00%> (ø)
lib/OpenQA/Worker/Engines/isotovideo.pm 97.17% <0.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b715e3...6b1b73a. Read the comment docs.

@@ -30,7 +30,7 @@ http {
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;

rewrite /api/v1/ws/(.*) /ws/$1 break;
rewrite /api/v1/ws/(.*) /api/v1/ws/$1 break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your reasoning in the commit message but to me this looks like /api/v1/ws/<foo> is "rewritten" to /api/v1/ws/<foo> meaning not rewritten at all. What am I overlooking?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, isn't the idea to be able to drop the rewrite completely?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not rewritten at all, that is the intended behavior (or to put it differently, the rewrite is no longer needed). I could probably delete the rewrite completely, but I am not sure if it has another side-effect, as the same style of rewrite can be found in the liveviewhandler section: rewrite /liveviewhandler/(.*) /liveviewhandler/$1 break;.

If you are sure, it has no other functionality (like disabling other possible rewrites due to the break) I would delete both of them to keep it consistent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose both rewrites can be deleted then.

Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good. And now to testing. Feel free to test on o3+osd as well after trying it out locally including the liveview

@baierjan
Copy link
Member Author

good. And now to testing. Feel free to test on o3+osd as well after trying it out locally including the liveview

Hm, the only real code change is adding a route, that one was already tested during development. The liveview was only changed in the template for nginx, which is as far as I know not used on o3 nor osd. So there is not much added value here. I can probably use the setup from docker compose, where the nginx is actually used (in the load-balancer container which is not build by us).

@okurz
Copy link
Member

okurz commented May 16, 2022

good. And now to testing. Feel free to test on o3+osd as well after trying it out locally including the liveview

Hm, the only real code change is adding a route, that one was already tested during development. The liveview was only changed in the template for nginx, which is as far as I know not used on o3 nor osd. So there is not much added value here.

Well, I mean for example just apply the apache changes on o3 or osd and see that everything still works as expected.

@baierjan
Copy link
Member Author

good. And now to testing. Feel free to test on o3+osd as well after trying it out locally including the liveview

Hm, the only real code change is adding a route, that one was already tested during development. The liveview was only changed in the template for nginx, which is as far as I know not used on o3 nor osd. So there is not much added value here.

Well, I mean for example just apply the apache changes on o3 or osd and see that everything still works as expected.

I can't apply the apache changes before the code change (and the code change does not require anything else, the new route will just not be used in the current setup). Or do you mean I should apply both manually (because I do not see any added value here)?

@Martchus
Copy link
Contributor

The best approach is likely to install the packages generated by the OBS checks locally or on a staging instance and see whether it still works after restarting apache2 and the websocket server. (/etc/apache2/vhosts.d/openqa-common.inc is contained by the openQA package so simply installing the package from the OBS checks will replace both, the apache config and the websockt server code.)

@okurz
Copy link
Member

okurz commented May 16, 2022

Or do you mean I should apply both manually (because I do not see any added value here)?

Yes, sorry, then apply both. Or, create a separate pull request with just the code change first, have it merged, then we apply config changes afterwards

@baierjan
Copy link
Member Author

Or do you mean I should apply both manually (because I do not see any added value here)?

Yes, sorry, then apply both. Or, create a separate pull request with just the code change first, have it merged, then we apply config changes afterwards

Right, I did not realize that the apache/nginx templates are actually not templates but can be used directly in some deployments.

I created #4660 with only the first commit changes (adding the new route), this will follow.

@okurz
Copy link
Member

okurz commented May 19, 2022

#4660 merged

So, will you test it out on o3/osd or any other instance?

@okurz
Copy link
Member

okurz commented May 19, 2022

@Mergifyio rebase

There is no need to change anything in the setup as the other route
(i.e. `/ws`) is also handled in the same way. On the other hand, the
rewrite is unnecessary.
@mergify
Copy link
Contributor

mergify bot commented May 19, 2022

rebase

✅ Branch has been successfully rebased

@okurz okurz added the acceptance-tests-needed Needed for code that is required to be tested on a production-like environment label May 19, 2022
@baierjan
Copy link
Member Author

#4660 merged

So, will you test it out on o3/osd or any other instance?

Currently, this is set on osd. So far, no problems detected.

@okurz okurz removed the acceptance-tests-needed Needed for code that is required to be tested on a production-like environment label May 20, 2022
Copy link
Member

@okurz okurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, counts as successful test for me then :)

@mergify mergify bot merged commit ae749dc into master May 20, 2022
@okurz okurz deleted the jbaier-fix/simplify-setup branch May 20, 2022 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants