Ngrok is a tunneling tool that can make localhost accessible on the internet, it's a good way to test our local web app. This is being mostly used by web developers for testing their projects, What does it do? It maps a localhost development server to a ngrok.io sub-domain, which a remote user can then access. There’s no need to expose ports, set up forwarding, or make other network changes.
The Ngrok client software is available for Windows, macOS, and Linux.
Actually, Ngrok provides temporary access to someone by issuing them with a randomly generated URL.
Get the Ngrok Download
To start, open ngrok.com in your browser and click Sign up to register. A Google or GitHub account is easiest, but you can choose standard registration with an email address and password. An email verification link will be sent to you.
After login, you’ll be directed to the Ngrok dashboard where you can download the client for your operating system.
Download & setup Ngrok
Open terminal
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
Extract the zip file and copy it
sudo unzip ngrok-stable-linux-amd64.zip
Connecting your account
Running this command will add your auth-token to your ngrok.yml file. Connecting an account will list your open tunnels in the dashboard, give you longer tunnel timeouts, and more. Visit the dashboard to get your auth token.
./ngrok authtoken 1yz1bEMJCfAkr5wsXYpW957EjIv_3G6WTnXCgVABG4YgreJfB
How to use Ngrok
Let's say you have a local webserver running on port 80, and you want to make that localhost accessible through the internet using Ngrok, then you need to run this command:
ngrok http [port-number]
For Koha ( if your staff client port is 8080 and opac port is 80, It can be activated )
ngrok http 8080
ngrok http 80
And then you can see if the session status is online, you will get an URL forwarding with TLD ngrok.io, this is the URL that you can access on the internet. Ngrok also generate a local web interface on http://127.0.0.1:4040
Eg: https://0920-157-46-213-138.ngrok.io (for OPAC)
https://0ecd-157-46-213-138.ngrok.io ( Staff )
You can monitor the traffic of your localhost connection, from the command line or from the web interface
Drawbacks
- The local system has to be ON
- IP will change so that the URL once created can not be used when the network is restarted
NB: I will not recommend you to install and use in your production koha server, This can be used for those enthusiasts who are looking for experiments with koha
Reference: https://ngrok.com/docs