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

wp-env: consideration of active ports #49843

Open
HeikoMamerow opened this issue Apr 14, 2023 · 4 comments
Open

wp-env: consideration of active ports #49843

HeikoMamerow opened this issue Apr 14, 2023 · 4 comments
Labels
[Package] Env /packages/env [Type] Enhancement A suggestion for improvement.

Comments

@HeikoMamerow
Copy link

What problem does this address?

wp-env is a very fast and handy tool if you can use it "out of the box" - without configuration. However, most of the time I have to configure custom ports because the default port (8888) is already occupied on my machine. This is very time consuming and annoying.

What is your proposed solution?

The problem can be solved by generating a random port number and check if this port is already open. If the port is open, then a new number is generated and checked.

I had already written a helper script for this task: https://github.com/HeikoMamerow/wp-env-port-stamp

Is it possible to include such a port check in wp-env? I could develop the feature and submit it as PR if that's ok.

PS: I have no experience with contributions for Gutenberg so far. 🙈 But i am very interested to include this feature. 💪

@talldan talldan added the [Package] Env /packages/env label Apr 18, 2023
@talldan
Copy link
Contributor

talldan commented Apr 18, 2023

@HeikoMamerow Thanks for reaching out.

Is it possible to include such a port check in wp-env? I could develop the feature and submit it as PR if that's ok.

PRs are definitely welcome. The only thing is that env doesn't currently have many contributors/maintainers, so there may be a lack of code reviewers/approvers.

It looks like only simple documentation changes have been merged in the last six months. So you may want to make a call on the effort/reward.

@noahtallen
Copy link
Member

noahtallen commented Apr 21, 2023

Happy to review and test a PR for this based on your existing script! I would expect it to run during wp-env start, and I think it would be fine for it to be unique each time. If people need the port to stay the same, they can set it in .wp-env.json

@noahtallen noahtallen added the [Type] Enhancement A suggestion for improvement. label Apr 21, 2023
@HeikoMamerow
Copy link
Author

Thank you very much for your answers! This makes me very confident that it is worthwhile to implement this task. I will start the implementation next week.

@noahtallen I completely agree with you. Port management should be done by default at startup. I think it should be so that the original default ports (8888/8889) are checked first and if already active, then another one will used that is not yet active.

The port management should also be optionally "deactivatable", so that it is possible to define own ports.

@HeikoMamerow
Copy link
Author

HeikoMamerow commented May 3, 2023

Aaargh, I had completed my changes and now wanted to start a PR. But after the sync I see that the origin port handling was completely rewritten. 😢

However - this was my changes: trunk...HeikoMamerow:gutenberg:env/feat/port_management

What now? Of course my changes do not work with the current version. I may start again...

How can this be better coordinated? What can i do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Env /packages/env [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants