简体   繁体   English

Cloud Foundry 应用程序中的实例特定设置

[英]Instance specific settings in cloud foundry app

Is there any way I can launch eg 2 instances of the same cloud foundry app where each instance has its own instance specific settings passed down as parameters or environment variables eg instance1 subscribes to Kafka topic A and instance2 subscribes to Kafka topic B ?有什么方法可以启动例如同一个云铸造应用程序的 2 个实例,其中每个实例都有自己的实例特定设置作为参数或环境变量传递下来,例如instance1订阅Kafka 主题 Ainstance2订阅Kafka 主题 B

Is there any way I can launch eg 2 instances of the same cloud foundry app where each instance has its own instance specific settings passed down as parameters or environment variables eg instance1 subscribes to Kafka topic A and instance2 subscribes to Kafka topic B?有什么方法可以启动例如同一个云铸造应用程序的 2 个实例,其中每个实例都有自己的实例特定设置作为参数或环境变量传递,例如 instance1 订阅 Kafka 主题 A,instance2 订阅 Kafka 主题 B?

Not really.并不真地。 What you're talking about is two different applications, at least by the way Cloud Foundry defines an "application".您在谈论的是两个不同的应用程序,至少按照 Cloud Foundry 定义“应用程序”的方式。 For CF, your application will have source code, a droplet, environment variables, and everything required to run your app like services, which are the same for all instances of your application.对于 CF,您的应用程序将具有源代码、Droplet、环境变量以及运行您的应用程序所需的一切,例如服务,这些对于您的应用程序的所有实例都是相同的。

If you have the same source code that you would like to run with different configuration, services or environment variables, then you need to push that as a separate application (in Cloud Foundry's terminology).如果您希望使用不同的配置、服务或环境变量运行相同的源代码,那么您需要将其作为单独的应用程序推送(在 Cloud Foundry 的术语中)。

The simplest way to do this would be to cf push to separate app names.执行此操作的最简单方法是cf push以分隔应用程序名称。 It's a little redundant because you have to push the same code and stage it multiple times.这有点多余,因为您必须推送相同的代码并多次执行。 I would suggest you go this route if it results in you pushing a handful of time.我建议你 go 这条路线,如果它导致你推了一把时间。 Where you might look at the next option is if you have lots (tens, hundreds or more) of different application configurations based off the same source code.如果您有很多(数十、数百或更多)基于相同源代码的不同应用程序配置,您可能会考虑下一个选项。

If you have a lot of different apps, what you can do is to download the droplet from your first app and then cf push --droplet for every other app.如果你有很多不同的应用程序,你可以做的是从你的第一个应用程序下载droplet,然后为其他每个应用程序cf push --droplet This will deploy the droplet that you've downloaded from the first app and reuse it with different configurations (probably by using different manifest.yml files) for all the copies of your app.这将部署您从第一个应用程序下载的液滴,并为您的应用程序的所有副本使用不同的配置(可能通过使用不同的manifest.yml文件)重复使用它。

Hope that helps!希望有帮助!

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

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