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

docker-compose not working when starting Lando below project root #1007

Closed
cboyden opened this Issue Jun 1, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@cboyden
Copy link

cboyden commented Jun 1, 2018

When I run lando start from a level below the project root, the container I've configured in my docker-compose.yml either doesn't start or isn't accessible to Lando.

Tell us about your setup

v3.0.0-beta.46 on Mac OSX 10.13.4

Tell us about your .lando.yml

name: obdrops
recipe: drupal7

compose:
  - docker-compose.yml

config:
  webroot: .
  php: '7.1'
  via: nginx

services: 
  database:
    type: mysql:5.7
  appserver:
    overrides:
      services:
        environment:
          PANOPOLY_BEHAT_SCREENSHOT_PATH: '/app/sites/default/files/screenshots'
    run:
      - "mkdir -p ~/.drush/site-aliases"
      - "ln -sf /drush/openberkeley.aliases.drushrc.php ~/.drush/site-aliases/openberkeley.drushrc.php"
  pma:
    type: phpmyadmin:4.6
    hosts:
      - database

tooling:
  behat:
    service: appserver
    description: Run behat tests locally.
    cmd: /app/profiles/openberkeley/openberkeley_tests/behat/bin/behat --config /app/profiles/openberkeley/openberkeley_tests/behat/behat.lando.yml

docker-compose.yml (stored in project root, same level as .lando.yml)

version: '3'

services:
  chromedriver:
    image: robcherry/docker-chromedriver:latest
    volumes:
      - ${LANDO_APP_ROOT}/:/app/
    expose:
      - "4444"
    environment:
      CHROMEDRIVER_WHITELISTED_IPS: ""
      CHROMEDRIVER_URL_BASE: "/wd/hub"
    security_opt:
      - seccomp:unconfined

Tell us about the command you were running

$ pwd
/Users/carolineboyden/Sites/test/obdrops/sites/default
$ lando start
Starting landoproxyhyperion5000gandalfedition_proxy_1 ... done
Starting obdrops_database_1  ... done
Starting obdrops_pma_1       ... done
Starting obdrops_appserver_1 ... done
Starting obdrops_nginx_1     ... done
Waiting until nginx service is ready...
Waiting until database service is ready...
Waiting until appserver service is ready...
Waiting until pma service is ready...
Waiting until chromedriver service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...

BOOMSHAKALAKA!!!

Your app has started up correctly.
Here are some vitals:

 NAME        obdrops
 LOCATION    /Users/carolineboyden/Sites/test/obdrops
 SERVICES    appserver, nginx, database, pma
 NGINX URLS  https://localhost:32775
             http://localhost:32776
             http://obdrops.localhost
             https://obdrops.localhost
 PMA URLS    http://localhost:32779

# Note the chromedriver service isn't listed.

$ lando stop
Killing obdrops_nginx_1     ... done
Killing obdrops_database_1  ... done
Killing obdrops_appserver_1 ... done
Killing obdrops_pma_1       ... done
App stopped!

$ cd ../../
$ pwd
/Users/carolineboyden/Sites/test/obdrops
$ lando rebuild
? Are you sure you want to rebuild? Yes
Removing obdrops_nginx_1        ... done
Removing obdrops_database_1     ... done
Removing obdrops_appserver_1    ... done
Removing obdrops_pma_1          ... done
Removing obdrops_chromedriver_1 ... done
Pulling chromedriver ... done
Pulling appserver    ... done
Pulling nginx        ... done
Pulling database     ... done
Pulling pma          ... done
chromedriver uses an image, skipping
appserver uses an image, skipping
nginx uses an image, skipping
database uses an image, skipping
pma uses an image, skipping
landoproxyhyperion5000gandalfedition_proxy_1 is up-to-date
Creating obdrops_pma_1          ... done
Creating obdrops_appserver_1    ... done
Creating obdrops_database_1     ... done
Creating obdrops_chromedriver_1 ... done
Creating obdrops_nginx_1        ... done
Waiting until nginx service is ready...
Waiting until appserver service is ready...
Waiting until pma service is ready...
Waiting until database service is ready...
Waiting until chromedriver service is ready...
Waiting until nginx service is ready...
Waiting until database service is ready...
Waiting until nginx service is ready...
Waiting until database service is ready...
Waiting until nginx service is ready...
Waiting until database service is ready...
Waiting until nginx service is ready...
Waiting until nginx service is ready...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   599    0   599    0     0   2076      0 --:--:-- --:--:-- --:--:--  2079
100 4482k  100 4482k    0     0  2637k      0  0:00:01  0:00:01 --:--:-- 5121k
 PHP configuration      :
 PHP OS                 :  Linux
 Drush script           :  /tmp/drush.phar
 Drush version          :  8.1.16
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :


BOOMSHAKALAKA!!!

Your app has started up correctly.
Here are some vitals:

 NAME        obdrops
 LOCATION    /Users/carolineboyden/Sites/test/obdrops
 SERVICES    chromedriver, appserver, nginx, database, pma
 NGINX URLS  https://localhost:32790
             http://localhost:32791
             http://obdrops.localhost
             https://obdrops.localhost
 PMA URLS    http://localhost:32792

# Chromedriver service is now listed

Tell us generally about your bug

Should Lando be able to find the docker-compose.yml file relative to the .lando.yml file, rather than relative to where you run the start command? It's defined in the .lando.yml file. Or is there a way to write the .lando.yml file to force looking for docker-compose.yml relative to the project root?

@jbertoen

This comment has been minimized.

Copy link
Contributor

jbertoen commented Jun 11, 2018

try ./docker-compose.yml

@cboyden

This comment has been minimized.

Copy link
Author

cboyden commented Jun 13, 2018

@jbertoen I get the same results when referencing ./docker-compose.yml instead of docker-compose.yml. If I run lando start from below the root directory, the chromedriver service on the container is either not started or not accessible.

@jbertoen

This comment has been minimized.

Copy link
Contributor

jbertoen commented Jun 13, 2018

Yeah that does seem like a bug, think I found it as well:
plugins/lando-app/index.js, line 129:

      // Validate files
      var files = utils.validateFiles(_.get(app, 'config.compose', [], root));

If you dissect this
utils.validateFiles(); would be called with only one parameter. Which would be the result of _.get(app, 'config.compose', [], root);
The bug here is that _get() only has 3 parameters, and it is called with 4. And validateFiles() should be called with 2 parameters, and is called with 1. The second parameter of validateFiles() would be root. So it appears that there is a small typo here.

This might be the fix. Maybe @pirog or @dustinleblanc have an opinion about this?

      // Validate files
      var files = utils.validateFiles(_.get(app, 'config.compose', []), root);

@jbertoen jbertoen referenced this issue Jun 13, 2018

Closed

#1007 docker compose merge #1040

0 of 5 tasks complete
@jbertoen

This comment has been minimized.

Copy link
Contributor

jbertoen commented Jun 13, 2018

Got a PR waiting for test results. Hopefully this would fix the issue.
@cboyden could you try to use this branch of mine as a source for you lando setup and try if it works?
To do that read this:
https://docs.devwithlando.io/installation/installing.html#from-source
Instead of using the lando/lando repo, use mine from the PR 😄

@aleksijohansson

This comment has been minimized.

Copy link

aleksijohansson commented Sep 13, 2018

Any updates on this? Just ran into this issue today myself and it would be good to fix since with the drupal7 recipe one must be in the webroot (below the app root where .lando.yml is) to run drush commands.

@pirog pirog added this to the RC1 milestone Nov 28, 2018

@pirog pirog self-assigned this Nov 28, 2018

@pirog

This comment has been minimized.

Copy link
Member

pirog commented Jan 12, 2019

This should be fixed in the forthcoming RC2

@pirog pirog closed this Jan 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment