Open obayit opened 3 years ago
This never happened before because we didn't have a proper templating tool as we do today. It would be nice indeed.
Hi @Yajo , I started working on this, by using macros. For example, this macro is for volumes:
{%- macro common_yaml_odoo_volumes() %}
volumes:
- filestore:/var/lib/odoo:z
{%- endmacro %}
, I started working on this, by using macros. For example, this macro is for volumes:
{%- macro common_yaml_odoo_volumes() %}
volumes:
- filestore:/var/lib/odoo:z
{%- endmacro %}```
Then I use it in common.yaml
like this:
services:
odoo:
...
{{ macros.common_yaml_odoo_volumes() }}
I plan to make a macro for every key like volumes
and then use it in devel.yaml
, prod.yaml
and test.yaml
.
Am I going in the right direction?`` Then I use it in
common.yaml` like this:
services:
odoo:
...
{{ macros.common_yaml_odoo_volumes() }}
I plan to make a macro for every key like volumes
and then use it in devel.yaml
, prod.yaml
and test.yaml
.
Am I going in the right direction?
Edit: fixed code block syntax
It seems some of your macros broke your comment 😋
For what I can understand, if I were to use macros, I think common.yaml
would disappear. For the rest, I guess you're right.
I've kind of done this, although not using copier. In then end using a .env file like the old scaffolding just made more sense for the compose files.
I'd recommend having common.yaml -> docker-compose.yml, in .gitignore ignore docker-compose.override.yml and unignore docker-compose.yml, then just have 3 override files, linking for each environment. invoke develop then just links the test override file to be docker-compose.override.yml
It could be an option too. Although given Copier can generate any files and repeat any code comfortably, maybe the best would be to just generate those 3 environments completely and statically, allowing freedom for further overrides if needed.
I thing it would be nice if the copier template is compatible with docker swarm out of the box.
Currently docker swarm requires a compose file of version 3.0 or higher, and it also doesn't support the
extends
key.