[英]Deploy a SpringBoot / Angular 4 on Google App Engine with maven
I try to deploy an application on GoogleCloud (free account at the moment). 我尝试在GoogleCloud上部署应用程序(目前有免费帐户)。 FrontEnd (Angular) and BackEnd (Java/JPA/SpringBoot) are build with maven in a single .jar.
FrontEnd(Angular)和BackEnd(Java / JPA / SpringBoot)是使用maven在单个.jar中构建的。
Locally, on my server with Jenkins and with Google Shell : 在本地,在我的Jenkins和Google Shell服务器上:
mvn spring-boot:run => working fine
mvn spring-boot:运行=> 工作正常
But when i try to deploy 但是当我尝试部署
mvn appengine:deploy => 502 error
MVN AppEngine:部署=> 502错误
Deploy is mark as success. 部署被标记为成功。 But when i check logs (gcloud app logs tail -s default) SpringBoot deployment seems freezing, restarting, freezing again, ... And what's making me crazy... Sometimes it's working ... just few minutes before SpringBoot restarting again.
但是,当我检查日志(gcloud应用程序默认记录为tail -s)时,SpringBoot部署似乎冻结,重新启动,再次冻结,……这让我发疯……有时它正在起作用……在SpringBoot重新启动前几分钟。
So, i need some advices to find what's wrong. 因此,我需要一些建议以查找问题所在。
Here's my pom.xml 这是我的pom.xml
https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"> https://maven.apache.org/xsd/maven-4.0.0.xsd“ xmlns:xsi =” http://www.w3.org/2001/XMLSchema-instance“ xmlns =” http:// maven。 apache.org/POM/4.0.0" >
<modelVersion>4.0.0</modelVersion>
<artifactId>back-office</artifactId>
<name>back-office</name>
<description>Back Office</description>
<parent>
<groupId>fr.test</groupId>
<artifactId>mon-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring4</artifactId>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.1.0</version>
</dependency>
<!-- BOOT -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- PERSISTENCE -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- SECURITY -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>4.39.2</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fr.test</groupId>
<artifactId>front-office</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<repositories>
....
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.1</version>
</plugin>
</plugins>
</build>
And here's my app.yaml config (in src/main/appengine) 这是我的app.yaml配置(在src / main / appengine中)
# [START runtime]
runtime: java
env: flex
handlers:
- url: /.*
script: this field is required, but ignored
runtime_config: # Optional
jdk: openjdk8
# server: jetty9
manual_scaling:
instances: 1
# [END runtime]
Based on the symptoms you're describing, I suspect that your application container is running out of memory and being killed by the OOM killer. 根据您描述的症状,我怀疑您的应用程序容器用完了内存,并被OOM杀手杀死。
The default Flex VM only has 1GB of memory and only 600MB left to the application container. 默认的Flex VM仅具有1GB的内存,仅600MB留给应用程序容器。
One sure way to tell that memory is the issue is to find something like this in the vm.syslog
in the Google Cloud Logging UI. 解决内存问题的一种可靠方法是在Google Cloud Logging UI的
vm.syslog
中找到类似的vm.syslog
。
kernel: [ 133.706951] Out of memory: Kill process 4490 (java) score 878 or sacrifice child
kernel: [ 133.714468] Killed process 4306 (java) total-vm:5332376kB, anon-rss:2712108kB, file-rss:0k
Try increasing the memory by adding this to your app.yaml
: 尝试通过将其添加到您的
app.yaml
来增加内存:
resources:
memory_gb: 4
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.