简体   繁体   English

如何使用java_buildpack向Cloud Foundry实例添加其他资源?

[英]How to add additional resources to cloud foundry instance with java_buildpack?

I'm deploying a java application with this manifest.yml: 我正在使用这个manifest.yml部署Java应用程序:

applications:
 - name: myapp
   instances: 1
   path: target/myapp-with-dependencies.jar
   ...

I would like to add some additional resources to the cloud foundry instance, but I don't want to bundle those resources in the jar file. 我想向Cloud Foundry实例添加一些其他资源,但是我不想将这些资源捆绑在jar文件中。

I haven't found any documentation to suggest that this is possible. 我还没有找到任何文件表明这是可能的。 Is there a way to do this? 有没有办法做到这一点?

There is no way to add additional artifacts without including them in the application artifact itself. 如果不将其他工件包含在应用程序工件本身中,则无法添加它们。 Cloud Foundry expects "applications" to be pushed. Cloud Foundry希望“应用程序”得到推送。 For Java, this means a JAR, WAR, a directory of Groovy files, etc. For other languages, it might be a directory full of source files. 对于Java,这意味着JAR,WAR,Groovy文件的目录等。对于其他语言,它可能是充满源文件的目录。 In either case, what is pushed is an application and any additional files beyond executable code are part of that application (eg a KeyStore in META-INF/ , config file in directory). 无论哪种情况,推送的都是应用程序,而可执行代码之外的任何其他文件都是该应用程序的一部分(例如, META-INF/KeyStore ,目录中的配置文件)。

In general, Cloud Foundry optimizes for 12 Factor applications which encourage the use of environment variables for configuration . 通常,Cloud Foundry针对12因子应用程序进行了优化,这些应用程序鼓励使用环境变量进行配置 Where possible, this is the best way to configure your application. 在可能的情况下,这是配置应用程序的最佳方法。 In the case where you need an artifact that cannot be represented as an environment variable (eg an SSL cert) you should include that as part of the application artifact you push. 如果您需要一个不能表示为环境变量的工件(例如SSL证书),则应将其包含在您推送的应用程序工件中。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM