简体   繁体   中英

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 ?

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?

Not really. What you're talking about is two different applications, at least by the way Cloud Foundry defines an "application". 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.

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).

The simplest way to do this would be to cf push to separate app names. 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. 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. 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.

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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