appengine-plugins icon indicating copy to clipboard operation
appengine-plugins copied to clipboard

Support deploying exploded WAR/JAR for Java11

Open yuri-sergiichuk opened this issue 5 years ago • 10 comments

Currently, the artifact config is waiting for a single JAR/WAR/Binary file to be uploaded, but this constraint has nothing to do with the gcloud app deploy command.

The use case: explode WAR file in order to configure static resources with Java11 application.

I'm referring to the approach described in the docs that allows deploying static files for Spring Boot uber-jar app: https://cloud.google.com/appengine/docs/standard/java11/serving-static-files#configuring_your_static_file_handlers

yuri-sergiichuk avatar Sep 06 '20 22:09 yuri-sergiichuk

@ludoch is this a supported runtime on appengine right now?

loosebazooka avatar Sep 06 '20 23:09 loosebazooka

@loosebazooka AppEngine 11 is GA since October 2019. We're actively using the Gradle plugin for a couple of years already and it was a bit disappointing that the YAML part is much less powerful. Jetty-related staging configs really made a difference and now I'm struggling to find a somewhat usable Gradle plugin to create the effective web.xml for Jetty and to explode the WAR to prepare the static resources.

yuri-sergiichuk avatar Sep 07 '20 17:09 yuri-sergiichuk

Appegine 11 doesn't support war deployments as far as I can recall. Exploded war deployments are a Java 8 only feature.

loosebazooka avatar Sep 07 '20 18:09 loosebazooka

AppEngine 11 supports custom entry points. And as far as I understood, if one wants to use the static_files, these static files should be available in the staged folder, so the custom entry point is the only solution.

So, if you have either a fat Jar or a .jar runner with a .war archive nearby, you'll not be able to use static_files.

In our case, we have a jetty-runner .jar with our .war application. So, what I'm willing to achieve is to explode the .war file into the staging folder and configure static_files with part of the .war file.

yuri-sergiichuk avatar Sep 07 '20 19:09 yuri-sergiichuk

Right, at that point you're running an arbitrary container on appengine. Which is fine, but it's not a standard workflow for this plugin. But you are right, there is space for better static file support.

loosebazooka avatar Sep 07 '20 20:09 loosebazooka

Yep. But it looks like with the currently supported workflow the static files are not supported at all for yaml-based deployments?

Could you please suggest some workaround?

yuri-sergiichuk avatar Sep 08 '20 06:09 yuri-sergiichuk

Hrmm.. @saturnism I know we can probably do some work here? Any suggestions in the meantime?

loosebazooka avatar Sep 18 '20 13:09 loosebazooka

@loosebazooka @saturnism are there any updates or suggestions on how to make it easier for developers to work with the static files? I would really appreciate some while we're moving forward with our migration to App Engine 11.

yuri-sergiichuk avatar Oct 13 '20 12:10 yuri-sergiichuk

Well I think the static files can be supported, just not automatically as they were in java8 (since that was a well defined workflow). I think it might be require more than a trivial amount of work. You would have to do it in your app.yaml directly using the handlers sub section. You can take a look at what the java8 staging does to fill this out.

Let me try to find some other people that can help document this. @ludoch @eamonnmcmanus ?

loosebazooka avatar Oct 13 '20 16:10 loosebazooka

eak! thnx for the ping. i totally missed this.

There are several ways to do this, but at the end of the day, the static files needs to be exploded within the app engine deployment directory, and then in app.yaml file, specify the static_files section.

Here is @ludoch's example handlers section for JHipster uberjar deployment: https://github.com/jhipster/generator-jhipster/issues/10331#issuecomment-528563349

saturnism avatar Oct 13 '20 16:10 saturnism