adamziel / playground-docs-workflow

Experimenting with maintaining WordPress docs using WordPress Playground
https://adamziel.github.io/playground-docs-workflow/
11 stars 2 forks source link

wp-now: Error starting: getaddrinfo ENOTFOUND new-playground1.wpnow #32

Closed flexseth closed 4 months ago

flexseth commented 4 months ago

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 commented 4 months ago

Possibly the reason:

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

Via

wp-now vs. Laravel Valet

adamziel commented 4 months ago

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

flexseth commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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

The fix

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

ironnysh commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

see below...

flexseth commented 4 months ago

closing in favor of offering a challenge to @ironnysh