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

我有一个Spring Boot应用程序,我试图找出将它部署到Google新的Managed VM环境(这些是能够运行Docker容器的VM)。 我开始下定义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 

然后,我运行以下命令从我的应用程序根目录中进行testing:

 gcloud --verbosity debug preview app run . 

我一直在做一些试验和错误,现在得到以下例外:

 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作为指南,但是我开始怀疑托pipeVM环境支持app.yaml格式。

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

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

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

Google也提供了一些关于如何优化SpringApp for Google AppEngine的提示(我认为它也适用于Google Managed Vm)

您还可以检查SpringBoot部署提示( http://spring.io/blog/2014/03/07/deploying-spring-boot-applications ),特别是部署到Jetty容器中的部分(通常GAE使用的是Jetty容器afaik)

我也试图部署这样一个在ManagedVm上使用GoogleDatastore的SpringBoot应用程序,所以我很快会让你知道我的发现! 保持良好的工作!

YAML文件使用缩进来精确定义结构。 你可以尝试缩进servletinit_params的行,但是需要很多空格,直到他们排队为例子吗? 或者,这只是一个StackOverflow的情况下打破你粘贴的YAML?