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
Implement 'ngrok' (or similar) to allow web access to a local container. #375
Comments
Thanks, @owenbush! I also followed up with Owen in Slack regarding some additional details that are in his company's internal documentation. He sent the link over and I'll pull some of the pertinent information into this thread for additional context. |
PREREQUISITESFirst of all, there should be the following file in the root of the repository If that file does not exist then you can create it with 755 permissions and with the following content
STEP 1Navigate to the root of your repository and run the following command $ ./ngrok-setup.sh STEP 2When you ran the command in Step 1 your browser should have automatically opened up the ngrok website in your default browser. If this did not happen then navigate to: STEP 3If you do not have an account with ngrok then register for one, they are free. If you do have an account log in to your account and navigate to STEP 4Once on your dashboard you should see a command you need to execute to authenticate your ngrok binary that we downloaded earlier with the ngrok services. To execute this command you will need to be SSH'd on to your container.
STEP 5Once you have successfully authenticated your ngrok binary with the ngrok website you can now make use of the functionality to expose your site over the internet.
In the above output, your web-accessible tunnel to your site is http://c08af649.ngrok.io STEP 6Your tunnel will remain available and active so long as you keep the window with the running ngrok binary open. If you wish to disable your tunnel you can do so at any time by pressing CTRL+C to quit. |
@owenbush It seems to me there wouldn't be anything required of ddev to accomplish this. If I do a docker ps with my site running I see And if I hit localhost:32770 with the web browser everything is there just peachy. Doesn't that mean that ngrok would work fine as is? I will open an issue for |
@rfay, the issue is that localhost:32270 is not web-accessible for a third party service/server. For example a webhook callback from Recurly 'localhost' wouldn't map to my local machine. ngrok the service creates a DNS resolvable public URL for access like: http://c08af649.ngrok.io @rickmanelius the one thing I will state about those instructions I created before is that they were for a one-time setup in a local repo and it worked fine, but what would be ideal is that ngrok is baked into ddev and we therefore don't need to run that custom setup script I created. |
Right @owenbush - so for example, you can use https://562fa535.ngrok.io/ right now to hit my local ddev instance for randyfay.ddev.local. And it will answer to any hostname with no problems. I could even set up a CNAME to the ngrok URL and things would work just fine. Let me know what I'm missing here. |
@rfay Yea setting up ngrok manually is completely doable. I have done is myself before. I just felt it was a nice out-of-the-box feature for ddev to facilitate. There is nothing particularly difficult about setting up ngrok manually if you have CLI experience and I could certainly put together a set of instructions for use with ddev if that was desired. |
For the record, all I did was:
|
Yea, its pretty simple for those who are comfortable doing that. My thought was more for those who were not, but wanted a seamless way of doing so with ddev for testing, webhook or sharing reasons. By having this baked into ddev and having a ddev command to produce a web-accessible URL they can use however they choose would save them from having to install ngrok themselves.
Which would display something like As I said, I know ddev/docker is compatible and that is not where I was heading with this feature request. The feature request was to somehow have ngrok part of the core ddev offering so people do not need to worry, or even know, about what is going on under the hood. I understand if this is a bit too bespoke a thing to bake in, it would be a nice to have for me. But I can manually set it up if not. |
I also very much appreciate you motivating me to finally give ngrok a try. It was awesomely more easier than the old ssh tunnel tricks I used to use for this sort of thing. Of course... I have to trust ngrok.io, which is a lot to ask. But so easy! Thanks for getting me over the hump! |
Related to #416 |
Just noting that this feature has come up a few times in recent conversation. I think this would be of value in parallel with the hosting provider conversations because it provides yet another way to get work viewable upstream. Tagging w/v1.4.0 for now. |
There is another service calls http://xip.io e.g is used by https://www.mamp.info/en/mamp-pro/ |
Some general related notes: There is a good summary of techniques on https://medium.com/botfuel/how-to-expose-a-local-development-server-to-the-internet-c31532d741cc and I see a number of others - It suggests:
|
Another option for this is https://github.com/alexellis/inlets |
Hmm. What if I don't really care about security, and I just want to be able to send people the IP address of the droplet I'm developing on. Seems like there should be an easy way to modify the ddev nginx config to respond to incoming requests? It's already listening on port 80, right? |
Hi @bennlich - We've had If you'd rather access a particular project directly by port, not using the name of the project, you can do that with the strategy in #2076 (comment) |
Feature Request
I'd love to see something like https://ngrok.com/ available to use with ddev to allow web access to a local container. I used this previously to allow Recurly to use webhooks to post data back to my local machine during testing and it was a lifesaver. Another good example of a use case is to be able to use something like BrowserStack to check a local site in multiple browsers prior to deploying to a web-accessible staging/production environment.
What you expected to happen:
ddev ngrok --auth="username:password" 80
Would expose the webcontainer port 80 over the internet behind simple HTTP authentication to prevent prying eyes.
Related source links or issues:
https://ngrok.com/
The text was updated successfully, but these errors were encountered: