本文介绍了manifest.yml中每个空间的特定配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以为特定空间设置manifest.yml属性,例如如果我想在部署到生产空间时拥有5个服务实例,但所有其他空间都只有1个实例?

Is there a way to set a manifest.yml property for a specific space, e.g. if I want to have 5 instances of my service when deploying to the production space but having only 1 for all other spaces?

推荐答案

我想到了一些选择:


  1. 您可以覆盖 manifest.yml 带有 cf cli参数的设置。因此,您可以将实例计数1放入您的 manifest.yml 文件中(实际上,您不需要这样做,因为一个是默认值,但是您可以将任何实例文件中的值),然后当您 cf push 用您设置为的值覆盖 manifest.yml 中的值时cli参数。例如: cf push -i< override>

  1. You can override manifest.yml settings with cf cli arguments. Thus you could put an instance count of one into your manifest.yml file (actually, you don't need to do this because one is the default value but you can put any value in the file) and when you cf push that overrides the value from manifest.yml with the value you set as the cli argument. Ex: cf push -i <override>.

应用程序中没有条件逻辑manifest.yml,但是没有什么可以阻止您在清单中使用模板语言。例如,您可以通过Ruby的 erb (或任何其他模板引擎)运行模板化的 manifest.yml 一些动态调整,然后使用输出来部署您的应用。

There's no conditional logic available in an app's manifest.yml, but there's nothing stopping you from using a template language with your manifest. You could, for example, run a templated manifest.yml through Ruby's erb (or any other template engine) to make some dynamic adjustments and then use the output to deploy your app.

不要使用 manifest.yml 。相反,只需使用shell脚本和 cf cli命令和参数组成。要做很多工作,但是您获得了Shell脚本的所有动态行为。实际上,它不一定是shell脚本。您可以使用Python或Ruby,也可以在此处插入您喜欢的脚本语言。

Don't use manifest.yml at all. Instead just use a shell script and a composition of cf cli commands and arguments. It's a little more work to get going, but you get all the dynamic behavior of a shell script. Actually, it doesn't have to be a shell script. You could use Python or Ruby or insert your favorite scripting language here.

可能与您希望的答案不完全相同在这里,但希望对您有所帮助。

Probably not exactly the answer you were hoping for here, but hope that it helps.

这篇关于manifest.yml中每个空间的特定配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 20:32