如何将Spring Boot应用程序部署到Google Managed VM

问题描述:

我有一个Spring Boot应用程序,我试图找出将它部署到Google新托管VM环境(这些是能够运行Docker容器的VM)的位。如何将Spring Boot应用程序部署到Google Managed VM

gcloud --verbosity debug preview app run . 

我一直在做:我已经开始下降有以下定义的app.yaml的道路:

application: myapp-1 
version: 1 
runtime: java 
api_version: 1 
vm: true 
handlers: 
    - url: /* 
    servlet: org.springframework.web.servlet.DispatcherServlet 
    init_params: 
    contextAttribute: org.springframework.web.context.WebApplicationContext.ROOT 

我然后运行以下从我的应用程序根测试的东西出来一些试验和错误,现在收到以下异常:

Unknown url handler type. 
<URLMap 
    secure=default 
    static_files=None 
    application_readable=None 
    auth_fail_action=redirect 
    require_matching_file=None 
    static_dir=None 
    redirect_http_response_code=None 
    http_headers=None 
    url=/* 
    script=None 
    upload=None 
    api_endpoint=None 
    expiration=None 
    position=None 
    login=optional 
    mime_type=None 
    > 

我使用https://cloud.google.com/appengine/docs/java/configyaml/appconfig_yaml为指导,但我开始怀疑托管VM环境支持的app.yaml格式。

这里有一个类似的例子https://github.com/GoogleCloudPlatform/appengine-java-vm-guestbook-extras但它不使用app.yaml格式。

是否有任何最近的例子让Spring Boot应用程序在Google Managed VM中运行?

YAML文件使用缩进来精确定义结构。您是否可以尝试缩进servletinit_params的行,但是需要很多空间,直到它们排列为例here?或者,这只是*打破YAML粘贴的情况?

我只看到运行在谷歌AppEngine上一个SprinBoot应用的一个例子https://github.com/scratches/spring-boot-sample-gae

谷歌还增加了关于如何优化谷歌的AppEngine一个SpringApp(我认为它适用于谷歌对管理的VM以及)few hints

您还可以检查SpringBoot部署提示(http://spring.io/blog/2014/03/07/deploying-spring-boot-applications),尤其是部署到码头集装箱(GAE通常使用AFAIK码头集装箱)

我也想部署这样一个使用谷歌一个SpringBoot应用程序的一部分ManagedVm上的数据存储,所以我很快会让你知道我的发现!保持良好的工作!