php-perfect / ddev-intellij-plugin

DDEV Tool Integration for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/18813-ddev-integration
BSD 3-Clause "New" or "Revised" License
109 stars 15 forks source link

Port and path mappings in PhpStorm 'server' are overridden by the plugin" #220

Closed hmouhtar closed 1 month ago

hmouhtar commented 1 year ago

Is there an existing issue for this?

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

Enter your error report ID (If available)

No response

Describe the bug

I have the router_http_port option set to 8080, however, upon restart, DDEV changes the server port to 80.

https://github.com/php-perfect/ddev-intellij-plugin/assets/15305350/9e366b65-b68d-4726-9b8f-e0562ad6420a

Steps to reproduce

  1. Set router_http_port to anything other than 80
  2. Update settings on DDEV server inside PHPStorm to use the port selected for router_http_port, and add some custom path mappings for that server.
  3. Restart DDEV
  4. See that server port switched back to 80 in PHPStorm, and path mappings custom config has been removed.

Additional context

No response

rfay commented 1 year ago

I think you might have upgraded to DDEV v1.22+, where router_http_port can be configured either globally or in the project. The project overrides global configuration, and if you have a project that was configured before v1.22, it will have router_http_port already in it, which will override.

AFAIK the plugin doesn't make any changes of any kind to your configuration, so I assume this issue was intended for https://github.com/ddev/ddev/issues

Anyway, I recommend looking at both your project config and your global config and doing what makes sense for you.

I'm surprised that you say:

Update settings on DDEV server inside PHPStorm to use the port selected for router_http_port, and add some custom path mappings for that server.

I remain completely unaware how you can do DDEV configuration inside PhpStorm.

hmouhtar commented 1 year ago

@rfay Hello, the DDEV integration plugin automatically sets up a "DDEV" server on PHPStorm (0:03 on the video), that's where the issue is located because the port is always being reset to 80 and the path mappings I add there get removed upon restarting DDEV.

rfay commented 1 year ago

The "server" is a feature of PhpStorm configuration. I recommend that you not use the "server" provided by the plugin.

I see that the "port" in the "server" is always set to 80 regardless. I don't think this makes any difference unless you use PhpStorm to launch a browser or whatever, but I agree it shouldn't be that way.

@nico-loeber I do think it would be better if it respected the port. Also I think it's probably better (for edge case reported in slack recently) for the PhpStorm "server" to be called the primary name of the project. In the case of my image below, d10.ddev.site, like it would be if the "server" were automatically created.

image

I've always hated PhpStorm's use of the name "server" for this configuration, which is actually xdebug mapping.

@hmouhtar could you please edit the title to be "Port and path mappings in PhpStorm 'server' are overridden by the plugin"?

nico-loeber commented 1 year ago

Hey @hmouhtar, @rfay,

Updating / overriding the "Server" named "DDEV" is the intended behavior of the plugin. All configurations (Interpreter, Server, Docker, DataSource, ...) named "DDEV" are automatically managed by the plugin.

@rfay is the http port part of the ddev describe output? In this case we can easily fix this. Currently the plugin assumes the port is always 80.

@hmouhtar in case your configuration does differ from the defaults, or settings it is aware of, you can always create your own "Server". Just give it any other name than "DDEV". The plugin will always create and update the configurations named "DDEV". If there is already an active configuration (Like a selected interpreter) it will keep the one you created manually. As for "Servers" there is no selection which one should be used by default, I am not sure how PHPStorm behaves if you add another one. As long as the ddev plugin is not aware of the router_http_port adding a manual "Server" mapping should be the way to go.

rfay commented 1 year ago

@nico-loeber the "port" in the server is (I think) used only for when PhpStorm launches a browser or similar actions. It could be 80, it's normally 443, but it's changed with router_http_port and router_https_port both globally and on the project.

These router-based URLs are displayed in the bottom of ddev describe,

image

and in the urls element in ddev describe -j

image
AkibaAT commented 1 month ago

At least with the current DDEV version, this issue is no longer current and applicable.

If you change router_http_port and router_https_port, you're setting the ports with which the webserver is available for external connections. The xDebug connection however needs SERVER_NAME (project domain) and SERVER_PORT (always 80).

For example: image

rfay commented 1 month ago

Let's close it and move on.