应用程序是健康的,直到 application.properties 与应用程序捆绑在一起。
下一步,将属性移动到 configs repo 并使用以下语句在 Cloud Foundry 中创建配置服务。
cf create-service -c '{ "git": { "uri": "https://bitbucket.company.com/scm/abcdefg/app-configs", "label": "master", "searchPaths": "TOPFOLDER/app-folder", "username": "abcdef", "password": "123456" } }' p-config-server standard company-appname-config-server
然后将依赖项添加到我的 java 应用程序(build.gradle)中
compile("io.pivotal.spring.cloud:spring-cloud-services-starter-config-client:${pivotalSpringCloud}")
compile("org.springframework.cloud:spring-cloud-dependencies:Camden.SR4")
重新部署和应用程序运行良好,具有正确的属性。在我看到的日志中
2017-04-24T08:10:48.16-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:10:48.162 INFO 19 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: https://config-d45c8d75-67f0-4031-804a-3a23cb139b4a.company.com
应用程序在不到 20 秒内启动。这是日志(将 healthchecktimeout 从默认值增加到 180)。
2017-04-24T08:07:56.67-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:07:56.670 INFO 14 --- [ main] o.s.i.a.i.AmqpInboundChannelAdapter : started inbound
2017-04-24T08:07:56.67-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:07:56.670 INFO 14 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2017-04-24T08:07:56.74-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:07:56.742 INFO 14 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8008 (http)
2017-04-24T08:07:56.74-0500 [APP/PROC/WEB/0]OUT Running as daemon
2017-04-24T08:07:56.75-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:07:56.752 INFO 14 --- [ main] c.company.app.MainApplication : Started CoordinatorBotApplication in 16.636 seconds (JVM running for 17.211)
2017-04-24T08:08:06.91-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:08:06.915 DEBUG 14 --- [ask-scheduler-1] heduler$$EnhancerBySpringCGLIB$$cbc32e8f : []
2017-04-24T08:09:37.08-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:09:37.086 DEBUG 14 --- [ask-scheduler-1] heduler$$EnhancerBySpringCGLIB$$cbc32e8f : []
2017-04-24T08:10:40.65-0500 [CELL/0] ERR Timed out after 3m0s: health check never passed.
2017-04-24T08:10:40.65-0500 [CELL/0] OUT Exit status 0
2017-04-24T08:10:40.66-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:10:40.660 INFO 14 --- [ Thread-4] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5ae9a829: startup date [Mon Apr 24 08:07:44 CDT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@15327b79 }
关闭日志后,我看到此错误,随后再次创建容器。
2017-04-24T08:10:40.76-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:10:40.762 INFO 14 --- [ Thread-4] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-04-24T08:10:41.17-0500 [APP/PROC/WEB/0]OUT Exit status 143
2017-04-24T08:10:41.18-0500 [CELL/0] OUT Destroying container
2017-04-24T08:10:41.20-0500 [API/1] OUT Process has crashed with type: "web"
2017-04-24T08:10:41.21-0500 [API/1] OUT App instance exited with guid dc395017-3770-4617-a439-2a0fd5fb6dda payload: {"instance"=>"", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"2 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* Exited with status 4\n* 2 error(s) occurred:\n\n* cancelled\n* cancelled", "crash_count"=>1, "crash_timestamp"=>1493039441179549849, "version"=>"246e48d2-45fe-47ed-a1ee-d4b05bd6599e"}
2017-04-24T08:10:41.22-0500 [CELL/0] OUT Creating container
有什么建议么 ?做错了什么?有什么方法可以得到更多的调试细节?