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

PHPStorm on Windows, DDEV in Docker in WSL2, Docker-Compose path wrong #152

Open
2 tasks done
ChristianAdamski opened this issue Feb 1, 2023 · 41 comments
Open
2 tasks done
Assignees

Comments

@ChristianAdamski
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Are you sure that this bug is related to this DDEV Integration Plugin?

  • I am sure

Enter your error report ID (If available)

No response

Describe the bug

phpstorm

See above image. While the path to the yml is correct, something in the composer call is wrong. Paths set in Settings->Build -> Docker -> Tools have no effect and wouldnt work anyway, as these require Windows executables.

Steps to reproduce

No response

Additional context

No response

@ChristianAdamski ChristianAdamski added the bug Something isn't working label Feb 1, 2023
@nico-loeber nico-loeber self-assigned this Feb 1, 2023
@rfay
Copy link
Collaborator

rfay commented Feb 1, 2023

@ChristianAdamski and I spent quite a bit of time on this and I explained that this is a PhpStorm regression (Unable to configure docker-compose properly in docker settings). I guess I wasn't clear.

@ChristianAdamski please simplify the recreation of this PhpStorm problem (that you can't configure docker-compose properly) and then search issues in https://youtrack.jetbrains.com/issues/WI and then if there's nothing there, file a bug about this regression.

@ChristianAdamski
Copy link
Author

No, I'm actually sure this is an issue of this plugin. I did start from scratch and also tested PHPStorm within WSL, as well as EAP versions of PHPStorm.

I do notice, that the config path is set here:

https://github.com/php-perfect/ddev-intellij-plugin/blob/main/src/main/java/de/php_perfect/intellij/ddev/php/DdevComposeFileLoaderImpl.java

I have not yet figured out, where the docker-compose path is set.

@rfay
Copy link
Collaborator

rfay commented Feb 1, 2023

Are you able to configure the docker integration successfully if the plugin is removed?

@ChristianAdamski
Copy link
Author

No, not at all. Which brings me to the question, why PHPStorm is able to locate the file at all, if I never point to it anywhere. Hence my assumption, that the DDEV plugin is taking care of it,

@ChristianAdamski
Copy link
Author

ChristianAdamski commented Feb 1, 2023

The "DDEV" CLI interpreter is automagically configured by the DDEV plugin. As is the server settings.

@rfay
Copy link
Collaborator

rfay commented Feb 1, 2023

@ChristianAdamski you're still using docker-ce inside wsl2 right, which has never been claimed to be supported by the plugin. Have you tried with Docker Desktop?

@ChristianAdamski
Copy link
Author

Well, this is effectively a feature request. I just didn't see that as an option. I'm not saying this plugin is broken on something it advertises to do, I'm saying it might be fairly easy to fix this here. I do not know though.

@rfay
Copy link
Collaborator

rfay commented Feb 1, 2023

If I understand your goal, it's to run the php interpreter inside the DDEV web container.

The failure here has nothing to do with this plugin. Here are my results of trying to configure the PHP interpreter in the traditional way when using WSL2 as the docker provider. This is with the plugin disabled.

image

I'm pretty sure you need to file an issue with PhpStorm. (BTW, I tested on macOS with alternate docker provider colima, and it worked there.) And yes, PhpStorm is very confused about what docker-compose it can or should use.

@rfay
Copy link
Collaborator

rfay commented Feb 1, 2023

I confirm that (without plugin) Docker Desktop works fine to use the in-container php cli, as normally documented in the DDEV docs. It does not work with docker-ce. None of this has to do with this extension, although if PhpStorm work working correctly we might find out.

To proceed, it's going to be necessary to demonstrate this problem in the PhpStorm queue, it won't be solved here or in the DDEV queue.

To get them to look at it, you'll need to use a trivial docker-compose.yaml and show them the steps to get the failure.

@nico-loeber
Copy link
Contributor

Hi @ChristianAdamski,

Thank you for reporting your issue!
As @rfay already pointed out the DDEV PHP Interpreter is just an automatically configured interpeter without any special magic.

The docker compose binary that is used can be configured in File | Settings | Build, Execution, Deployment | Docker | Tools, this is not in the scope of the plugin.
Please make sure to check Use compose V2 there, as ddev is using docker compose v2 internally.

As already mentioned above, supportet system configurations are Ubuntu with docker-ce, Mac with docker or colima and Windows with Docker Desktop, both inside WSL or on the native file system.

Sadly @rfay just showed us that PHPStorm doesn't seem to support your setup (docker-ce in WSL) yet.

As soon as there is support by the IDE we can see if there is anything we can optimize in the plugin.

If there is anything I can help you with, please let me know.

Thanks @rfay for your fast reaction on this and the testing!

@nico-loeber nico-loeber removed the bug Something isn't working label Feb 1, 2023
@rfay
Copy link
Collaborator

rfay commented Feb 1, 2023

Side-note FYI @nico-loeber "compose V2" setting in Docker Desktop is misinformed/mislabeled. What they mean is "Use docker compose instead of docker-compose". And it doesn't affect what docker-compose version they use. PhpStorm just isn't paying careful attention to real things :)

@nico-loeber
Copy link
Contributor

Yes I am aware of that @rfay, but using the v2 syntax will make sure the installed docker compose is v2 ready. Depending on your OS the versions delivered by your package manager may not be v2.
Also you never know which changes might come to the next IDE release. So when using docker-compose v2 it's a good idea to tell your IDE.

@rfay
Copy link
Collaborator

rfay commented Feb 2, 2023

What I'm saying is that the checkbox here does not say anything about v2 syntax.

  • The checkbox just makes it (apparently, according to the text) use docker compose (which would not work without the compose plugin to v2).
  • However, they let you explicitly specify the docker-compose binary, which we do.
  • DDEV does not support any docker-compose v1 any more for anything.
  • DDEV does not ever use the docker-compose provided by the OS package manager any more.

@rfay
Copy link
Collaborator

rfay commented Feb 2, 2023

Actually, the more I think about it:

If you check the v2 checkbox in PhpStorm... it uses the docker client and issues docker compose which uses the compose plugin and thus does not use the configured (and tested) DDEV docker-compose version. Instead, it uses the OS-supplied (or not) compose plugin.

We should probably get them to rename that checkbox...

@nico-loeber
Copy link
Contributor

Interesting thoughts @rfay but a bit offtopic. ;)

@alexbogias
Copy link

Nothing here yet but loos like is only Jetbrains issue!

@nico-loeber
Copy link
Contributor

As @shochdoerfer mentioned, the fix of the issue #187 might have impact on this as well, since there were missing environment varialbes that could cause different "binary x not found" errors under certain circumstances.
Please let me know if you still have this issue in PHPStorm 2023.2 with version 1.1.1 of the plugin @ChristianAdamski, thanks!

@rfay
Copy link
Collaborator

rfay commented Jul 31, 2023

I need to open an issue with Jetbrains about the misunderstanding of "v2" :)

@rfay
Copy link
Collaborator

rfay commented Aug 1, 2023

Youtrack issue about misunderstanding "Compose V2": https://youtrack.jetbrains.com/issue/WI-73632/Misundertanding-Miscommunication-of-docker-compose-v2

@alexbogias
Copy link

alexbogias commented Aug 4, 2023

One year letter and after many JetBrains and WSL tickets... TADA
PhpStorm 2023.2
WSL version: 1.3.14.0
PhpStorm -> Settings -> Build -> Docker -> Tools -> docker.exe binary only from here
image

@rfay
Copy link
Collaborator

rfay commented Aug 4, 2023

Congrats to @nico-loeber !

I still don't know how docker-compose can properly be used with PhpStorm on Windows and WSL2. It always wants to use a docker-compose.exe on the WIndows side, which sometimes even works, but it's just wrong. I don't think PhpStorm knows how to use a docker-compose binary inside WSL2.

@btantlinger
Copy link

One year letter and after many JetBrains and WSL tickets... TADA PhpStorm 2023.2 WSL version: 1.3.14.0 PhpStorm -> Settings -> Build -> Docker -> Tools -> docker.exe binary only from here image

@alexbogias are you saying this is working now? Using same versions of everything but still having the issue here. Do you mean the docker.exe from the link needs to be on the system path?

@alexbogias
Copy link

@btantlinger Yeah add the path you extracted it to windows system env variables and also to Settings -> Build -> Docker -> Tools -> Docker binary

@ChristianAdamski
Copy link
Author

grafik
grafik
grafik

@ChristianAdamski
Copy link
Author

grafik

@ChristianAdamski
Copy link
Author

ddev version v1.23.4

Chocolatey / The Windows side of ddev seems to not install docker anymore?

@ChristianAdamski
Copy link
Author

Independent of DDEV, I do not understand how this is supposed to work in PHPStorm. People using WSL2 and docker within is probably the standard case by now. Where would any windows binaries come into play?

@rfay
Copy link
Collaborator

rfay commented Aug 30, 2024

@ChristianAdamski Please open a new issue, probably in the ddev/ddev repository. First, get DDEV working, then work on PhpStorm.

If you follow the instructions for installing on WSL2, you will see it try to install the Windows ddev.exe so that it can escalate managing /etc/hosts when that is needed. To understand it all, see https://ddev.com/blog/ddev-name-resolution-wildcards/

@ChristianAdamski
Copy link
Author

ChristianAdamski commented Aug 31, 2024

@rfay With all due respect to your amazing work, please don't ignore what I posted. None of this relates to hosts or routing.

The issue is in the description of the DDEV PhpStorm Setup:

In PhpStorm, navigate to Preferences → Build, Execution, Deployment → Docker → Tools, and set the docker-compose executable to the full path of your .ddev/bin/docker-compose file relative to your home directory.

If you’re using WSL2 and running PhpStorm on the Windows side, PhpStorm can’t use docker-compose from WSL2, so configure Docker Desktop in Settings → General to “Use Docker Compose V2” and use a recent version of Docker Desktop.

My problem is the second sentence.

@ChristianAdamski
Copy link
Author

I did download and install Docker Desktop on the Windows Site now:

grafik

I can confirm, that his generally works:

grafik

but in PhpStorm with ddev-plugin configured PHP Interpreter, it fails to function:

grafik

@ChristianAdamski
Copy link
Author

ddev itself within WSL2 works perfectly fine and I can reach the website on the Windows site as well

@alexbogias
Copy link

alexbogias commented Aug 31, 2024

@ChristianAdamski Try update PHPStorm to 2024.2.
Works for me
image

image

No matter the red focus ring in docker compose executable...

The only things that dont work for me is docker binaries inside WSL and node inside ddev

PS. This was broken again in PHPStorm 2024.0 and 2024.1

@ChristianAdamski
Copy link
Author

Interesting.

I am on PhpStorm 2024.2.1

Differences I note from your screenshot:

  • for me the plugin does configure the the path to the compose file as a relative path (see my screenshot)
  • chocolatey does not install docker anymore for me:

grafik

I'm currently trying out to set up Docker and Interpreter manually.

@rfay
Copy link
Collaborator

rfay commented Aug 31, 2024

It would help if you'd do a ddev debug test and provide a link to it as a gist or provide it as a file. Then we'd understand your setup. It does look like your PhpStorm is accidentally using a Windows-side configuration instead of a WSL configuration.

@ChristianAdamski
Copy link
Author

I was successful by deleting existing settings and adding things manually in PhpStorm. DDEV itself was already working fine.

1.) Installed Docker Desktop on the Windows side and set paths in PHPStorm to those Windows executable
2.) Pointed PHPStorm to Docker -> WSL
3.) Added new CLI Interpreter, which resulted in the full path to the compoose file within WSL. This is probably the important part?

The rest then just worked.

@ChristianAdamski
Copy link
Author

So, in conclusion: I do think the ddev - phpstorm plugin set things up slightly incorrectly. Also, Docker Desktop seems to be necessary until PhpStorm learns to use docker compose in WSL. There are tickets for this at intellij, but seems to be no priority for them.

So maybe close this? But add a link in the official readme as a workaround for other people running into this?

@ChristianAdamski
Copy link
Author

Either way: thanks for everybodys help & patience. This is tough to debug for me.

@alexbogias
Copy link

@ChristianAdamski I got the binary there
image
Did you tried to install Docker-CLI from choco?
image

@rfay
Copy link
Collaborator

rfay commented Sep 2, 2024

I was wondering if you had Docker Desktop installed, but were trying to use docker-ce.

@ChristianAdamski
Copy link
Author

@rfay I never used docker on Windows knowingly. I'm 99% sure, Docker Desktop was installed by ddev/chocolatey before? It wasn't now, so I installed it manually to please PhpStorm.

Docker-CE I only know from linux.

@ChristianAdamski
Copy link
Author

Just for the record: DDEV is such an amazon tool and this integration plugin as well. I know that at least half the problems are caused by PhpStorm itself.

So long story short: I appreaciate all the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants