2

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?

Zach Young
  • 10,137
  • 4
  • 32
  • 53

1 Answers1

3

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.

Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
  • 1
    Fantastic interpretation of the documentation! Now that I'm looking at it, it's obvious :) Thank you very much. – Zach Young Oct 23 '15 at 19:43
  • Actually, now that I'm looking at the Module documentation, I'm thinking a re-org of my modules would totally obviate the need for sharing `skip_files`: all my module source files are intermixed in various directories with all YAML files sitting in the top-level directory. It's this way 'cause I did a quick-and-easy modularization late one night and haven't thought about again, till now. – Zach Young Oct 23 '15 at 19:45