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

Use 0.0.0.0 for livereload address #920

Closed
wants to merge 1 commit into from

Conversation

tanc
Copy link

@tanc tanc commented Aug 27, 2018

Motivation

Access livereload address from host machine when livereload is running in a container.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

I don't have an automated way of testing this but my manual test is:

  1. Install a fresh Docuaurus in the host environment.
  2. Run yarn start in the host environment.
  3. Ensure the site is served at http://localhost:3000 as usual.
  4. Containerise the application (get it installed in a node based container)
  5. Run yarn start within the container.
  6. Confirm the site is not accessible at http://localhost:3000
  7. Stop the webserver (live reload).
  8. Apply the change from this merge request commit.
  9. Run yarn start within the container.
  10. Confirm the site is accessible at http://localhost:3000

This will resolve #919

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 27, 2018
@tanc
Copy link
Author

tanc commented Aug 27, 2018

Note that the code style changes were automatically applied, I think by the precommit hook.

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-preview ready!

Built with commit da01dc6

https://deploy-preview-920--docusaurus-preview.netlify.com

Copy link
Contributor

@endiliey endiliey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. using 0.0.0.0 means that it will try and connect to all the available interfaces instead of just 127.0.0.1 (what localhost usually translates to).
Another thing is that 0.0.0.0 doesn't work well on windows (in fact, it won't work)

However, using localhost does not allow visiting over network (e.g: on docker)

Maybe we should do something like

process.platform === 'win32' ? 'localhost' : '0.0.0.0';

@yangshun
Copy link
Contributor

yangshun commented Sep 9, 2018

@tanc What do you think of the suggestion? I don't have too much knowledge in virtualization, will defer to you guys 😄

@tanc
Copy link
Author

tanc commented Sep 10, 2018

I think the suggestion is good (poor Windows users!). I'll try and find some time to implement the change.

@JoelMarcey
Copy link
Contributor

I am going to close this PR for now. @tanc, please reopen, rebase and make the suggested change and then we can merge it in. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use 0.0.0.0 for livereload address
6 participants