使用 maven 在 Google App Engine 上部署 SpringBoot / Angular 4

2024-01-06

我尝试在 Google Cloud 上部署应用程序(目前免费帐户)。 前端 (Angular) 和后端 (Java/JPA/Spring Boot) 是使用 Maven 在单个 .jar 中构建的。

在本地,在我的服务器上使用 Jenkins 和 Google Shell :

mvn spring-boot:运行 =>工作正常

但是当我尝试部署时

mvn appengine:部署=>502错误

部署标记为成功。但是当我检查日志(gcloud应用程序日志tail -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://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>

这是我的 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]

根据您描述的症状,我怀疑您的应用程序容器内存不足并被 OOM 杀手杀死。

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

判断内存问题的一种可靠方法是在vm.syslog在 Google Cloud Logging 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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 maven 在 Google App Engine 上部署 SpringBoot / Angular 4 的相关文章

随机推荐

  • Firebase onCreate 触发器:无法获取除 UNAUTHENTICATED 之外的 authType

    使用具有以下规则的 Firebase 实时数据库 rules messages read auth null write auth null 并且 将此触发器定义为 exports localOnCreate functions datab
  • 扩展 Google 地图范围,使 div 叠加层不覆盖任何标记

    在我正在开发的 Google 地图混搭中 地图为 100 宽 高度几乎为 100 并且我有一个水平透明 div 它使用 z index 和 CSS 覆盖地图的左侧 当我动态添加标记时 我从一个空的 Bounds 对象开始 然后将其一一扩展以
  • 隐藏软键盘

    我需要能够隐藏软键盘以响应单击按钮 我看过很多关于这个主题的帖子 似乎解决方案是使用InputMethodManager 但我一直无法让它为我工作 据说以下将隐藏软键盘 InputMethodManager inputManager Inp
  • 如何设置 CSS、JS 和图像的过期时间?

    我最近使用 firebug 上的 pagespeed 插件分析了我的网站 它建议我设置 CSS JS 和图像文件的过期时间 我想知道 我该怎么做 当我运行 PageSpeed Addon 时 我用它来修复完全相同的问题
  • 使用 asyncio 实现非阻塞 I/O

    我正在尝试使用 Pygame 和 asyncio 编写一个网络游戏 但我不知道如何避免挂起读取 这是我为客户提供的代码 asyncio coroutine def handle client print Connected reader w
  • glmnet 的公式接口

    在过去的几个月里 我参与了许多项目 在这些项目中我使用了glmnet适合弹性网模型的封装 它很棒 但与大多数 R 建模函数相比 其界面相当简陋 特别是 您必须给出响应向量和预测矩阵 而不是指定公式和数据框 您还会失去常规界面提供的许多生活质
  • 快速解析非本地时区中的 Python 日期时间,并根据夏令时进行调整

    我需要快速将 ISO 8601 日期时间字符串 字符串中没有时区 但已知位于美国 太平洋时区 转换为 numpydatetime64 object 如果我的机器处于美国 太平洋时间 我可以简单地运行numpy datetime64 s 但是
  • SQL 和 MySQL 有什么区别? [关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 我是数据库新手 我想知道 两者之间有
  • 有关 Google Play 应用程序资产加密的问题

    从 v4 1 开始果冻豆 http developer android com about versions jelly bean html 谷歌为Google Play推出了新的应用程序资产加密功能 升级应用程序时似乎出现了一些问题 其中
  • Spread Operator 不适用于基于 Redux/ES6 的示例

    我正在尝试理解 Dan Abramov 发布的 Redux 在线教程 目前我正在使用以下示例 带有数组的Reducer组合 https egghead io lessons javascript redux reducer composit
  • Windows 窗体图表设置固定混合标签

    我想将标签固定在 x 或 y 轴上 因此它们始终是静态的 我还想将标签与数字和字符串混合在一起 如图所示 另外y轴从 1开始 我怎么能总是从0开始呢 Setting CustomLabels https msdn microsoft com
  • 汇编中的内存分配和寻址

    我正在尝试学习汇编 但有一些指令我不完全理解其目的 C code include
  • 如何获取 PHP 函数中的函数名称?

    是否可以 function test echo function name is test 准确的方法是使用 FUNCTION 预定义魔法常数 http www php net manual en language constants pr
  • 父级的 jQuery 父级

    我目前正在尝试查找元素的父元素的父元素 我点击了一个链接 该链接位于 td 我想得到 tr object 为什么 this parent parent 不起作用 会怎样 Thanks Brendan Edit 看来我的语法错误导致了整个事情
  • 在 Altair 折线图末尾添加标签

    所以我一直在尝试获取它 以便在每行末尾都有一个标签 给出国家 地区名称 然后我可以删除图例 尝试过玩transform filter但没有运气 我使用了这里的数据https ourworldindata org coronavirus so
  • Java 客户端中的 TLS 与 SNI

    目前正在就该问题进行讨论NHIN Direct 安全与信任工作组 http nhindirect org message list Security and Trust Workgroup 关于传统 SSL 产生的 IP 到域映射问题 ht
  • 如何在 selenium python 中的相对 css 选择器中使用父选择器

    我将尽力解释这个问题 这个问题是关于Python中的selenium 考虑这个例子 for row in driver find elements By CSS SELECTOR div style overflow hidden gt d
  • 使用 C# 的形式制作动画 Gif

    在我的项目中 每当执行一个长流程时 都会显示一个小表单和一个小动画 gif 文件 我使用 this Show 打开表单 使用 this Close 关闭表单 以下是我使用的代码 public partial class PlzWaitMes
  • 并行运行多个 JPA 事务

    我有两个 或更多 Java 线程使用 JPA 从 mysql 数据库创建 更新和删除实体 为了实现这一目标 我有一个 PersistenceLayer 类创建 EntityManager 并为我的所有实体提供保存 更新和删除方法 如下所示
  • 使用 maven 在 Google App Engine 上部署 SpringBoot / Angular 4

    我尝试在 Google Cloud 上部署应用程序 目前免费帐户 前端 Angular 和后端 Java JPA Spring Boot 是使用 Maven 在单个 jar 中构建的 在本地 在我的服务器上使用 Jenkins 和 Goog