lando / acquia

The Official Acquia Lando Plugin
https://docs.lando.dev/acquia
GNU General Public License v3.0
2 stars 6 forks source link

Acquia is not working with xdebug #6

Closed dantetwc closed 2 years ago

dantetwc commented 3 years ago

Hi All and thanks for developing lando. It is a great tool for devs! I am trying to debug with xdebug with acquia recipe. According to doc here, it should support xdebug option. However, it doesnot work for me and after some digging, it seems the receipe disable xdebug no matter how code

Is there anyway to enable xdebug for acquia recipe?

Thanks again.

cdubz commented 2 years ago

I'm also unable to get this working. Here is an example attempt to set xdebug up with the acquia recipe --

~/acquia > lando init \                                                                                                                                                                                                                                              09:18:42
  --source cwd \
  --recipe acquia
? Select an Acquia Cloud Platform API token [REDACTED]
? Which site? CPM ([REDACTED])

   _  __                       _         
  / |/ /__ _    __  _    _____( )_______ 
 /    / _ \ |/|/ / | |/|/ / -_)// __/ -_)
/_/|_/\___/__,__/  |__,__/\__/ /_/  \__/ 

  _________  ____  __ _______  _______  _      ______________ __  ___________  ______
 / ___/ __ \/ __ \/ //_/  _/ |/ / ___/ | | /| / /  _/_  __/ // / / __/  _/ _ \/ __/ /
/ /__/ /_/ / /_/ / ,< _/ //    / (_ /  | |/ |/ // /  / / / _  / / _/_/ // , _/ _//_/ 
\___/\____/\____/_/|_/___/_/|_/\___/   |__/|__/___/ /_/ /_//_/ /_/ /___/_/|_/___(_)  

Your app has been initialized!

Go to the directory where your app was initialized and run lando start to get rolling.
Check the LOCATION printed below if you are unsure where to go.

Oh... and here are some vitals:

 NAME      [REDACTED]                                    
 LOCATION  /Users/[REDACTED]/acquia                       
 RECIPE    acquia                                    
 DOCS      https://docs.lando.dev/config/acquia.html 

~/acquia > vim .lando.yml
~/acquia > cat .lando.yml
name: [REDACTED]
recipe: acquia
config:
  acli_version: latest
  ah_application_uuid: [REDACTED]
  ah_site_group: [REDACTED]
  php: '7.4'
  xdebug: true
~/acquia > lando start
Let's get this party started! Starting app [REDACTED]...
landoproxyhyperion5000gandalfedition_proxy_1 is up-to-date
Creating network "[REDACTED]_default" with the default driver
Creating volume "[REDACTED]_data_appserver" with default driver
Creating volume "[REDACTED]_home_appserver" with default driver
Creating volume "[REDACTED]_data_database" with default driver
Creating volume "[REDACTED]_home_database" with default driver
Creating volume "[REDACTED]_data_cache" with default driver
Creating volume "[REDACTED]_home_cache" with default driver
Creating volume "[REDACTED]_data_inbox" with default driver
Creating volume "[REDACTED]_home_inbox" with default driver
Creating [REDACTED]_appserver_1 ... done
All settings correct for using Composer
Downloading...

Composer (version 2.1.9) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Changed current directory to /var/www/.composer
The "hirak/prestissimo" plugin was skipped because it requires a Plugin API version ("^1.0.0") that does not match your Composer installation ("2.1.0"). You may need to run composer update with the "--no-plugins" option.
./composer.json has been updated
The "hirak/prestissimo" plugin was skipped because it requires a Plugin API version ("^1.0.0") that does not match your Composer installation ("2.1.0"). You may need to run composer update with the "--no-plugins" option.
Running composer update hirak/prestissimo
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 0 updates, 1 removal
  - Removing hirak/prestissimo (0.3.10)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
  - Removing hirak/prestissimo (0.3.10)
Generating autoload files
 Drush Version   :  8.4.8 

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   130  100   130    0     0    734      0 --:--:-- --:--:-- --:--:--   734
100   617  100   617    0     0   1892      0 --:--:-- --:--:-- --:--:--  1892
100 9257k  100 9257k    0     0  7370k      0  0:00:01  0:00:01 --:--:-- 12.5M
Saved credentials to /var/www/.acquia/cloud_api.conf
Killing [REDACTED]_appserver_1 ... 
Killing [REDACTED]_appserver_1 ... done
Pulling inbox (mailhog/mailhog:v1.0.1)...
v1.0.1: Pulling from mailhog/mailhog
df20fa9351a1: Pull complete
ed8968b2872e: Pull complete
a92cc7c5fd73: Pull complete
f17c8f1adafb: Pull complete
03954754c53a: Pull complete
60493946972a: Pull complete
368ee3bc1dbb: Pull complete
Digest: sha256:8d76a3d4ffa32a3661311944007a415332c4bb855657f4f6c57996405c009bea
Status: Downloaded newer image for mailhog/mailhog:v1.0.1
Starting [REDACTED]_appserver_1 ... done
Creating [REDACTED]_database_1  ... done
Creating [REDACTED]_cache_1     ... done
Creating [REDACTED]_inbox_1     ... done
Waiting until database service is ready...
Waiting until database service is ready...
Waiting until database service is ready...
Scanning to determine which services are ready... Please standby...

   ___                      __        __        __     __        ______
  / _ )___  ___  __ _  ___ / /  ___ _/ /_____ _/ /__ _/ /_____ _/ / / /
 / _  / _ \/ _ \/  ' \(_-</ _ \/ _ `/  '_/ _ `/ / _ `/  '_/ _ `/_/_/_/ 
/____/\___/\___/_/_/_/___/_//_/\_,_/_/\_\\_,_/_/\_,_/_/\_\\_,_(_|_|_)  

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

 NAME            [REDACTED]                            
 LOCATION        /Users/[REDACTED]/acquia               
 SERVICES        appserver, database, cache, inbox 
 APPSERVER URLS  https://localhost:52454           
                 http://localhost:52455            
                 http://[REDACTED].lndo.site/          
                 https://[REDACTED].lndo.site/         
 INBOX URLS      http://localhost:52458            
                 http://inbox.[REDACTED].lndo.site/    

~/acquia > lando php --version
PHP 7.4.24 (cli) (built: Oct 12 2021 07:35:32) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.24, Copyright (c), by Zend Technologies

The output of lando php --version shows that the xdebug extension is not included even though xdebug: true is in the config section of .lando.yml.

reynoldsalec commented 2 years ago

@cdubs and @dantetwc, have you tried enabling XDEBUG in your Landofile? If you have a basic Acquia recipe, you should be able to add this below the recipe: acquia line:

config:
  xdebug: true|false

For more info on getting xdebug working with Lando, I recommend checking out these articles:

cdubz commented 2 years ago

@reynoldsalec -- yes, I have and it does not work. This is what https://github.com/lando/cli/pull/51 addresses -- I'll get that moved to https://github.com/lando/acquia.

cdubz commented 2 years ago

There was a notification of a question from someone on this ticket just before it was moved. Not sure if the author removed it or something weird happened with the timing of the issue move but the question was essentially, "is there any workaround for this bug?". Here's a small snippet of the relevant config in my .lando.yml to get xdebug working:

recipe: acquia
config:
  xdebug: true
services:
  appserver:
    build_as_root_internal:
      - docker-php-ext-enable xdebug
    overrides:
      environment:
        XDEBUG_MODE: 'debug'
[...]
mikemadison13 commented 2 years ago

FWIW I have had an immense amount of trouble getting the drupal9 recipe working with XDebug as well. I dunno if this is something more pervasive going on with other Lando containers, or not? I am currently using devwithlando/php:7.4-apache-3 as the container on my project and while XDebug appears to be running fine in the container, is is absolutely not working with PHPStorm.

cdubz commented 2 years ago

@mikemadison13 you may want to reach out on the Lando Slack for some more direct support. Before migrating to the acquia recipe I was using xdebug + drupal9 recipe + PHPStorm without any trouble. This post looks pretty close to what I had used when setting things before? https://www.dannyenglander.com/blog/drupal-9-devops-recipe-for-setting-up-xdebug-3-with-lando-and-phpstorm/

mikemadison13 commented 2 years ago

thanks I'll have a look, I had it working maybe a year ago and from what I recall, everything I did then isn't working now. it may be a totally different issue, just wanted to flag a similar problem (maybe). don't want to derail here!

reynoldsalec commented 2 years ago

Unfortunately removing xdebug: false in the builder.js won't solve any of these issues. Pretty much all the PHP recipes have that default option, so it's only related to xdebug configuration in so far as people may not have enabled xdebug in their Landofile and run lando rebuild (whatever they put in the Landofile will override the default setting).

EDIT: I think the OP is correct after reviewing the code and testing; this wouldn't relate to xdebug functioning on any other recipe though other than Acquia.

Overall xdebug is a bit finicky to setup; as posters have mentioned, you can have these same issues on any PHP recipe. I'd recommend focusing attention on improving the doc pages if you're finding more helpful resources in 3rd-party posts...I could see creating a dedicated page focused on troubleshooting xdebug settings as a guide in the "PHP" section of the guides.

reynoldsalec commented 2 years ago

Merged in the PR, this will go out in the first Lando release that starts using the lando/acquia repo for the integration (I believe that should be the next Lando release).