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

Draft for Spring Boot 3 WAR post #3655

Merged
merged 10 commits into from Apr 30, 2024
Merged

Draft for Spring Boot 3 WAR post #3655

merged 10 commits into from Apr 30, 2024

Conversation

scottkurz
Copy link
Member

@scottkurz scottkurz commented Mar 24, 2024

Fixes #3539.

I realize there are quite a few things not polished yet.

But I was hoping to start getting a review with the general outline of the content. (This is more than an outline, it's the content itself... but what I'm saying is that the question of what we include could still be up for debate.)

So I'll just cc:
@tjwatson @cbridgha @yeekangc @lauracowen @hlhoots
and wait for a PR review until it's more polished.

Also we didn't pin down the key question of does this replace the earlier article more "inline" or do we do more of delete the old and create the new?

Also, I'm not sure how much detail is needed for the minor/micro release support... e.g. 3.1.x vs 3.2.x , vs 3.2.3 vs 3.2.4 etc. I'm confused about that.
E.g. in 24.0.0.1 (OpenLiberty/open-liberty#27276) we say we have support for 3.2 thinning

Maybe this needs a doc update too? Opened doc issue: OpenLiberty/docs#7284

@scottkurz
Copy link
Member Author

Maybe I should add into the blog post, for completeness, that if you choose a JAR packaging type your only option is to use the optimized deployment with <feature>springBoot-3.0</feature>

@scottkurz
Copy link
Member Author

I did get one internal comment suggesting showing more of the Java and server.xml. IMO, this sort of would amount to having a new or updated guide. CC'ing @gkwan-ibm as feedback/input.

@gkwan-ibm
Copy link
Member

hi @scottkurz

would you explain more what need to be updated in the existing/new guide? Or even better if you can open an issue on the guide-spring-boot or guides-common repo. Thanks

:url-about: /
//Blank line here is necessary before starting the body of the post.

As of Liberty version 23.0.0.9 there are now two ways to deploy Spring Boot WAR files on Liberty.
Copy link
Member

Choose a reason for hiding this comment

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

I know this hasn't been addressed in any of our other blog posts/guide about SB support yet either, but I think this sentence should be followed by answering the question of "why would I do that [deploy a Spring Boot WAR on Liberty]?". Without it, yes, the post is providing some helpful documentation for people who need it, but a blog post should provide more than that and it would be good to also convince readers that it's a valuable thing to do for relevant use cases.

Copy link
Member

Choose a reason for hiding this comment

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

eg to benefit from InstantOn for a faster startup whilst maintaining throughput and not having to modify the app?

Copy link
Member Author

Choose a reason for hiding this comment

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

The answer to "why" might depend on your baseline alternative

  • not going to get into why choose WAR but assume they know. I even feel like "..to take advantage of the Spring and Spring Boot libraries " is too obvious to mention but leaving it for now as a compromise
  • follow-up.. this good to reference:

That answers why SB on Liberty.

As far as why "optimized deployment"? That's addressed with:

This deployment adds some additional configuration options, and provides advantages for efficiently building Docker container images

OTOH, InstantOn is supposed to work with both deployments.


As of Liberty version 23.0.0.9 there are now two ways to deploy Spring Boot WAR files on Liberty.

While a Spring Boot WAR can be deployed like any standard Jakarta EE WAR, it can also be deployed using an optimized deployment for Spring Boot applications. This deployment adds some additional configuration options, and provides advantages for efficiently building Docker container images.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
While a Spring Boot WAR can be deployed like any standard Jakarta EE WAR, it can also be deployed using an optimized deployment for Spring Boot applications. This deployment adds some additional configuration options, and provides advantages for efficiently building Docker container images.
While a Spring Boot WAR can be deployed like any standard Jakarta EE WAR, the WAR can be optimized deployment for Spring Boot applications. The optimization adds some additional configuration options, and provides advantages for efficiently building Docker container images.

Copy link
Member

Choose a reason for hiding this comment

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

Also, why would you ever use a non-optimized approach? It sounds, um, sub-optimal...

Copy link
Member Author

Choose a reason for hiding this comment

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

  • This part "..the WAR can be optimized deployment .." read a bit awkward so I took your suggestion and tweaked a bit

"Also, why would you ever use a non-optimized approach? It sounds, um, sub-optimal..."

Because:

  • you need extra pom.xml config
  • you need special server.xml config
  • you can't use dev mode

and because you might want to deploy like any WAR.

I added:
"using some extra pom.xml and server.xml configuration."

to maybe thread the needle here or feel free to suggest another wording.


While a Spring Boot WAR can be deployed like any standard Jakarta EE WAR, it can also be deployed using an optimized deployment for Spring Boot applications. This deployment adds some additional configuration options, and provides advantages for efficiently building Docker container images.

In this blog post we will step through a simple flow starting from the Spring Initializr. We will deploy this to Liberty via a standard WAR deployment without any Liberty modifications to the app.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
In this blog post we will step through a simple flow starting from the Spring Initializr. We will deploy this to Liberty via a standard WAR deployment without any Liberty modifications to the app.
In this blog post, we create a simple app by using the Spring Initializr, and then deploy the app as a WAR to Liberty without any modifications.

Copy link
Member Author

Choose a reason for hiding this comment

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

Trying to emphasize the "typical deployment" contrasted with the later optimized, so added to your wording"

"..., using the same deployment as for any WAR"


In this blog post we will step through a simple flow starting from the Spring Initializr. We will deploy this to Liberty via a standard WAR deployment without any Liberty modifications to the app.

From there we'll show how to deploy using the optimized Spring Boot deployment by adding the liberty-maven-plugin and some minimal config to the pom.xml, and simple server.xml configuration using the `springBoot-3.0` feature. We will then be able to build an efficiently-layered Docker image.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
From there we'll show how to deploy using the optimized Spring Boot deployment by adding the liberty-maven-plugin and some minimal config to the pom.xml, and simple server.xml configuration using the `springBoot-3.0` feature. We will then be able to build an efficiently-layered Docker image.
We then show how to optimize the Spring Boot deployment by adding the Liberty Maven Plugin (`liberty-maven-plugin`) and some minimal config to the `pom.xml`, and add a simple `server.xml` configuration with the `springBoot-3.0` feature. We can then build an efficiently-layered Docker image.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mostly took your change ..but left the words "the optimized deployment". This deployment is a direction that drags in several ramifications. When you go this route, you have to have special pom.xml, server.xml config..
It even affects a bit of the programming model.

It's not just something you do in the final step of deployment. It's a choice you have to make.

== Prerequisites
- Java 21 (sample could be easily reworked with Java 17)

== Deploy as standard WAR
Copy link
Member

Choose a reason for hiding this comment

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

I know this is an initial draft, but just so we don't forget: expand the sentences into full sentences throughout.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


We're going to reuse the app from the previous example.

1. Add liberty-maven-plugin with Spring Boot deployment config to pom.xml:
Copy link
Member

Choose a reason for hiding this comment

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

ok, but what does this do for the app?

</plugin>
----
+
2. Create your Liberty server.xml by copying from the Spring Boot template
Copy link
Member

Choose a reason for hiding this comment

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

And what does this do for the app?

Copy link
Member Author

Choose a reason for hiding this comment

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

Did my extra sentence address your concern?

cp target/liberty/wlp/usr/servers/defaultServer/server.xml src/main/liberty/config/server.xml
----
+
3. Add application arguments to your Spring Boot application configuration in Liberty server.xml
Copy link
Member

Choose a reason for hiding this comment

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

What do these do for the app?

Copy link
Member Author

Choose a reason for hiding this comment

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

Did my extra sentence address your concern?

./mvnw package liberty:run
----
+
6. Observe the output:
Copy link
Member

Choose a reason for hiding this comment

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

What if the reader/user doesn't see that output? What's most likely gone wrong?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. I don't have an answer though. If I think of one I'll add it

Copy link
Member

@lauracowen lauracowen left a comment

Choose a reason for hiding this comment

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

I think I'd need to @yeekangc to take a look when he's back regarding the overall post and what should/shouldn't be included, I've made some comments about needing more explanation/context (mainly). I know Chuck's post is quite sparse but I think similar comments should apply there too really.

If you can run a build on the draft server (see slack or this repo's readme), we can see how it looks for length but it doesn't seem too long. My feeling is that the level of detail for the instructions is about right, there just needs to be more explanation (why) of what the user is being asked to do.

@scottkurz
Copy link
Member Author

hi @scottkurz

would you explain more what need to be updated in the existing/new guide? Or even better if you can open an issue on the guide-spring-boot or guides-common repo. Thanks

I don't feel strongly enough to push this forward for now, so I'll just stop with this previous comment. It's not that I think there's one clear next step so it would depend what we wanted to show.

@scottkurz
Copy link
Member Author

scottkurz commented Apr 15, 2024

@lauracowen, thanks for the review.

One overall comment: as far as the word choice "optimized". I'm open to other suggestions. I'm far from a Spring Boot expert. It seemed a decent mix of vague and helpful to at least use in the blog post. What I really don't know is if it's good enough to promote to the doc.

I think it's better than "..using the Spring Boot feature" which would beg the question of what the feature provides.

Opened OpenLiberty/docs#7296 for this... and had opened OpenLiberty/docs#7284 for tracking the major.minor version support. (edited)

Pushed a commit and addressed your comments 1-at-a-time.

Now that I'm done. I think if I'd addressed them holistically I'd have done better, but I'm just going to push that out there for further review

@hlhoots
Copy link
Member

hlhoots commented Apr 15, 2024

Looks good to me. Do we want a Reference in that last section to point to the Spring Boot OL guide: https://openliberty.io/guides/spring-boot.html?

Copy link
Member

@dmuelle dmuelle left a comment

Choose a reason for hiding this comment

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

ID review

posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
Copy link
Member

@dmuelle dmuelle left a comment

Choose a reason for hiding this comment

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

updated ID review

posts/2024-05-01-spring-boot-3.adoc Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com>
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
@scottkurz
Copy link
Member Author

updated ID review

@dmuelle Thanks.

To summarize my response...

  1. Here are most of your suggestions taken plus 1-2 that I did manually following your suggestion next SB3 build #3740
  2. See my comment Draft for Spring Boot 3 WAR post #3655 (comment) about how Option 2 depends on Option 1.

Copy link
Member

@dmuelle dmuelle left a comment

Choose a reason for hiding this comment

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

updated my suggestions so it doesn't read like an either-or scenario

posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
Signed-off-by: Scott Kurz <skurz@us.ibm.com>
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
posts/2024-05-01-spring-boot-3.adoc Outdated Show resolved Hide resolved
scottkurz and others added 2 commits April 30, 2024 16:29
Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com>
Co-authored-by: David Mueller <48686014+dmuelle@users.noreply.github.com>
Copy link
Member

@dmuelle dmuelle left a comment

Choose a reason for hiding this comment

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

LGTM- thanks!

@dmuelle dmuelle merged commit 5280b91 into OpenLiberty:staging Apr 30, 2024
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.

Rework "Running a Spring Boot 3.x application WAR file on Liberty" blog post
5 participants