shantanoo-desai / komponist

A Composer for your favorite IoT/ IIoT container stacks with Ansible + Jinja2 + Docker Compose v2
GNU Affero General Public License v3.0
25 stars 2 forks source link

[docker-compose] setup an environment variable for configuration directory path as opposed to relative paths #28

Open shantanoo-desai opened 1 year ago

shantanoo-desai commented 1 year ago

Description

A known caveat for using relative paths in the docker-compose.<service>.yml.j2 templates e.g. ./conf/<service>, if the host where komponist generate the dedicated files MAY have a different absolute path when resolved via docker compose config which can cause incompatibility issues when used for remote deployment strategies.

In a nutshell, the generated docker-compose.yml file will have absolute paths to configuration directories that MAY not exist on remote machines.

shantanoo-desai commented 1 year ago

For a given deploy_dir set to ./deploy, upon executing the generate_stack.yml on an inventory list of hosts the deploy directory is generated in the home directory of the remote ansible user. Assuming the default working directory is based on the ansible fact of ansible_user_dir using a . in all Docker Compose will work as the generated docker-compose.yml will resolve the path w.r.t. to the User directory