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
Stable port number for accessing mysql and http on localhost #941
Comments
I don't know of a way to accomplish this, since the localhost port binding is managed on ephemeral ports by docker. Of course http-based services (like phpmyadmin) use ddev-router for access, so they stay in a defined http-space. |
can the port binding be generated once on ddev config and then saved in config.yaml? |
Maybe. Seems like this wouldn't work at all for teams that check in their config.yaml. Every machine would have various kinds of conflicts based on what projects they were running. |
In case of conflict I'm ok if the port is adapted. |
FWIW, there was a related request by @mglaman but solving this in a different way. See #691. Basically, rather than pinning the port numbers (and this will become problematic if users are working across multiple teams and they start to conflict), surface a way to expose the port number by exporting a file OR exposing it via |
in #691 I asked if this current output (published_port) from
|
an alternative solution which would work for mysql workbench, would be to allow ddev to expose ssh serwer, then mysql workbench could connect through ssh tunnel. Or maybe we could have a similar proxy/router we have for http traffic, so stuff like: |
Yeah, there's no ssh tunneling with There's no way to redirect mysql traffic like we do with ddev-router, because there's no Host header or equivalent. That doesn't mean we can't find some way that this will work out for you! |
FWIW, lando allows this sort of configuration in the
|
So allowing the ability to specify the port in a yaml file is certainly a consideration... but in thinking through the use case of many projects shared over many people, it could become more management to lock in all the ports. |
Maybe you can add a syntax element to keep it dynamic, e. g. |
Not sure I have any more answers but am seconding the desire to be able to set up a mysql workbench connection and not have to keep revisiting it with new port numbers. |
Just an FYI that for macOS users |
I guess it would be super easy to add support for other database browsers in the exact same way as ddev sequelpro. That's a different way forward on this. |
Just a note that |
This could be a part of a solution to generic access to multiple SQL guis; datagrip was suggested in #1397. There may be other ways to do it than using a stable port number, but it would be great however. |
Added a note that we should do http when we do this, so the localhost URL is static. |
@rfay that's my use case, I'm using datagrip and keep having to change the port in the config. |
the biggest problem is, that most tools have their own import / export format for that data ... |
As a workaround you can write a bash script which executes the command Also per But in the future it would be great to manually configure it |
What about approach like:
|
Recently a co-worker mentioned that you actually CAN set a stable port number:
In this example Please correct me if im wrong! So this issue can be closed |
Thanks for the workaround @unherz ! So amazing what can be done with a little docker-compose magic. I'd like to keep this open because for both localhost webserver binding and db binding it would be so useful for it to be static. |
There's a PR with artifacts to test on #1502 (comment) and I'd love to have some feedback on it. |
…only to localhost, fixes #1491, fixes #941, #642 too (#1502) * Add configuration to expliictly bind to a static host db port, fixes #1491, fixes #941 * Add static binding to webserver localhost port * Add TestPortSpecifications to validate port collision behavior * Switch to a project list strategy, much more expandable * Do quick and dirty test of mysql connectivity on localhost port * Don't always reserve ports, only reserve if in config.yaml * Make TestCmdGlobalConfig less fragile * Add --host-db-port and --host-webserver-port
Is your feature request related to a problem? Please describe.
I'm using mysqlworkbench to connect to ddev database using external port (found using ddev describe). The problem is that every time ddev is restarted the port changes, which means I need to reconfigure mysqlworkbench. This is very annoying.
Describe the solution you'd like
The mysql port should not change after restarting ddev.
The text was updated successfully, but these errors were encountered: