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

Incorrect volume path when using nginx volume override #61

Open
ttk opened this issue Oct 1, 2024 · 2 comments
Open

Incorrect volume path when using nginx volume override #61

ttk opened this issue Oct 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ttk
Copy link

ttk commented Oct 1, 2024

When adding an extra volume to the appserver_nginx container, the source directory on the host is wrong as it seems to be using the location of the underlying docker compose file location instead of my lando app root directory for the relative path. Best demonstrated by example:

Simple lando config:

name: test
recipe: symfony
config:
  via: nginx

services:
  appserver_nginx:
    overrides:
      volumes:
        - ./vendor:/app/vendor

Expected bind mounts:
%LANDO_APP_ROOT%/vendor:/app/vendor

Actual bind mounts:
%USERPROFILE%/.lando/compose/test:/app/vendor

I tested the same scenario with the nginx lando plugin directly, and it mounted the expected directory, so I think it something to do with the way the symfony lando plugin integrates with nginx.

$ lando version
v3.21.2

$ lando version --component symfony
v1.6.1

$ lando version --component nginx
v1.2.0

$ lando version --component php
v1.3.0

OS: Windows 11 (not sure if that matters.

@ttk ttk added the bug Something isn't working label Oct 1, 2024
@reynoldsalec
Copy link
Sponsor Member

@ttk I think this works as expected; the overrides documentation notes that it follows Docker Compose v3 syntax (https://docs.lando.dev/core/v3/services/lando.html#overrides)...Docker volumes are referenced relatively from the build root AFAIK, which I believe is what you're experiencing. See https://docs.docker.com/reference/compose-file/services/#volumes for the relevant Docker Compose docs.

Essentially, once you get into overrides or making custom type: lando services, you're playing more directly with Docker Compose and Lando should respect those rules.

LMK if that makes sense or if I missed something!

@ttk
Copy link
Author

ttk commented Oct 2, 2024

@reynoldsalec What is confusing for me is why behavior is different specifically for the appserver_nginx service in this symfony recipe.

For nginx:

services:
  appserver_nginx:
    overrides:
      volumes:
        - ./vendor:/app/vendor

Gets converted to the following raw docker compose spec (note the relative path):

services:
  appserver_nginx:
    volumes:
      - './vendor:/app/vendor'

Whereas if I do the same for the appserver service in the same symfony recipe:

services:
  appserver:
    volumes:
      - './vendor:/app/vendor'

I get the follow raw docker compose spec, where the volume source path was translated to the absolute path to my lando app root.

services:
  appserver:
    volumes:
      - 'C:\tmp\landotest2\vendor:/app/vendor'

The translation of the relative paths to absolute path to my lando app root directory is what I expect for all services. I understand that using overrides is an advanced, low level feature that not a lot of people are going to use, but I figured it's worth reporting in case this is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants