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-now: Error starting: getaddrinfo ENOTFOUND new-playground1.wpnow #32

Closed
flexseth opened this issue Apr 3, 2024 · 12 comments
Closed

Comments

@flexseth
Copy link

flexseth commented Apr 3, 2024

Launched from folder for new-playground1

Blueprint

{
	"steps": [
		{
			"step": "defineWpConfigConsts",
			"consts": {
				"WP_HOME": "http://new-playground1.wpnow:8885",
				"WP_SITEURL": "http://new-playground1.wpnow:8885"
			},
			"method": "define-before-run"
		}
	]
}

Command

wp-now start --blueprint=blueprint.json --port=8885

Output

wp-now start --blueprint=blueprint.json --port=8885
Starting the server......
directory: ....../Desktop/sample-playground-1  #partially redacted
mode: playground
php: 8.0
wp: latest
WordPress latest folder already exists. Skipping download.
SQLite folder already exists. Skipping download.
blueprint steps: 1
Blueprint step completed: defineWpConfigConsts
node:internal/errors:563
    ErrorCaptureStackTrace(err);
    ^

Error: getaddrinfo ENOTFOUND new-playground1.wpnow
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'new-playground1.wpnow'
}

Node.js v20.10.0
@flexseth
Copy link
Author

flexseth commented Apr 3, 2024

Possibly the reason:

wp-now does not support custom domains or SSL (yet!);

Via

wp-now vs. Laravel Valet

@adamziel
Copy link
Owner

adamziel commented Apr 3, 2024

Sounds like a wp-now issue – I'd report that in the https://github.com/WordPress/playground-tools/ repo.

@flexseth
Copy link
Author

flexseth commented Apr 3, 2024

Is there a chance you can transfer it over there? I'm going to play around a bit more with the local enviro and blueprints, just getting started...

@flexseth
Copy link
Author

flexseth commented Apr 3, 2024

Ah! I see why I reported it here - common errors users may run into.

added it to the Issues page in the sheet

Should this be left as a duplicate?

@flexseth
Copy link
Author

flexseth commented Apr 4, 2024

Defining Custom URLs

Here is an example of a Blueprint that defines custom URL constant. wp-now will automatically detect the blueprint and execute it after starting the server. In consequence, the site will be available at http://myurl.wpnow. Make sure myurl.wpnow is added to your hosts file.

I started using the wp-now package without reading the docs. ...

Guess it's not a bad way to start if you're looking to create errors, though :)

Fix

Issue most likely resolved with updated my local hosts file

Conclusion

Updating hosts for local development is a bit of a "gotcha" - especially for new users (and apparently seasoned ones as well). Create a docs page showing how to update hosts to support custom domains

@ironnysh
Copy link

ironnysh commented Apr 6, 2024

Create a docs page showing how to update hosts to support custom domains

This should definitely be mentioned, however, I'd recommend against including these instructions in the Playground docs (for maintenance and scope reasons). It'll be easier to link to reliable sources instead.

@flexseth
Copy link
Author

flexseth commented Apr 7, 2024

I'd recommend against including these instructions in the Playground docs

Here's my updates to the docs so far...

Updating the hosts file is a common "Gotcha" when working with local hosts. Software like Local does this automatically, but wp-now doesn't, at least out of the box.

The topic does have a large scope, but is directly relevant to how wp-now works behind the scenes with Playground. On a bigger level it has a lot to do with how local development works, but we don't have to get into all of that...

I think it's important that users know how to fix the issue as they will probably run into it as a "Gotcha" ... they don't really need to know how domain routing works in depth.

Use case: Entry-level devs and new users to Playground

For new users we're trying to lower the barrier to entry as much as possible. If the Playground boots up and they are seeing errors or behavior that is unexpected, I'd like to round out those cases as much as possible. Until support is there for automatically updating the hosts file I'd like to keep this as a consideration from a docs standpoint :)

Pain point

  • Users boots Playground, doesn't work, local machine doesn't know how to handle the URL
  • User doesn't know what to do

The fix

  • document the error and explain how to update the hosts file
  • or provide a blueprint example that works out of the box

@ironnysh - If you'd like to pick up on this piece of the docs, that would be awesome!

@ironnysh
Copy link

ironnysh commented Apr 8, 2024

Hey @flexseth, the second option (add "a blueprint example that works out of the box") is the way to go.

Updating the hosts file is a common "Gotcha" when working with local hosts

It might be, but then again, it's mixing two audiences: How many new users would actually run into this issue?

they will probably run into it as a "Gotcha"

Only if they decide to try the advanced scenarios demonstrated in this section. But what are the odds that this group of people would even "bother" with that? I mean, if you include a whole standalone section on how to update the hosts file to support custom domains, you'd to explain IP addresses, DNS, ports, SSL, user privileges, how to access/unhide ~/.wp-now (and ngrok, for that matter).

For those who are both new to local development AND are curious enough to experiment, my suggestion was (and still is 😀) the same: Definitely mention it, but link to reliable sources that explain how to do it on different OSs; it's a huge topic and there's no reason to recreate it on Playground's docs.

@flexseth
Copy link
Author

flexseth commented Apr 9, 2024

It might be, but then again, it's mixing two audiences: How many new users would actually run into this issue

When we were thinking about the documentation, the thought was to lean towards developer use cases. The thought being, if devs get involved, it will provide value to end-users.

I mean, if you include a whole standalone section on how to update the hosts file

We can probably just provide a simple doc on how to update for local dev. The primary use case is for having a user to be able to create a blueprint that has localdomain.com preview-able in their web browser. It's all from localhost, in order to do this the hosts file needs to be spoofed into thinking this is the correct URL for the website.

Limitations to consider

It's possible that some of the site settings aren't working correctly when installing via a blueprint.

Certainly a consideration and also the focus of the issue..

Background

The goal of raising the issue was to streamline local DNS access via the Playground Tools... other local dev platforms such as Local and Kinsta - even major hosts like Pantheon have a tool that rolls a local development environment that is pre-configured with DNS routing.

What's the easiest way to streamline this experience for users of the Playground?

@ironnysh
Copy link

Hey @flexseth, l feel like this discussion is going in a loop :-)) We’re basically agreeing that there are two things to do:

  1. Add a simplified, working-out-of-the-box example to the wp-now docs that uses localhost.
  2. Add instructions for people who want a custom domain.

The question is how to go about the latter: link to external information or write internal documentation. I vote for linking.

the thought was to lean towards developer use cases

That’s cool, no argument there. But you mentioned a use case that focuses on entry-level/new users, which probably wouldn’t run into this situation. It’s not like you must use wp-now with a custom domain.

provide a simple doc on how to update for local dev.

This type of doc can’t be “simple” without being useless. That’s why I advised against it, suggesting to provide links to reliable external resources.

The primary use case is for having a user to be able to create a blueprint that has localdomain.com preview-able in their web browser.

Using a custom domain configured to work locally with localhost is another, more advanced use case, which requires a bit more thought about the best way to approach it in the documentation.

We shouldn’t mix these two audiences together.

It's possible that some of the site settings aren't working correctly when installing via a blueprint.
Certainly a consideration and also the focus of the issue..

Sorry, not sure how that’s related :-)

other local dev platforms such as Local and Kinsta - even major hosts like Pantheon have a tool that rolls a local development environment that is pre-configured with DNS routing.

I wouldn’t compare wp-now to these GUI apps. wp-env is a better example, which also doesn’t involve local virtual hosts, SSL certificates, and resolving DNS.

The goal of raising the issue was to streamline local DNS access via the Playground Tools...

Again, it depends on the use case/persona you’re targeting, and can be handled in a few ways (based on the scenario). In any case, recreating this huge knowledge base in Playground’s documentation site seems like a bad idea.

@flexseth
Copy link
Author

flexseth commented Apr 10, 2024

see below...

@flexseth
Copy link
Author

closing in favor of offering a challenge to @ironnysh

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

3 participants