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 ngrok-py library #10438

Merged
merged 2 commits into from
May 18, 2023
Merged

Use ngrok-py library #10438

merged 2 commits into from
May 18, 2023

Conversation

bobzilladev
Copy link
Contributor

Describe what this pull request is trying to achieve.

Switching the ngrok module to use the newer ngrok-py library which does not require an externally running agent process.

Additional notes and description of your changes

Switches from pip installing pyngrok to ngrok. Adds --ngrok-options argument to pass a json string of ngrok configuration. Removes --ngrok-region, region specification is deprecated as nearest region is now chosen automatically. Still uses basic authentication if :<username>:<password> is appended to the authtoken.

The authtoken can be injected from the NGROK_AUTHTOKEN environment variable with:
--ngrok-options '{"authtoken_from_env":true}'

Basic Authentication can be configured with:
--ngrok-options '{"basic_auth":"<username>:<password>"}'

OAuth can be configured with options like:
--ngrok-options '{"oauth_provider":"google", "oauth_emails":"user@example.com"}'

For all options see: ngrok-connect-full

Environment this was tested in

  • OS: MacOS-aarch64, Windows-x86_64
  • Browser: Firefox
  • Graphics card: Apple M2, NVIDIA RTX 3070 Ti

Screenshots or videos of your changes

ngrok authtoken detected, trying to connect...
ngrok connected to localhost:7860! URL: https://1cf4-69-255-235-247.ngrok-free.app
You can use this link after the launch is complete.

@AUTOMATIC1111
Copy link
Owner

i never used ngrok so I can't really judge the usefulness of this change, but how useful is it? Is the other broken? Are users unsatisfied with the need to specify a region?

@bobzilladev
Copy link
Contributor Author

Happy to answer any questions:

Usefulness of this change...how useful is it?

This change allows configuring the full set of ngrok ingress options. For instance OAuth authentication via supported providers (Amazon, Facebook, GitHub, GitLab, Google, LinkedIn, Microsoft, Twitch), IP Restrictions, Mutual TLS, Proxying Protocols, etc. So more options to share across networks with only the right set of folks having access. It remains backwards compatible for open or basic-authentication use-cases.

Is the other broken?

The pyngrok community-supported library continues to work, but it requires running a separate golang process. The ngrok first-party library does not need a sidecar, and will be supported going forward.

Are users unsatisfied with the need to specify a region?

It used to be that regions were isolated so configuring a region was the only way to optimize traffic, but these days global least-latency routing is done automatically so the option is now vestigial. Users get the benefit for free without having to think about it.

@AUTOMATIC1111 AUTOMATIC1111 changed the base branch from master to dev May 18, 2023 07:11
@AUTOMATIC1111 AUTOMATIC1111 merged commit b4b42de into AUTOMATIC1111:dev May 18, 2023
@MalguyMQ
Copy link

It's still not possible to put a custom domain in front of ngrok?

@bobzilladev
Copy link
Contributor Author

It's still not possible to put a custom domain in front of ngrok?

All users can reserve a static domain to use for free: free-static-domains-ngrok-users

Using a fully custom domain is also possible, which involves some additional steps to complete: how-to-set-up-a-custom-domain

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

Successfully merging this pull request may close these issues.

3 participants