-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
feat: improve how ddev describe
or ddev st
show exposed ports
#6699
Conversation
Download the artifacts for this pull request:
See Testing a PR. |
edited description after my latest commit |
Forgot to mention that the ports are sorted by the container ports - adding to main comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really amazing, thank you very much @hanoii !
It's much better than what we already have.
I tested it with installed ddev/ddev-phpmyadmin
add-on. And used this .ddev/docker-compose.ports.yaml
:
services:
web:
expose:
- 5492
- 12394
- 57497
ports:
- 5332:5222
- 5555:5777
- 12445
db:
expose:
- 6594
- 4352
ports:
- 12312:3999
- 54355
phpmyadmin:
expose:
- 8983
- 12345
ports:
- 5000:5000
- 5001:5605
- 1234:14556
Usual test:
before
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Project: d11 ~/code/ddev/d11 https://d11.ddev.site │
│ Docker platform: linux-docker │
│ Router: traefik │
├────────────┬──────┬─────────────────────────────────────────────────────────────┬────────────────────┤
│ SERVICE │ STAT │ URL/PORT │ INFO │
├────────────┼──────┼─────────────────────────────────────────────────────────────┼────────────────────┤
│ web │ OK │ https://d11.ddev.site │ php PHP8.3 │
│ │ │ InDocker: web:57497,5777,8025,443,12445,5222,5492,80,12394 │ nginx-fpm │
│ │ │ Host: 127.0.0.1:5332,5332,5555,5555,33043,32795,32795,33044 │ docroot:'' │
│ │ │ │ Perf mode: none │
│ │ │ │ NodeJS:20 │
├────────────┼──────┼─────────────────────────────────────────────────────────────┼────────────────────┤
│ db │ OK │ InDocker: db:3306,3999,4352,54355,6594 │ mysql:8.0 │
│ │ │ Host: 127.0.0.1:33045,12312,12312,32796,32796 │ User/Pass: 'db/db' │
│ │ │ │ or 'root/root' │
├────────────┼──────┼─────────────────────────────────────────────────────────────┼────────────────────┤
│ phpmyadmin │ OK │ https://d11.ddev.site:8037 │ │
│ │ │ InDocker: phpmyadmin:80,80,8983,12345,14556,5000,5605 │ │
│ │ │ Host: 127.0.0.1:1234,1234,5000,5000,5001,5001 │ │
├────────────┼──────┼─────────────────────────────────────────────────────────────┼────────────────────┤
│ Mailpit │ │ Mailpit: https://d11.ddev.site:8026 │ │
│ │ │ Launch: ddev mailpit │ │
├────────────┼──────┼─────────────────────────────────────────────────────────────┼────────────────────┤
│ All URLs │ │ https://d11.ddev.site, https://127.0.0.1:33044, │ │
│ │ │ http://d11.ddev.site, http://127.0.0.1:33043 │ │
└────────────┴──────┴─────────────────────────────────────────────────────────────┴────────────────────┘
after
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ Project: d11 ~/code/ddev/d11 https://d11.ddev.site │
│ Docker platform: linux-docker │
│ Router: traefik │
├────────────┬──────┬────────────────────────────────────────────────────┬────────────────────┤
│ SERVICE │ STAT │ URL/PORT │ INFO │
├────────────┼──────┼────────────────────────────────────────────────────┼────────────────────┤
│ web │ OK │ https://d11.ddev.site │ php PHP8.3 │
│ │ │ InDocker: │ nginx-fpm │
│ │ │ - web:5492 │ docroot:'' │
│ │ │ - web:8025 │ Perf mode: none │
│ │ │ - web:12394 │ NodeJS:20 │
│ │ │ - web:57497 │ │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:33043->80 │ │
│ │ │ - 127.0.0.1:33044->443 │ │
│ │ │ - 127.0.0.1:5332->5222 │ │
│ │ │ - 127.0.0.1:5555->5777 │ │
│ │ │ - 127.0.0.1:32795->12445 │ │
├────────────┼──────┼────────────────────────────────────────────────────┼────────────────────┤
│ db │ OK │ InDocker: │ mysql:8.0 │
│ │ │ - db:4352 │ User/Pass: 'db/db' │
│ │ │ - db:6594 │ or 'root/root' │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:33045->3306 │ │
│ │ │ - 127.0.0.1:12312->3999 │ │
│ │ │ - 127.0.0.1:32796->54355 │ │
├────────────┼──────┼────────────────────────────────────────────────────┼────────────────────┤
│ phpmyadmin │ OK │ https://d11.ddev.site:8037 │ │
│ │ │ InDocker: │ │
│ │ │ - phpmyadmin:80 │ │
│ │ │ - phpmyadmin:8983 │ │
│ │ │ - phpmyadmin:12345 │ │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:5000->5000 │ │
│ │ │ - 127.0.0.1:5001->5605 │ │
│ │ │ - 127.0.0.1:1234->14556 │ │
├────────────┼──────┼────────────────────────────────────────────────────┼────────────────────┤
│ Mailpit │ │ Mailpit: https://d11.ddev.site:8026 │ │
│ │ │ Launch: ddev mailpit │ │
├────────────┼──────┼────────────────────────────────────────────────────┼────────────────────┤
│ All URLs │ │ https://d11.ddev.site, https://127.0.0.1:33044, │ │
│ │ │ http://d11.ddev.site, http://127.0.0.1:33043 │ │
└────────────┴──────┴────────────────────────────────────────────────────┴────────────────────┘
Another test with ddev config global --omit-containers="ddev-router"
before
┌──────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Project: d11 ~/code/ddev/d11 http://127.0.0.1:33021 │
│ Docker platform: linux-docker │
│ Router: disabled │
├────────────┬──────┬─────────────────────────────────────────────────────────────┬────────────────────┤
│ SERVICE │ STAT │ URL/PORT │ INFO │
├────────────┼──────┼─────────────────────────────────────────────────────────────┼────────────────────┤
│ web │ OK │ http://127.0.0.1:33021 │ php PHP8.3 │
│ │ │ InDocker: web:12394,12445,443,57497,5222,5492,5777,80,8025 │ nginx-fpm │
│ │ │ Host: 127.0.0.1:33023,5332,5332,32782,32782,33021,5555,5555 │ docroot:'' │
│ │ │ │ Perf mode: none │
│ │ │ │ NodeJS:20 │
├────────────┼──────┼─────────────────────────────────────────────────────────────┼────────────────────┤
│ db │ OK │ InDocker: db:4352,54355,6594,3306,3999 │ mysql:8.0 │
│ │ │ Host: 127.0.0.1:33022,12312,12312,32780,32780 │ User/Pass: 'db/db' │
│ │ │ │ or 'root/root' │
├────────────┼──────┼─────────────────────────────────────────────────────────────┼────────────────────┤
│ phpmyadmin │ OK │ InDocker: phpmyadmin:12345,14556,5000,5605,80,80,8983 │ │
│ │ │ Host: 127.0.0.1:5000,5000,5001,5001,8036,8036,1234,1234 │ │
└────────────┴──────┴─────────────────────────────────────────────────────────────┴────────────────────┘
after
┌─────────────────────────────────────────────────────────────────────┐
│ Project: d11 ~/code/ddev/d11 http://127.0.0.1:33021 │
│ Docker platform: linux-docker │
│ Router: disabled │
├────────────┬──────┬────────────────────────────┬────────────────────┤
│ SERVICE │ STAT │ URL/PORT │ INFO │
├────────────┼──────┼────────────────────────────┼────────────────────┤
│ web │ OK │ http://127.0.0.1:33021 │ php PHP8.3 │
│ │ │ InDocker: │ nginx-fpm │
│ │ │ - web:5492 │ docroot:'' │
│ │ │ - web:8025 │ Perf mode: none │
│ │ │ - web:12394 │ NodeJS:20 │
│ │ │ - web:57497 │ │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:33021->80 │ │
│ │ │ - 127.0.0.1:33023->443 │ │
│ │ │ - 127.0.0.1:5332->5222 │ │
│ │ │ - 127.0.0.1:5555->5777 │ │
│ │ │ - 127.0.0.1:32782->12445 │ │
├────────────┼──────┼────────────────────────────┼────────────────────┤
│ db │ OK │ InDocker: │ mysql:8.0 │
│ │ │ - db:4352 │ User/Pass: 'db/db' │
│ │ │ - db:6594 │ or 'root/root' │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:33022->3306 │ │
│ │ │ - 127.0.0.1:12312->3999 │ │
│ │ │ - 127.0.0.1:32780->54355 │ │
├────────────┼──────┼────────────────────────────┼────────────────────┤
│ phpmyadmin │ OK │ InDocker: │ │
│ │ │ - phpmyadmin:8983 │ │
│ │ │ - phpmyadmin:12345 │ │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:8036->80 │ │
│ │ │ - 127.0.0.1:5000->5000 │ │
│ │ │ - 127.0.0.1:5001->5605 │ │
│ │ │ - 127.0.0.1:1234->14556 │ │
└────────────┴──────┴────────────────────────────┴────────────────────┘
Gitpod:
before
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Project: d10simple /workspace/code https://8080-ddev-ddevgitpodlaunch-9wh2a78be3v.ws-eu116.gitpod.io │
│ Docker platform: linux-docker │
│ Router: disabled │
├────────────┬──────┬───────────────────────────────────────────────────────────────────┬────────────────────┤
│ SERVICE │ STAT │ URL/PORT │ INFO │
├────────────┼──────┼───────────────────────────────────────────────────────────────────┼────────────────────┤
│ web │ OK │ https://8080-ddev-ddevgitpodlaunch-9wh2a78be3v.ws-eu116.gitpod.io │ drupal PHP8.3 │
│ │ │ InDocker: web:80,12445,443,5222,5492,12394,57497,5777,8025 │ nginx-fpm │
│ │ │ Host: 127.0.0.1:8080,8443,5332,5332,5555,5555,32770,32770,8027 │ docroot:'web' │
│ │ │ │ Perf mode: none │
│ │ │ │ NodeJS:20 │
├────────────┼──────┼───────────────────────────────────────────────────────────────────┼────────────────────┤
│ db │ OK │ InDocker: db:3306,3999,4352,54355,6594 │ mariadb:10.11 │
│ │ │ Host: 127.0.0.1:3306,12312,12312,32769,32769 │ User/Pass: 'db/db' │
│ │ │ │ or 'root/root' │
├────────────┼──────┼───────────────────────────────────────────────────────────────────┼────────────────────┤
│ phpmyadmin │ OK │ InDocker: phpmyadmin:5000,5605,80,80,8983,12345,14556 │ │
│ │ │ Host: 127.0.0.1:1234,1234,5000,5000,5001,5001,8036,8036 │ │
├────────────┼──────┼───────────────────────────────────────────────────────────────────┼────────────────────┤
│ Network │ │ bind-all-interfaces ENABLED │ │
└────────────┴──────┴───────────────────────────────────────────────────────────────────┴────────────────────┘
after
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Project: d10simple /workspace/d10simple https://8080-hanoii-ddev-s6sreye647e.ws-eu116.gitpod.io │
│ Docker platform: linux-docker │
│ Router: disabled │
├────────────┬──────┬─────────────────────────────────────────────────────────┬────────────────────┤
│ SERVICE │ STAT │ URL/PORT │ INFO │
├────────────┼──────┼─────────────────────────────────────────────────────────┼────────────────────┤
│ web │ OK │ https://8080-hanoii-ddev-s6sreye647e.ws-eu116.gitpod.io │ drupal PHP8.3 │
│ │ │ InDocker: │ nginx-fpm │
│ │ │ - web:5492 │ docroot:'web' │
│ │ │ - web:12394 │ Perf mode: none │
│ │ │ - web:57497 │ NodeJS:20 │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:8080->80 │ │
│ │ │ - 127.0.0.1:8443->443 │ │
│ │ │ - 127.0.0.1:5332->5222 │ │
│ │ │ - 127.0.0.1:5555->5777 │ │
│ │ │ - 127.0.0.1:8027->8025 │ │
│ │ │ - 127.0.0.1:32771->12445 │ │
├────────────┼──────┼─────────────────────────────────────────────────────────┼────────────────────┤
│ db │ OK │ InDocker: │ mariadb:10.11 │
│ │ │ - db:4352 │ User/Pass: 'db/db' │
│ │ │ - db:6594 │ or 'root/root' │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:3306->3306 │ │
│ │ │ - 127.0.0.1:12312->3999 │ │
│ │ │ - 127.0.0.1:32770->54355 │ │
├────────────┼──────┼─────────────────────────────────────────────────────────┼────────────────────┤
│ phpmyadmin │ OK │ InDocker: │ │
│ │ │ - phpmyadmin:8983 │ │
│ │ │ - phpmyadmin:12345 │ │
│ │ │ Host: │ │
│ │ │ - 127.0.0.1:8036->80 │ │
│ │ │ - 127.0.0.1:5000->5000 │ │
│ │ │ - 127.0.0.1:5001->5605 │ │
│ │ │ - 127.0.0.1:1234->14556 │ │
├────────────┼──────┼─────────────────────────────────────────────────────────┼────────────────────┤
│ Network │ │ bind-all-interfaces ENABLED │ │
└────────────┴──────┴─────────────────────────────────────────────────────────┴────────────────────┘
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this, it's an incredible improvement!
- Could you please check test coverage?
- Could you take a look at the "All URLs" and see if it might be possible to do something similar there? It's the exact same class of problem. Not trying to expand scope, but it does look like exactly the same problem. (The label is also ambigous, it's really just showing the primary http and https ports for the webserver.)
- Don't forget about the json version,
ddev describe -j
. This breakshost_ports
andexposed_ports
:
"web": {
"exposed_ports": " - web:5492\n - web:8025\n - web:12394\n - web:57497",
"full_name": "ddev-d11-web",
"host_http_url": "http://127.0.0.1:32872",
"host_https_url": "https://127.0.0.1:32871",
"host_ports": " - 127.0.0.1:32872->80\n - 127.0.0.1:32871->443\n - 127.0.0.1:5332->5222\n - 127.0.0.1:5555->5777\n - 127.0.0.1:32774->12445",
"http_url": "http://d11.ddev.site",
"https_url": "https://d11.ddev.site",
"image": "ddev/ddev-webserver:20241031_improve_php_image_build",
"short_name": "web",
"status": "running",
"virtual_host": "d11.ddev.site"
}
I think the previous version was more parse-able:
"web": {
"exposed_ports": "12445,57497,80,12394,443,5222,5492,5777,8025",
"full_name": "ddev-d11-web",
"host_http_url": "http://127.0.0.1:32872",
"host_https_url": "https://127.0.0.1:32871",
"host_ports": "32774,32774,5332,5332,32872,32871,5555,5555",
"http_url": "http://d11.ddev.site",
"https_url": "https://d11.ddev.site",
"image": "ddev/ddev-webserver:20241031_improve_php_image_build",
"short_name": "web",
"status": "running",
"virtual_host": "d11.ddev.site"
}
},
What do you mean, adding test? All tests passed and this is just presentation logic.
I don't mind, but what do you have in mind? It's not the same problem because as you said what it's showing is at least clear enough. If I were to suggest something it could be:
I was checking a bit at the logic and saw the alternatives to with and without router and with and without http, but I would just show either based on that same logic rather than showing all. Further more I think (haven't looked properly) that the url that is shown on the section will change depending on those factors already, so again, I wonder if All URLs is necessary. |
See if TestCmdDescribe can be slightly improved to check this usage. Or consider it. I'm not insisting. "this is just presentation logic" -- well, all of
The router logic is quite different, this info can't be removed, it is not covered in each section. The "All URLs" has both by-URL and by-IP URLs, and they're unrelated to the ones in the web section, because they show what the router is doing, and that's the normal situation. |
Fixed the json-output bit, will check on the rest later, not sure on the all urls, maybe separate it on a separate issue? but will check. |
The other great and obscure thing here is it makes that second column possibly shorter, resulting in less wrapping on smaller terminals. |
Not that obscure, it was part of what bothered me as well, it's the first bullet point in the PR summary :) |
I changed All URLs for Project URLs, found it less missleading.. but we can not do that. Regardless I would do any further work on that, if any, on a separate issue. @rfay question on testings.. The tests pass locally if I run However, on Go Land it fails and I noticed the output is the previous version, like it's not using the built ddev but rather my local one? |
The tests in the cmd directory most often use the ddev in the path, yours is probably not this one. Docs have this case,
Thanks for your work on this! My normal working situation is I have a symlink in /usr/local/bin/ddev that normally points to my locally built version, but I use a script to point it to the homebrew version. So I'm almost always using the locally built version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just took a quick look, and I like it, but changing the entire format of the ddev describe -j
host_ports
is a breaking change I would think. I know it wouldn't affect many people, but we try not to do that. I don't think it's parseable either.
"host_ports": "33025->80, 33024->443, 5332->5222, 5555->5777, 32780->12445",
The trailing comma I can fix. The other comment not sure what you want me
to do with it
Reply might be shorter than usual / Respuesta más resumida que de costumbre
Enviado desde el celular / Sent from Mobile
…On Sat, 9 Nov 2024 at 17:53 Randy Fay ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Just took a quick look, and I like it, but changing the entire format of
the ddev describe -j host_ports is a breaking change I would think. I
know it wouldn't affect many people, but we try not to do that. I don't
think it's parseable either.
"host_ports": "33025->80, 33024->443, 5332->5222, 5555->5777, 32780->12445",
—
Reply to this email directly, view it on GitHub
<#6699 (review)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFFP53RKI4KHNTFLSSBD5LZ7ZY53AVCNFSM6AAAAABRLOJVS2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDIMRVGU4DGMJYGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ah, there's no trailing comma, you just copy over a portion of it, right? What did you mean with it's not parseable? |
Tests pass! |
Sorry, I wasn't clear. This completely changes |
I understand.. well, your call here. I can go back to the previous version only for json output, or I can add a new element, host_ports_mapping and print that instead of that on the non json part. |
|
host_ports_mapping is a great idea, but it should probably be a json map instead of plain text "->" |
I started working on this, is this oK?: "host_ports_mapping": [
{
"exposed_port": "80",
"host_port": "32803"
},
{
"exposed_port": "443",
"host_port": "32804"
},
{
"exposed_port": "4000",
"host_port": "32878"
},
{
"exposed_port": "30000",
"host_port": "32879"
}, And also, something I should mention that maybe you missed and just to make sure you are OK with it is that I also changed the content of exposed_ports.. previously it included the ones that are also exported to the host, now I am only shoing those that are not "only" exposed in the container. A mapped port to the port is always exposed in the contianer as well obviously. That was my reasoning. So one option is that you are ok with it and we leave it like that, or I can leave exposed ports for json the same way as before and do some extra logic on the table to remove them. |
I definitely like that for host_ports_mapping. Will look closely when I test at exposed_ports. |
Worked on this |
6bbfd10
to
b276765
Compare
well, not sure why the static validation is failing. seems something completely out of this PR. EDIT: works locally with make staticrequired |
I think you don't have the latest golangci-lint, you'll probably get the same results then. Newest is 1.62.0. I had 1.61.0. Annoyingly they keep "improving" its behavior over time :) |
Or:
|
Oh, those are improving things significantly! I like
quite a lot. And now it's not just providing information, it's providing context. I can go with this. Try not to break the json version. Now if we could explain to people what's going on with the router too. Not sure they'll ever understand. (out of scope) |
You prefer json will remain the same as before (I need to fix this) |
Well, that depends on which way you're looking at the traffic!
|
3821983
to
c1078b3
Compare
Ok, I think this should be OK, I also expanded tests further: Bare php project
json {
"level": "info",
"msg": "┌──────────────────────────────────────────────────────────────────────────────┐\n│ Project: a /tmp/a https://a.ddev.site │\n│ Docker platform: orbstack │\n│ Router: traefik │\n├──────────────┬──────┬───────────────────────────────────┬────────────────────┤\n│ SERVICE │ STAT │ URL/PORT │ INFO │\n├──────────────┼──────┼───────────────────────────────────┼────────────────────┤\n│ web │ \u001b[32mOK\u001b[0m │ https://a.ddev.site │ php PHP8.2 │\n│ │ │ InDocker -> Host: │ nginx-fpm │\n│ │ │ - web:80 -> 127.0.0.1:33077 │ docroot:'' │\n│ │ │ - web:443 -> 127.0.0.1:33078 │ Perf mode: mutagen │\n│ │ │ - web:8025 │ NodeJS:20 │\n├──────────────┼──────┼───────────────────────────────────┼────────────────────┤\n│ db │ \u001b[32mOK\u001b[0m │ InDocker -> Host: │ mariadb:10.11 │\n│ │ │ - db:3306 -> 127.0.0.1:33076 │ User/Pass: 'db/db' │\n│ │ │ │ or 'root/root' │\n├──────────────┼──────┼───────────────────────────────────┼────────────────────┤\n│ busybox │ \u001b[32mOK\u001b[0m │ InDocker: │ │\n│ │ │ - busybox:6594 │ │\n├──────────────┼──────┼───────────────────────────────────┼────────────────────┤\n│ Mailpit │ │ Mailpit: https://a.ddev.site:8026 │ │\n│ │ │ Launch: ddev mailpit │ │\n├──────────────┼──────┼───────────────────────────────────┼────────────────────┤\n│ Project URLs │ │ https://a.ddev.site, │ │\n│ │ │ https://127.0.0.1:33078, │ │\n│ │ │ http://a.ddev.site, │ │\n│ │ │ http://127.0.0.1:33077 │ │\n└──────────────┴──────┴───────────────────────────────────┴────────────────────┘\n",
"raw": {
"approot": "/tmp/a",
"database_type": "mariadb",
"database_version": "10.11",
"dbimg": "ddev/ddev-dbserver-mariadb-10.11:20241109_use_bin_env",
"dbinfo": {
"database_type": "mariadb",
"database_version": "10.11",
"dbPort": "3306",
"dbname": "db",
"host": "db",
"password": "db",
"published_port": 33076,
"username": "db"
},
"docroot": "",
"fail_on_hook_fail": false,
"hostname": "a.ddev.site",
"hostnames": [
"a.ddev.site"
],
"httpURLs": [
"http://a.ddev.site",
"http://127.0.0.1:33077"
],
"httpsURLs": [
"https://a.ddev.site",
"https://127.0.0.1:33078"
],
"httpsurl": "https://a.ddev.site",
"httpurl": "http://a.ddev.site",
"mailpit_https_url": "https://a.ddev.site:8026",
"mailpit_url": "http://a.ddev.site:8025",
"mutagen_enabled": true,
"mutagen_status": "ok",
"name": "a",
"nodejs_version": "20",
"performance_mode": "mutagen",
"php_version": "8.2",
"primary_url": "https://a.ddev.site",
"router": "traefik",
"router_disabled": false,
"router_http_port": "80",
"router_https_port": "443",
"router_status": "healthy",
"router_status_log": "container was previously healthy, so sleeping 59 seconds before continuing healthcheck... OKhealthy",
"services": {
"busybox": {
"exposed_ports": "6594",
"full_name": "ddev-a-busybox",
"host_ports": "",
"host_ports_mapping": [],
"image": "busybox",
"short_name": "busybox",
"status": "running"
},
"db": {
"exposed_ports": "3306",
"full_name": "ddev-a-db",
"host_ports": "33076",
"host_ports_mapping": [
{
"exposed_port": "3306",
"host_port": "33076"
}
],
"image": "ddev/ddev-dbserver-mariadb-10.11:v1.23.5",
"short_name": "db",
"status": "running"
},
"web": {
"exposed_ports": "80,443,8025",
"full_name": "ddev-a-web",
"host_http_url": "http://127.0.0.1:33077",
"host_https_url": "https://127.0.0.1:33078",
"host_ports": "33077,33078",
"host_ports_mapping": [
{
"exposed_port": "80",
"host_port": "33077"
},
{
"exposed_port": "443",
"host_port": "33078"
}
],
"http_url": "http://a.ddev.site",
"https_url": "https://a.ddev.site",
"image": "ddev/ddev-webserver:v1.23.5",
"short_name": "web",
"status": "running",
"virtual_host": "a.ddev.site"
}
},
"shortroot": "/tmp/a",
"ssh_agent_status": "healthy",
"status": "running",
"status_desc": "running",
"type": "php",
"urls": [
"https://a.ddev.site",
"https://127.0.0.1:33078",
"http://a.ddev.site",
"http://127.0.0.1:33077"
],
"webimg": "ddev/ddev-webserver:20241111_stasadev_n_install_cleanup",
"webserver_type": "nginx-fpm",
"xdebug_enabled": false
},
"time": "2024-11-15T15:12:31-03:00"
} My project with a lot of ports
json: {
"level": "info",
"msg": "┌─────────────────────────────────────────────────────────────────────────────────────┐\n│ Project: project1 ~/Sites/subsite1/project1 https://project1.ddev.site │\n│ Docker platform: orbstack │\n│ Router: traefik │\n├──────────────┬──────┬──────────────────────────────────────────┬────────────────────┤\n│ SERVICE │ STAT │ URL/PORT │ INFO │\n├──────────────┼──────┼──────────────────────────────────────────┼────────────────────┤\n│ web │ \u001b[32mOK\u001b[0m │ https://project1.ddev.site │ drupal10 PHP8.2 │\n│ │ │ InDocker -> Host: │ nginx-fpm │\n│ │ │ - web:80 -> 127.0.0.1:33008 │ docroot:'web' │\n│ │ │ - web:443 -> 127.0.0.1:33009 │ Perf mode: mutagen │\n│ │ │ - web:4000 -> 127.0.0.1:32981 │ NodeJS:18.18.2 │\n│ │ │ - web:8025 │ │\n│ │ │ - web:30000 -> 127.0.0.1:32982 │ │\n│ │ │ - web:30001 -> 127.0.0.1:32983 │ │\n│ │ │ - web:30002 -> 127.0.0.1:32984 │ │\n│ │ │ - web:30003 -> 127.0.0.1:32985 │ │\n│ │ │ - web:30004 -> 127.0.0.1:32986 │ │\n│ │ │ - web:30005 -> 127.0.0.1:32987 │ │\n│ │ │ - web:30006 -> 127.0.0.1:32988 │ │\n│ │ │ - web:30007 -> 127.0.0.1:32989 │ │\n│ │ │ - web:30008 -> 127.0.0.1:32990 │ │\n│ │ │ - web:30009 -> 127.0.0.1:32991 │ │\n│ │ │ - web:30010 -> 127.0.0.1:32992 │ │\n│ │ │ - web:30011 -> 127.0.0.1:32993 │ │\n│ │ │ - web:30012 -> 127.0.0.1:32994 │ │\n│ │ │ - web:30013 -> 127.0.0.1:32995 │ │\n│ │ │ - web:30014 -> 127.0.0.1:32996 │ │\n│ │ │ - web:30015 -> 127.0.0.1:32997 │ │\n│ │ │ - web:30016 -> 127.0.0.1:32998 │ │\n│ │ │ - web:30017 -> 127.0.0.1:32999 │ │\n│ │ │ - web:30018 -> 127.0.0.1:33000 │ │\n│ │ │ - web:30019 -> 127.0.0.1:33001 │ │\n│ │ │ - web:30020 -> 127.0.0.1:33004 │ │\n├──────────────┼──────┼──────────────────────────────────────────┼────────────────────┤\n│ db │ \u001b[32mOK\u001b[0m │ InDocker -> Host: │ mariadb:10.11 │\n│ │ │ - db:3306 -> 127.0.0.1:33007 │ User/Pass: 'db/db' │\n│ │ │ │ or 'root/root' │\n├──────────────┼──────┼──────────────────────────────────────────┼────────────────────┤\n│ Mailpit │ │ Mailpit: https://project1.ddev.site:8026 │ │\n│ │ │ Launch: ddev mailpit │ │\n├──────────────┼──────┼──────────────────────────────────────────┼────────────────────┤\n│ Project URLs │ │ https://project1.ddev.site, │ │\n│ │ │ https://*.project1.ddev.site, │ │\n│ │ │ https://127.0.0.1:33009, │ │\n│ │ │ http://project1.ddev.site, │ │\n│ │ │ http://*.project1.ddev.site, │ │\n│ │ │ http://127.0.0.1:33008 │ │\n└──────────────┴──────┴──────────────────────────────────────────┴────────────────────┘\n",
"raw": {
"approot": "/Users/ariel/Sites/subsite1/project1",
"database_type": "mariadb",
"database_version": "10.11",
"dbimg": "ddev/ddev-dbserver-mariadb-10.11:20241109_use_bin_env",
"dbinfo": {
"database_type": "mariadb",
"database_version": "10.11",
"dbPort": "3306",
"dbname": "db",
"host": "db",
"password": "db",
"published_port": 33007,
"username": "db"
},
"docroot": "web",
"fail_on_hook_fail": true,
"hostname": "project1.ddev.site",
"hostnames": [
"project1.ddev.site",
"*.project1.ddev.site"
],
"httpURLs": [
"http://project1.ddev.site",
"http://*.project1.ddev.site",
"http://127.0.0.1:33008"
],
"httpsURLs": [
"https://project1.ddev.site",
"https://*.project1.ddev.site",
"https://127.0.0.1:33009"
],
"httpsurl": "https://project1.ddev.site",
"httpurl": "http://project1.ddev.site",
"mailpit_https_url": "https://project1.ddev.site:8026",
"mailpit_url": "http://project1.ddev.site:8025",
"mutagen_enabled": true,
"mutagen_status": "ok",
"name": "project1",
"nodejs_version": "18.18.2",
"performance_mode": "mutagen",
"php_version": "8.2",
"primary_url": "https://project1.ddev.site",
"router": "traefik",
"router_disabled": false,
"router_http_port": "80",
"router_https_port": "443",
"router_status": "healthy",
"router_status_log": "container was previously healthy, so sleeping 59 seconds before continuing healthcheck... OKhealthy",
"services": {
"db": {
"exposed_ports": "3306",
"full_name": "ddev-project1-db",
"host_ports": "33007",
"host_ports_mapping": [
{
"exposed_port": "3306",
"host_port": "33007"
}
],
"image": "ddev/ddev-dbserver-mariadb-10.11:v1.23.5",
"short_name": "db",
"status": "running"
},
"web": {
"exposed_ports": "80,443,4000,8025,30000,30001,30002,30003,30004,30005,30006,30007,30008,30009,30010,30011,30012,30013,30014,30015,30016,30017,30018,30019,30020",
"full_name": "ddev-project1-web",
"host_http_url": "http://127.0.0.1:33008",
"host_https_url": "https://127.0.0.1:33009",
"host_ports": "33008,33009,32981,32982,32983,32984,32985,32986,32987,32988,32989,32990,32991,32992,32993,32994,32995,32996,32997,32998,32999,33000,33001,33004",
"host_ports_mapping": [
{
"exposed_port": "80",
"host_port": "33008"
},
{
"exposed_port": "443",
"host_port": "33009"
},
{
"exposed_port": "4000",
"host_port": "32981"
},
{
"exposed_port": "30000",
"host_port": "32982"
},
{
"exposed_port": "30001",
"host_port": "32983"
},
{
"exposed_port": "30002",
"host_port": "32984"
},
{
"exposed_port": "30003",
"host_port": "32985"
},
{
"exposed_port": "30004",
"host_port": "32986"
},
{
"exposed_port": "30005",
"host_port": "32987"
},
{
"exposed_port": "30006",
"host_port": "32988"
},
{
"exposed_port": "30007",
"host_port": "32989"
},
{
"exposed_port": "30008",
"host_port": "32990"
},
{
"exposed_port": "30009",
"host_port": "32991"
},
{
"exposed_port": "30010",
"host_port": "32992"
},
{
"exposed_port": "30011",
"host_port": "32993"
},
{
"exposed_port": "30012",
"host_port": "32994"
},
{
"exposed_port": "30013",
"host_port": "32995"
},
{
"exposed_port": "30014",
"host_port": "32996"
},
{
"exposed_port": "30015",
"host_port": "32997"
},
{
"exposed_port": "30016",
"host_port": "32998"
},
{
"exposed_port": "30017",
"host_port": "32999"
},
{
"exposed_port": "30018",
"host_port": "33000"
},
{
"exposed_port": "30019",
"host_port": "33001"
},
{
"exposed_port": "30020",
"host_port": "33004"
}
],
"http_url": "http://project1.ddev.site",
"https_url": "https://project1.ddev.site",
"image": "ddev/ddev-webserver:v1.23.5",
"short_name": "web",
"status": "running",
"virtual_host": "project1.ddev.site"
}
},
"shortroot": "~/Sites/subsite1/project1",
"ssh_agent_status": "healthy",
"status": "running",
"status_desc": "running",
"type": "drupal10",
"urls": [
"https://project1.ddev.site",
"https://*.project1.ddev.site",
"https://127.0.0.1:33009",
"http://project1.ddev.site",
"http://*.project1.ddev.site",
"http://127.0.0.1:33008"
],
"webimg": "ddev/ddev-webserver:20241111_stasadev_n_install_cleanup",
"webserver_type": "nginx-fpm",
"xdebug_enabled": false
},
"time": "2024-11-15T15:10:16-03:00"
} |
I am curious on how many people use |
No stats, I imagine it's few. Mostly probably wrapped in scripts that determine things about a project. There have been a few of those tossed around over the years. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, even better!
And if it matters, I noticed that host_ports
are not sorted:
Tested with config from #6699 (review)
$ ddev st -j | jq .raw.services.phpmyadmin | grep 'ports"'
"exposed_ports": "80,5000,5605,8983,12345,14556",
"host_ports": "5000,5001,1234",
$ ddev st -j | jq .raw.services.web | grep 'ports"'
"exposed_ports": "80,443,3000,5222,5492,5777,8025,12394,12445,57497",
"host_ports": "32866,32867,5332,5555,32770",
$ ddev st -j | jq .raw.services.db | grep 'ports"'
"exposed_ports": "3306,3999,4352,6594,54355",
"host_ports": "32863,12312,32768",
it mattered.. fixed that and added testing for being sorted. |
also expanded tests
7b81f2e
to
7881a3e
Compare
rebased |
@stasadev mentioned in our meeting today how absolutely thrilled he is with this ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great! Thanks for this marvelous contribution!
@@ -0,0 +1,33 @@ | |||
services: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note that docker-compose.override.yaml
doesn't really have any use in DDEV (but it works here just fine, like any other docker-compose.*.yaml
). Just docker-compose.something.yaml
is more descriptive, merged in alpha order. Since DDEV loads all the docker-compose.*.yaml
the "override" isn't really useful. I'm going to remove the reference from the docs. But... https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/
This PR improves:
InDocker
and theHost
ports.I've always been bothered by this. More often than not I want to clearly find what are the mappings of the local port to the remote ports. Also, onn some projects I exposed quite a bit of ports, and there are duplicate ports on the hosts
This is the second time I bring this up, couldn't find my previous issue though, but I hadn't worked on it back than.
On this project, for example, I exposed port 4000. As I have many ports I couldn't really tell which host port was connected to container port 4000. I can find it with
docker ps
or some other inspection tools ,but it would be great if it was there and provided by ddev.Somewhat related, this is the reason why I had to create https://github.com/hanoii/ddev-platformsh-lite/blob/main/commands/host/platform%3Atunnels on my not publicly exposed add-on.
Hope this doesn't takes as much as
ddev debug match-constraint
😄Showing example of how it is displayed currently, vs the PR: