部署SpringBoot /角4在谷歌App Engine的使用Maven(Deploy a Spr

2019-10-28 12:52发布

我尝试部署(目前免费帐号)上GoogleCloud的应用程序。 前端(角)和后端(Java / JPA / SpringBoot)是建立在单一的.jar行家。

在当地,我与詹金斯和与谷歌Shell服务器上:

MVN弹簧启动:运行=> 工作正常

但是,当我尝试部署

MVN应用服务引擎:部署=> 502错误

部署为标志的成功。 但是,当我检查日志(gcloud应用程序日志尾-s默认)SpringBoot部署似乎冻结,重新启动,再冷冻,...,什么是让我疯了...有时它的工作... SpringBoot之前仅几分钟再重新启动。

所以,我需要一些建议,以找到什么是错的。

这里是我的pom.xml

https://maven.apache.org/xsd/maven-4.0.0.xsd “的xmlns:的xsi = ”http://www.w3.org/2001/XMLSchema-instance“ 的xmlns =” HTTP://行家。 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>

这里是我的app.yaml配置(在SRC /主/ 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]

Answer 1:

根据你所描述的症状,我怀疑你的应用程序容器运行内存和由OOM杀手被杀害。

默认的Flex VM只有内存和600MB只有1GB留给应用程序容器。

一个肯定的方式告诉大家,内存问题是要找到在像这样vm.syslog在谷歌Cloud纪录UI。

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

尝试通过添加以下内容到增加内存app.yaml

resources:
  memory_gb: 4


文章来源: Deploy a SpringBoot / Angular 4 on Google App Engine with maven