How to run a vaadin-14 app in kubernetes?
See original GitHub issueDeploying an app using vaadin 14.0.7 to kubernetes does not work, because there is of course no ‘npm’ and ‘node’ installed. From the POD log:
2019-10-06 13:12:53.486 INFO [gateway-service,,,] 1 --- [ restartedMain] dev-updater : Running `npm install` ...
2019-10-06 13:12:53.492 ERROR [gateway-service,,,] 1 --- [ restartedMain] c.v.f.s.frontend.FrontendToolsLocator : Command '[which, npm]' failed with exit code '1'
2019-10-06 13:12:53.501 ERROR [gateway-service,,,] 1 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener]
java.lang.RuntimeException: Unable to initialize Vaadin DevModeHandler
at com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:326) ~[vaadin-spring-12.0.6.jar:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4683) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5146) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) ~[na:na]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) ~[na:na]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:932) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:459) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:105) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:86) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:416) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:180) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) ~[spring-boot-2.1.9.RELEASE.jar:2.1.9.RELEASE]
at com.example.gatewayservice.GatewayServiceApplication.main(GatewayServiceApplication.java:16) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.1.9.RELEASE.jar:2.1.9.RELEASE]
Caused by: javax.servlet.ServletException: com.vaadin.flow.server.ExecutionFailedException:
======================================================================================================
Failed to determine 'npm' tool.
Please install it either:
- by following the https://nodejs.org/en/download/ guide to install it globally
- or by running the frontend-maven-plugin goal to install it in this project:
$ mvn com.github.eirslett:frontend-maven-plugin:1.7.6:install-node-and-npm -DnodeVersion="v10.16.0"
======================================================================================================
at com.vaadin.flow.server.startup.DevModeInitializer.initDevModeHandler(DevModeInitializer.java:327) ~[flow-server-2.0.14.jar:2.0.14]
at com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:323) ~[vaadin-spring-12.0.6.jar:na]
... 43 common frames omitted
Caused by: com.vaadin.flow.server.ExecutionFailedException:
======================================================================================================
Failed to determine 'npm' tool.
Please install it either:
- by following the https://nodejs.org/en/download/ guide to install it globally
- or by running the frontend-maven-plugin goal to install it in this project:
$ mvn com.github.eirslett:frontend-maven-plugin:1.7.6:install-node-and-npm -DnodeVersion="v10.16.0"
======================================================================================================
at com.vaadin.flow.server.frontend.TaskRunNpmInstall.runNpmInstall(TaskRunNpmInstall.java:82) ~[flow-server-2.0.14.jar:2.0.14]
at com.vaadin.flow.server.frontend.TaskRunNpmInstall.execute(TaskRunNpmInstall.java:55) ~[flow-server-2.0.14.jar:2.0.14]
at com.vaadin.flow.server.frontend.NodeTasks.execute(NodeTasks.java:372) ~[flow-server-2.0.14.jar:2.0.14]
at com.vaadin.flow.server.startup.DevModeInitializer.initDevModeHandler(DevModeInitializer.java:322) ~[flow-server-2.0.14.jar:2.0.14]
... 44 common frames omitted
Caused by: java.lang.IllegalStateException:
======================================================================================================
Failed to determine 'npm' tool.
Please install it either:
- by following the https://nodejs.org/en/download/ guide to install it globally
- or by running the frontend-maven-plugin goal to install it in this project:
$ mvn com.github.eirslett:frontend-maven-plugin:1.7.6:install-node-and-npm -DnodeVersion="v10.16.0"
======================================================================================================
at com.vaadin.flow.server.frontend.FrontendUtils.getExecutable(FrontendUtils.java:292) ~[flow-server-2.0.14.jar:2.0.14]
at com.vaadin.flow.server.frontend.FrontendUtils.getNpmExecutable(FrontendUtils.java:250) ~[flow-server-2.0.14.jar:2.0.14]
at com.vaadin.flow.server.frontend.TaskRunNpmInstall.runNpmInstall(TaskRunNpmInstall.java:79) ~[flow-server-2.0.14.jar:2.0.14]
... 47 common frames omitted
2019-10-06 13:12:53.506 ERROR [gateway-service,,,] 1 --- [ restartedMain] o.apache.catalina.core.StandardContext : One or more listeners failed to start. Full details will be found in the appropriate container log file
2019-10-06 13:12:53.506 ERROR [gateway-service,,,] 1 --- [ restartedMain] o.apache.catalina.core.StandardContext : Context [] startup failed due to previous errors
2019-10-06 13:12:53.510 WARN [gateway-service,,,] 1 --- [ restartedMain] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [AsyncReporter{org.springframework.cloud.sleuth.zipkin2.sender.RestTemplateSender@20e1894a}] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@11/jdk.internal.misc.Unsafe.park(Native Method)
java.base@11/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:234)
java.base@11/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123)
app//zipkin2.reporter.ByteBoundedQueue.drainTo(ByteBoundedQueue.java:81)
app//zipkin2.reporter.AsyncReporter$BoundedAsyncReporter.flush(AsyncReporter.java:256)
app//zipkin2.reporter.AsyncReporter$Flusher.run(AsyncReporter.java:354)
java.base@11/java.lang.Thread.run(Thread.java:834)
2019-10-06 13:12:53.529 INFO [gateway-service,,,] 1 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-10-06 13:12:53.532 WARN [gateway-service,,,] 1 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
So, how to run this app in kubernetes?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Deploying a Vaadin app to Kubernetes
So, open https://start.vaadin.com/, select 'Docker configuration' in the bottom left corner and click Download App (blue button) at the top.
Read more >Building a Vaadin app for production environments - YouTube
In this video, Alejandro Duarte explains the Vaadin project structure and why, when, and how you should build and package your Vaadin ......
Read more >New Release of Vaadin Flow Makes it Easier to Deploy, Run,
TURKU, Finland, Dec. 14, 2022 (GLOBE NEWSWIRE) -- Vaadin, a provider of Java web application platforms, today announced Vaadin Flow 23.3, ...
Read more >Getting Started | Creating CRUD UI with Vaadin - Spring
Navigate to https://start.spring.io. This service pulls in all the dependencies you need for an application and does most of the setup for you....
Read more >Running Vaadin-on-Kotlin app in microk8s - Martin Vysny
Create a docker image of the vaadin-kotlin-pwa app; we'll use Jetty to run the WAR · Deploy that docker image into microk8s docker...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve solved my problem by adding -Dvaadin.productionMode to my docker ENTRYPOINT
Do you have a reason to deploy an app in dev mode ? Dev mode requires
node
andnpm
installed and this you may do normally locally. You need them (or they should be installed) to be able to use dev mode: this is a limitation.If you deploy an application to the production server then it doesn’t have to have
node
/npm
. You should use production mode. https://github.com/vaadin/flow-and-components-documentation/blob/master/documentation/production/tutorial-production-mode-basic.asciidocThat’s about the NPM mode.
It’s possible to use compatibility mode. In this case you may not use
JsModule
annotations. Do you want to use it so that it has sense to discuss it ? If you have problems with compatibility mode which you want to solve then please provide a way which you use to configure your project to use compatibility mode: apparently you have difference between project locally run and deployed. There should not be any difference. So I suppose the configuration for local execution and remote application is different.