Why are plugin templates only supported in `apps` and `build`?

From the code (not mentioned in the docs):

Save plugin templates to plugins//*.
Only the “apps” and “build” subfolders are rendered.

Why is that? It’s already weird enough that plugin templates are relegated to env/plugins/, which scatters config files all over the place (discovery, xqueue, etc config files are not in env/apps, I have to collect them before deploying them) but I also have to hide non-apps files in env/apps or they don’t get rendered?

The idea is to enforce a standard, where build-time templates are rendered in build/ and runtime templates are rendered in apps/. I agree that this requirement should be mentioned in the docs though, and I understand that you might be frustrated if you wondered why your templates were not being rendered. Would you like to open a PR to fix the docs?

There are two reasons for that:

  1. Plugin templates may not override other templates from the core app or from other plugins.
  2. Plugins templates are centralised in one folder, which makes it easier to remove templates during uninstallation (source)

I am not sure what you mean by that. Do you mean that you collect them in a git repository? If yes, you should version the entire env/ folder.

Again, I am not sure what you mean by that. Could you give an example?

I could, but I don’t know if I have all the knowledge required. For example, there are also templates in hooks/, that don’t get rendered as files, but are still used. Is there anything else?

If I’m going to copy the config files to a remote machine for deployment, for example, I can’t just send env/apps and have everything. I have to consolidate env/apps and all the env/plugins/*/apps.

For example, Kubernetes files are in env/k8s, not in env/apps/k8s, because they’re not app config files. Similarly, if I needed to generate files to deploy to OpenShift or Docker Swarm, my only option is to generate them in env/plugins/myplugin/apps/openshift, and that doesn’t really fit with the rest.

No, that’s pretty much it. For reference, you should check the tutor-ecommerce plugin, which is pretty much the most complex and comprehensive plugin that we maintain.

You have to send much more than just env/apps. You need to send the full env/ folder, which contains, among other things, the docker-compose and k8s config files. Or, you can just send the config.yml file and re-render the environment on the host by running tutor config save there – of course this latter solution requires that you install tutor and its plugins on the host.

You have a point. I agree that it’s not really a consistent behaviour. But is it actually preventing you from running OpenShift or Swarm? For instance, the kustomization.yml file needs to be at the root of the tutor environment, otherwise it won’t be able to load configmap objects from files stored in env/apps.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.