-
Download and install ngrok, if necessary.
Be sure to connect your account (by installing your authtoken)
and ensure that you can run ngrok successfully from a Windows command prompt.
For this tutorial, we have installed ngrok (free plan) in C:\ngrok and configured the utility to provide a tunnel to our
PC Commander software
running on an internal server at port 8008. This command line works for us:
C:\ngrok\ngrok.exe http https://localhost:8008
Of course, your command line will be different — perhaps with the -config option and a .yaml file. Be sure to use your command line in the steps below.
-
Download and install AlwaysUp, if necessary.
-
Start AlwaysUp.
-
Select Application > Add to open the Add Application window:
-
On the General tab:
-
In the Application field, enter the full path to the ngrok executable, ngrok.exe.
-
In the Arguments field, enter the parameters to ngrok.exe (from the command line you identified step 1).
-
And in the Name field, enter the name that you will call this application in AlwaysUp.
We have stuck with the default of Ngrok but you can specify another name if you like.
-
Click over to the Logon tab, check the box at the top and enter the username and password of the Windows account where you installed ngrok.
This is important if you installed your authtoken in the default configuration file (C:\Users\<USERNAME>\.ngrok2\ngrok.yml).
-
If you are interested in monitoring the ngrok web interface and detecting when it stops serving pages,
click over to the Monitor tab. We'll set up a failure detection batch file to detect when the web interface has failed.
-
Follow these instructions to create the failure detection BAT file.
We have called ours check-web-server.bat and placed it in our ngrok folder.
-
Click the "..." button in the Whenever it fails a "sanity check" section and specify the full path to the batch file.
Change the Every controls to 5 minutes, or tune to any frequency that you see fit.
More time means less frequent checks and less load on the server, but with a reduced sensitivity to failures.
-
Click the OK button.
Here's what the Monitor tab should look like when you're done:
-
Switch to the Startup tab and check the Ensure that the Windows Networking components have started box.
This informs AlwaysUp that ngrok needs TCP/IP networking support to do its work.
-
We're done configuring ngrok to run as a service so click the Save button to record your settings.
In a few seconds, an entry for ngrok will show up in the AlwaysUp window.
It is not yet running though, and the state will be Stopped:
-
To start ngrok from AlwaysUp, choose Application > Start "ngrok".
In a few seconds, the utility will start invisibly in the background, on the
isolated Session 0.
ngrok's familiar command window will NOT appear on your desktop.
Fire up your web browser and browse to the ngrok web interface. Confirm that the tunnel is working from there:
-
That's it! Next time your computer boots, ngrok will start up immediately, before anyone logs on.
We encourage you to edit ngrok in AlwaysUp and check out the many other settings that may be appropriate for your environment.
For example, send an email if ngrok crashes or stops for any reason, capture console output to a log file,
restart the tunnel nightly to cure memory leaks, and much more.