我是否需要在多个YAML文件中复制`skip_files`? [英] Do I need to copy `skip_files` across multiple YAML files?

查看:170
本文介绍了我是否需要在多个YAML文件中复制`skip_files`?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然对appengine模块部署过程感到无知。我的应用程序有三个模块,我独立更新和部署。



我注意到,虽然我已声明 skip_files 我的默认模块app.yaml,我的自定义模块仍在部署一切。所以我将app.yaml的指令复制粘贴到自定义的YAML文件中。虽然我不认为需要经常更改这些内容,但我仍然希望尽可能干。



有没有办法定义 skip_files 一次并继承或引用这些指令?

解决方案

GAE将每个模块视为独立的独立应用程序,每个应用程序都在自己的实例中运行。模块之间的GAE Infra级别不共享应用程序可上传的工件。因此,如果理解正确,甚至可以混合使用不同语言编写的模块。



DRY 精灵应用程序的文件或目录可以在源代码级别的模块之间共享,方法是将文件/目录的单个源代码复制到所有模块中。将应用程序部署到GAE中时,部署实用程序将使用实际的符号链接目标内容替换为符号链接。

然而,symlinking方法不适用于低于文件级别的共享,就像文件中的部分一样。 DRY仍可以应用于GAE以下支持的明确配置文件的选择部分。



根据 skip_files 部分恰好是此类支持部分之一Python_app_yaml_Includesrel =nofollow>文档
$ b


include指令允许您包含配置文件
适用于整个应用程序中的任何库或模块。例如,
可能包含一个用户管理库,如下所示:

 包括:
- lib / user_admin.yaml


...和...


使用includes仅从
中检索以下类型的指令:目标文件(如果存在):


  • 内置

  • 包括
  • 处理程序
  • strong> skip_files

基于此我认为您可以在应用的顶级目录中包含 app_shared.yaml 文件,其中包含您的 skip_files 模式(小心重写默认值,BTW),然后你可以将它们包含在你的模块的 .yaml 文件中:

 包括:
- app_shared.yaml

您可能需要符号链接 app_shared.yaml 放入每个模块中如果这是模块的 .yaml 文件存在的地方,请参阅 Modules Doc



注意:我实际上并没有使用包含方法本身,答案完全基于文档。


I'm still rather ignorant of the appengine module deployment process. My app has three modules that I update and deploy independently.

I just noticed that while I had skip_files declared in app.yaml for my default module, that my custom modules were still deploying everything. So I copied-pasted the directives from app.yaml to the custom YAML files. While I don't see the need to change these often, I'd still like to DRY as much as I can.

Is there a way to define skip_files once and inherit or reference those directives?

解决方案

GAE treats each module as a separate, standalone app, each running in its own instance. No app uploadable artifacts are shared at the GAE infra level between the modules. For that reasons it's even possible to mix modules written in different languages, if I understand correctly.

In the DRY spirit app's files or directories can be "shared" between modules at the source code level by symlinking a single source copy of the file/dir into all the modules. When the app is deployed into GAE the deployment utility replaces to the symlinks with the actual symlink target content.

The symlinking method however is not applicable to sharing below the file level, like just sections in a file. DRY can still be applied to some select sections of config files explicitly supported by the GAE infra.

The skip_files section happens to be one of such supported sections, according to the documentation:

The includes directive allows you to include the configuration file for any library or module throughout your application. For example, you might include a user administration library as follows:

includes:
- lib/user_admin.yaml

...and...

Using includes retrieves only the following types of directives from the destination file (if present):

  • builtins
  • includes
  • handlers
  • skip_files

Based on this I think you could have an app_shared.yaml file in your app's top level dir, containing your skip_files patterns (careful with overriding the defaults, BTW) which you could then be included in your modules' .yaml files:

includes:
- app_shared.yaml

You may need to symlink app_shared.yaml into each of the module's dir (the above DRY method) if that's where the modules' .yaml files exist as suggested in the Modules Doc.

Note: I didn't actually use the inclusion method myself, the answer is based purely on the documentation.

这篇关于我是否需要在多个YAML文件中复制`skip_files`?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆