-
Notifications
You must be signed in to change notification settings - Fork 169
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
Switch to using Quinoa for UI backend, rather than Node.js + express #297
Conversation
Thank you @holly-cummins ! I'll take a closer look tomorrow or Friday, but first thing I noticed is that you shouldn't manually change anything in a folder named |
386d1b6
to
5e3a492
Compare
Ah, thanks, @edeandrea. It seemed wrong to leave the wrong values in source control. :) I assume CI/CD will just overwrite what's there with new content (which would be the same as what I generated), so my changes wouldn't do any harm? |
Yeah the CI process will essentially do an Just for future reference - no need to ever touch anything inside any directory named I'll take a closer look at this tomorrow/friday and comment on it. |
Thanks, @edeandrea! I guess if we wanted to make it mega-obvious the files were generated we could put those folders in the |
We could. I tried to make it obvious by having a README file in each directory saying not to manually modify anything in there as it'll be overwritten by the CI process. Apparently I failed there too :) |
On another subject, I notice that the matrix of what's getting run is the one from |
Yeah you'd never want to run the |
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 spent some time going through all of this and have made some comments in-line.
I also think that the docker compose stuff is missing. See src/main/docker-compose
from some of the other apps as well as the scripts/generate-docker-compose-resources.sh
. There probably need to be modifications in there as well.
Also you should check the scripts/deploy-to-azure-containerapps.sh
script and verify nothing needs to change there.
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.
Couple of things missing in here:
- Should define a
quarkus.application.name
. - Should define a random test port. See
quarkus.http.test-port=0 - Probably should be some OpenTelemetry stuff in here. See
quarkus-super-heroes/rest-villains/src/main/resources/application.properties
Lines 26 to 29 in 2f99db0
# OpenTelemetry quarkus.otel.resource.attributes=app=${quarkus.application.name},application=villains-service,system=quarkus-super-heroes quarkus.otel.exporter.otlp.traces.endpoint=http://otel-collector:4317 quarkus.datasource.jdbc.telemetry=true - Also missing the container image config. See https://github.com/quarkusio/quarkus-super-heroes/blob/2f99db07cfe69aa4313a9337fb2c76761d66850f/rest-villains/src/main/resources/application.properties#L47C1-L51 for examples.
- Should keep the logging config consistent with the rest of the apps. See https://github.com/quarkusio/quarkus-super-heroes/blob/2f99db07cfe69aa4313a9337fb2c76761d66850f/rest-villains/src/main/resources/application.properties#L15C9-L24 for examples.
- There is a lot of kubernetes/minikube/knative/openshift config here that is missing that should be here as well. See https://github.com/quarkusio/quarkus-super-heroes/blob/main/rest-villains/src/main/resources/application.properties#L53-L96 for examples.
- Also should define
quarkus.knative.min-scale=1
,quarkus.openshift.env.vars.CALCULATE_API_BASE_URL=true
andquarkus.knative.env.vars.CALCULATE_API_BASE_URL=true
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.
Wow, that's a lot of config. It makes me think we're missing some defaults. But I've added it all in.
Do you know what the difference is between app=
and application=
in the otel attributes?
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.
Its consistent with the labels we use in the kubernetes descriptors. In the case of this app, though, their value is probably the same because its a standalone app with nothing else. In the case of something like the villains app, app=rest-villains
and application=villains-service
.
As far as the rest of the config goes, we tried to introduce profiles to make it easier for users to deploy to various k8s variants without having to remember all the params they need to set. See https://github.com/quarkusio/quarkus-super-heroes/tree/main/rest-villains#deploying-directly-via-kubernetes-extensions for an example.
The README.md
file in ui-super-heroes
should probably also contain a lot of the same information as well now that there are multiple variants.
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.
If we did
%openshift.quarkus.config.profile.parent=kubernetes
instead of
%openshift.quarkus.config.profile.parent=prod
wouldn't we be able to drop a whole bunch of the copy-and-pasted config for the kubernetes-variants profiles?
And I feel like there should be a default for stuff like this:
quarkus.kubernetes.labels.app=${quarkus.application.name}
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'm not sure if the openshift extension will inherit things from the quarkus.kubernetes
namespace, because there is the quarkus.openshift
config namespace, and the documentation doesn't say anything about any kind of inheritance.
So, maybe, but untested.
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.
Ah, that's a good point about the namespace.
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 spent some time going through all of this and have made some comments in-line.
I also think that the docker compose stuff is missing. See src/main/docker-compose
from some of the other apps as well as the scripts/generate-docker-compose-resources.sh
. There probably need to be modifications in there as well.
Also you should check the scripts/deploy-to-azure-containerapps.sh
script and verify nothing needs to change there.
One other thing I noticed that I forgot to mention in the review - you'll need to modify the |
Done! For another WI, do you think it's possible to reduce the volume of docker compose files? I was a bit perplexed by the relationship between
Good point, and done! I think because the externals of the UI container are exactly the same, no changes are needed. |
For the docker compose stuff, yes src/main are hand maintained "snippets" whereas in the deploy directory is the "real" docker compose file. It's done this way so that we can have the root It was done that way to try and mimic the kubernetes extension. If we did away with that we'd have to hand craft 2 sets of compose files - 1 individually for each app and 1 uber compose file, both for jvm (and perhaps multiple jvm versions) and native. |
Got it, thanks. I've moved the discussion to #299. |
Ok, I think I've got all the comments. Thanks for spotting the issues, @edeandrea! |
Assuming that means you think it's ready for another pass through? :) Of so, I'll try to get to it later today |
Yes please, thank you! |
@someth2say FYI once this is merged it's going to have an effect on #291. Should actually make the work you are doing there easier I would think, although you may get some merge conflicts. Please be aware. |
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.
We're close! See comments in-line.
ui-super-heroes/pom.xml
Outdated
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> | ||
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id> | ||
<quarkus.platform.version>3.0.3.Final</quarkus.platform.version> |
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.
Should be 3.1.1.Final
to be consistent with the rest of the apps.
Hmm, I can't comment on #297 (comment). I don't think there's any point in getting too focussed on specific versions, is there? As soon as this merges, dependabot will take over and move to the latest version of dependencies. Until it merges, it's a manual process to try and keep adjusting the pom to reflect recent releases. |
Just that the simple-build-test workflow runs against this PR. Not that I expect any failures, but the version update could potentially incorporate a problem which then would cause the main CI to break when this gets merged to But you're right, probably not a big deal in this case. |
I think if the version of Quarkus in one microservice being a week out of date caused that kind of problem, we would need to go back to the Quarkus team and have a chat about their release testing. :) Although, actually, I don't think I entirely see the source of risk. If we think the I think I'm missing something about the process and the concern. |
This particular app has very little (meaning close to 0) tests, whereas all the other apps have quite a big test suite, meaning the simple build test workflow is definitely trustworthy for all the other apps. In the year and a half I've been maintaining this, I've never had an issue where something was green in the PR and then things were broken once merged (in the other apps - I've had it happen with the UI app, which is why I've tried to not touch it with a 10-foot pole :) ). Hopefully #290 will help there. |
That makes sense. I'm just not convinced that there's much correlation between someone being a human-dependabot and updating a pom.xml before merging and them doing manual testing. :) As you say, I think the solution is to improve the testing, not to try and do all version updates manually. Even if I updated to Quarkus 3.1.1 before merging, you know 3.1.2 would be along shortly, and then we have the exact same issue - "can we trust a version update if there's not someone to do manual testing of it before merging?" |
Ok, I’ve done the next round of changes, except for the following (as discussed above):
You’re quite right, @edeandrea, there should have been tests for the Java part. As there weren’t any for the old express server, I had kept parity, but we should aim higher. I’ve also added the Quinoa incantation to run the Javascript tests, should we ever add any (#290). The javascript tests were so missing that I also spotted an incorrect package in the Java code, so I’ve fixed that. |
Thank you very much @holly-cummins! I'll merge once CI has run. |
Thanks, @edeandrea! |
There were a few things I missed too in my reviews that I realized when I checked out the branch. I just committed them myself to this PR. |
Resolves #87.
Here's what I've done:
Code changes (the easy part!)
package.json
Testing
quarkus dev
mvn package
andjava -jar target/quarkus-app/quarkus-run.jar
mvn package -Pnative
and./target/ui-super-heroes-1.0-runner
… the front end starts in 27 ms on my machine, which is pretty awesomedocker-compose -f deploy/docker-compose/app.yml up
, although that gives me the old image which is still using node.js, so doesn’t tell me muchDeployment and automation
app.openshift.io/runtime: nodejs
to specify quarkus in all the Kubernetes .ymls, but I wasn’t sure how to test thisDocumentation
In both the k8s script and the automation docs we list out each project individually, to be able to exclude the UI project. That’s not needed anymore, so we may want to do some
*
-ing or “all” in the text, but I didn’t make those changes. We may also spot some other simplifications that come from having a homeogenous stack across all projects.I’m not totally sure I have the instructions for Azure Static Web Apps right, but it’s hard to test. We’re still generating the same static app as we were before. Before it would ask a node.js server for its config, now it asks a Quarkus server for its config, so I’m not sure how either model exactly works with a static deployment.