我正在研究如何使用spring云任务在我的云创建环境中执行短暂的任务。
通过查看文档和一些youtube视频,我发现我的设置应该包含3个组件(应用程序):
任务请求者:一个春启动应用程序,该应用程序在spring云流兔子/Kafka queue/topic
TaskLaunchRequest:一个带有@EnableTaskLauncher注释的春引导应用程序,它具有以下依赖关系:spring-cloud-starter-task、spring-cloud-starter-stream-rabbit、spring-cloud-deployer-cloudfoundry、spring-cloud-deployer-resource-maven
@EnableTask注释的春启动应用程序,它具有由短寿命作业
f 214/code>执行的逻辑。
对于使用此设置在CloudFoundry中部署任务所需的流程和配置,我有几个问题。
在TaskLaunchRequest (任务提交器中)配置environmentProperties、deploymentProperties和applicationName与配置CloudFoundryDeploymentProperties (在任务启动程序中)之间有什么区别?另外,应该在哪里定义SPRING_APPLICATION_JSON,它到底要做什么呢?我所看到的关于spring云任务的所有示例都使用maven://方案来指示TaskLaunchRequest#uri。为什么spring-cloud-deployer-cloudfoundry依赖不与spring-cloud-deployer-resource-maven依赖捆绑在一起?在向CloudFoundry?When i cf-push部署任务bootJar到Cloud和instances=0时,是否有不同的URI方案是首选的,当任务启动程序启动任务时,一切都正常。这种情况下唯一的问题是,即使将快照bootJar的新版本发布到远程存储库,也会使用来自cf-push的原始bootJar (即使是在设置maven.remote-repositories.my-repo.snapshot-policy.update-policy: always时)。如果Cloud应用程序已经为试图通过spring云任务动态执行的应用程序定义了,那么maven工件是否真的被考虑了呢?换句话说,maven工件的每一个新版本(快照或发行版)是否都需要一个新的Cloud application?When ?我不将任务bootJar转换为Cloud,也不预先创建任务应用程序,然后我希望任务启动程序将使用我指定的maven工件(使用spring.cloud.deployer.cloudfoundry.push-task-apps-enabled: true). When I attempt this, then I get an error in the launcher indicating应用程序)在Cloud中为我创建应用程序。在stagingand this error stems from the following:org.cloudfoundry.operations.applications.DefaultApplications.pushManifest(DefaultApplications.java:431)`.期间失败我可以看到,任务启动程序已经成功地在Cloud中创建了应用程序,但是它没有完成它的阶段。我错过了什么才能让它发挥作用?下面是来自任务应用程序的日志,这些日志未能完成阶段: 2020-09-25T14:05:43.69-0400 [API/2] OUT Uploading bits for app with guid d598b251-4827-4c55-9e56-1d0c8301b5c3
2020-09-25T14:05:59.66-0400 [API/0] OUT Updated app with guid d598b251-4827-4c55-9e56-1d0c8301b5c3 ({"state"=>"STOPPED"})
2020-09-25T14:06:00.26-0400 [API/0] OUT Creating build for app with guid d598b251-4827-4c55-9e56-1d0c8301b5c3
2020-09-25T14:06:00.61-0400 [API/0] OUT Updated app with guid d598b251-4827-4c55-9e56-1d0c8301b5c3 ({"state"=>"STARTED"})
2020-09-25T14:06:01.00-0400 [STG/0] OUT Cell 884d3852-1063-452a-8e94-c11ea9307c4a creating container for instance cc9b7101-2fc4-4c56-9f86-019736eb6b71
2020-09-25T14:06:01.79-0400 [STG/0] OUT Cell 884d3852-1063-452a-8e94-c11ea9307c4a successfully created container for instance cc9b7101-2fc4-4c56-9f86-019736eb6b71
2020-09-25T14:06:01.95-0400 [STG/0] OUT Downloading app package...
2020-09-25T14:06:02.37-0400 [STG/0] OUT Downloaded app package (12.4M)
2020-09-25T14:06:04.08-0400 [STG/0] OUT -----> Java Buildpack v4.29.1 | https://github.com/cloudfoundry/java-buildpack.git#3dbe582
2020-09-25T14:06:04.08-0400 [STG/0] ERR [Buildpack] ERROR Finalize failed with exception #<RuntimeError: No container can run this application. Please ensure that you've pushed a valid JVM artifact or artifacts using the -p command line argument or path manifest entry. Information about valid JVM artifacts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation. >
2020-09-25T14:06:04.08-0400 [STG/0] ERR No container can run this application. Please ensure that you've pushed a valid JVM artifact or artifacts using the -p command line argument or path manifest entry. Information about valid JVM artifacts can be found at https://github.com/cloudfoundry/java-buildpack#additional-documentation.
2020-09-25T14:06:04.08-0400 [STG/0] ERR Failed to compile droplet: Failed to run finalize script: exit status 1
2020-09-25T14:06:04.11-0400 [STG/0] OUT Exit status 223
2020-09-25T14:06:04.52-0400 [STG/0] OUT Cell 884d3852-1063-452a-8e94-c11ea9307c4a stopping instance cc9b7101-2fc4-4c56-9f86-019736eb6b71
2020-09-25T14:06:04.52-0400 [STG/0] OUT Cell 884d3852-1063-452a-8e94-c11ea9307c4a destroying container for instance cc9b7101-2fc4-4c56-9f86-019736eb6b71
2020-09-25T14:06:04.61-0400 [API/4] ERR Failed to stage build: staging failed
2020-09-25T14:06:05.15-0400 [STG/0] OUT Cell 884d3852-1063-452a-8e94-c11ea9307c4a successfully destroyed container for instance cc9b7101-2fc4-4c56-9f86-019736eb6b71按照日志中的说法,我检查了maven工件实际上是一个有效的bootJar ( 15.1MB ),但是日志显示我的应用程序包只有"12.4M“。buildpack版本(4.29.1)也不是我在spring.cloud.deployer.cloudfoundry.buildpacks属性中指示的版本。我认为问题可能在于没有正确设置buildpack配置,但我不确定。
注意事项:我现在不想将spring-cloud-dataflow引入到我的体系结构中。
发布于 2020-09-29 20:17:54
对于手动cf push和CF客户端应用程序部署之间的差异,我终于发现,反应性的cf客户机4.0.9.RELEASE+与Netty 4.1.51.Final有一个问题,其中Netty无法执行文件上传。我升级了我的依赖项以使用Netty 4.1.52.Final,现在客户机能够正确地部署我的应用程序。
有关这两个组件之间问题的详细信息,请参阅https://github.com/cloudfoundry/cf-java-client/releases。
https://stackoverflow.com/questions/64069822
复制相似问题