简体   繁体   English

将 Google App Engine 应用程序部署为单个 JAR 时如何指定实例类?

[英]How to specify an instance class when deploying a Google App Engine application as a single JAR?

I have an application which I deploy as a single JAR file to the Google App Engine Standard Java 11 environment (the application is Open Source, available at https://github.com/OndrejSpanel/Mixtio ).我有一个应用程序,我将它作为单个 JAR 文件部署到 Google App Engine 标准 Java 11 环境(该应用程序是开源的,可在https://github.com/OndrejSpanel/Mixtio 获得)。 I would like the application to use instance class F2 instead of the default F1.我希望应用程序使用实例类 F2 而不是默认的 F1。 When I have tried to provide my own app.yaml by specifying at the command line, I got error "All .yaml files must have unique service ids.":当我尝试通过在命令行指定来提供我自己的 app.yaml 时,出现错误“所有 .yaml 文件必须具有唯一的服务 ID。”:

gcloud app deploy --project mixtio backend/target/scala-2.12/mixtio.jar backend/web/WEB-INF/cron.yaml backend/web/WEB-INF/app.yaml

ERROR: (gcloud.app.deploy) [D:\\Users\\xxx\\AppData\\Local\\Temp\\tmpmt01m6jp\\app.yaml] and [X:\\OpenSource\\Mixtio\\backend\\web\\WEB-INF\\app.yaml] are both defining the service id [default].错误:(gcloud.app.deploy) [D:\\Users\\xxx\\AppData\\Local\\Temp\\tmpmt01m6jp\\app.yaml] 和 [X:\\OpenSource\\Mixtio\\backend\\web\\WEB-INF\\app.yaml]都定义了服务 ID [默认]。 All .yaml files must have unique service ids.所有 .yaml 文件都必须具有唯一的服务 ID。

This is how the default configuration generated by the Google Cloud when using single jar deployment looks like, as seen in the App Engine console:这是使用单个 jar 部署时由 Google Cloud 生成的默认配置的样子,如 App Engine 控制台中所示:

runtime: java11
env: standard
instance_class: F1
handlers:
  - url: .*
    script: auto
automatic_scaling:
  min_idle_instances: automatic
  max_idle_instances: automatic
  min_pending_latency: automatic
  max_pending_latency: automatic
network: {}

How can I configure parameters like instance_class for an application deployed as a single jar?如何为部署为单个 jar 的应用程序配置诸如instance_class参数?

Try passing argument --appyaml =backend/web/WEB-INF/app.yaml , in order to be more explicit.尝试传递参数--appyaml =backend/web/WEB-INF/app.yaml ,以便更明确。 Also see: the default service .另请参阅: 默认服务 When using the predefined *.yaml file-names, one probably doesn't have to specify them, as it is already known what they are meant for.使用预定义的*.yaml文件名时,可能不必指定它们,因为已经知道它们的含义。

If you have multiple applications to deploy, just run eg.:如果您有多个应用程序要部署,只需运行例如:

gcloud app deploy service-name-app.yaml
gcloud app deploy app.standard.yaml

The instance class to deploy is being defined per app.yaml , by parameter instance_class .要部署的实例类是通过参数instance_class根据app.yaml定义的。

Defining Runtime Settings also explain it. 定义运行时设置也解释了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 java11 在 Google App Engine 上部署单个 jar 时防止构建尝试 - Prevent build attempt when deploying single jar on Google App Engine with java11 如何转换Java Web应用程序以在Google App Engine上进行部署 - how to convert java web application for deploying on Google App Engine 通过使用特定的jar来创建Java类来在Google App Engine中部署War文件 - Deploying war file in google app engine by creating a java class using the jar specific to deploy it 如何在部署应用引擎应用时设置自定义版本? - How to set a custom version when deploying an app engine application? 部署到Google App Engine时的运行时异常 - Runtime exception when deploying to Google App Engine 部署到Google App Engine - Deploying to Google App Engine 在部署GAE应用程序之前,将所有.class文件打包在一个jar中? - Packing all .class file in a single jar before deploying GAE app? 如何使用Eclipse将jar添加到Google App Engine? - How to add jar to Google App Engine with Eclipse? 在 Google App Engine 上部署 Spring Boot 应用程序时出错 - Error while deploying spring boot application on google app engine 将不同语言的服务部署到同一个应用程序[Google App Engine] - Deploying different languages services to the same Application [Google App Engine]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM