Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compose "files" yml value is ignored in dip.override.yml files #126

Closed
stoutput opened this issue Apr 21, 2021 · 5 comments
Closed

Compose "files" yml value is ignored in dip.override.yml files #126

stoutput opened this issue Apr 21, 2021 · 5 comments
Labels

Comments

@stoutput
Copy link

Describe the bug

compose:
  files:

Is ignored in dip.override.yml files

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a dip.yml in a parent folder
  2. In a subfolder, create a functional docker-compose.yml, docker-compose-dev.yml, and a dip.override.yml with these contents:
# Required minimum dip version
version: '7.0'

environment:
  COMPOSE_EXT: dev

compose:
  files:
    - docker-compose.yml
    - docker-compose.$COMPOSE_EXT.yml
  1. Run dip compose up from the subfolder
  2. Only the docker-compose.yml file is used in the docker-compose call

Expected behavior
All files listed under the compose files yml key are used in the docker-compose call

Context (please complete the following information):

  • OS: Mac OS 11.2
  • Version 7.1
@bibendi
Copy link
Owner

bibendi commented Apr 22, 2021

Hi
Thank you for the reporting!
I'll see this next week.

@bibendi bibendi added the bug label Apr 22, 2021
@bibendi
Copy link
Owner

bibendi commented May 24, 2021

@stoutput could you provide your main dip.yml? Do you have compose section in it?
Also, please run any dip command with the DIP_ENV-debug environment variable, and provide the output.

The problem is when the path to a compose config is relative then it is expanded to "main dip.yml dir" + relative path.
The quick workaround is to use absolute paths to compose configs, or you can try the special environment variable ${DIP_WORK_DIR_REL_PATH}

compose:
  files:
    - ${DIP_WORK_DIR_REL_PATH}/docker-compose.yml
    - ${DIP_WORK_DIR_REL_PATH}/docker-compose.$COMPOSE_EXT.yml

@stoutput
Copy link
Author

The main dip.yml does not have a compose section in it. It looks something like:

version: '7.0'

environment:
  CYAN: '\033[1;96m'
  RED: '\033[0;31m'
  YELLOW: '\033[0;93m'
  GREEN: '\e[0;32m'
  NC: '\033[0m'
  CERTS_PATH: $PWD/certs
  DOCKER_CPUS: 6
  DOCKER_RAM: 1536
  DOCKER_SWAP: 6144
  DOCKER_SETTINGS_PATH: "$HOME/Library/Group Containers/group.com.docker/settings.json"
  NET_NAME: nginx-proxy
  REPOS: 
    - git@github.com:org/repo.git
    - git@github.com:org/repo-two.git

interaction:
  ...
provision:
  ...

Running DIP_ENV=debug dip up -d in the subfolder with the dip.override.yml, I get docker-compose --project-name Project up -d as the final command. The project name is correct and derives from the dip.override.yml, but the files key doesn't work as you expected, since their paths are relative to the current folder.

Adding the ${DIP_WORK_DIR_REL_PATH} as you suggested and re-running, the final command is now correctly built as docker-compose --file /Users/me/root-project/project/docker-compose.yml --file /Users/me/root-project/project/docker-compose.proxy.yml --project-name Project up -d

@stoutput
Copy link
Author

stoutput commented May 27, 2021

I'm fine with whatever structure you think is best here, whether to keep paths relative to the main dip.yml or not. I can keep the ${DIP_WORK_DIR_REL_PATH} workaround in the override file and that should be just fine going forward. Thanks!

@bibendi
Copy link
Owner

bibendi commented May 28, 2021

Ok. I think I can close the issue.

@bibendi bibendi closed this as completed May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants