Link WebODM to the internet - Ngrok

After seeing another contributor’s post and Piero’s reply recently, I thought I’d give it a go and share the results.

He suggested using Ngrok as a tunnel to give access to WebODM to clients on the web. There are more traditional methods which I had been trying to do, involving adding a port forwarding rule to your router, then configuring a web server such as Nginx. However the final configuration of the web server is a serious pain.

I’m using Ubuntu 16.04 for the instructions below. I have also signed up to the basic pricing tier which allows custom subdomains. If you have the free tier then drop the ‘-sundomain=’ flag from the items below.

Se we start by installing the ngrok executable;

cd /opt/	
mkdir ngrok
cd ngrok/
wget -c https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip ngrok-stable-linux-amd64.zip
sudo apt install ngrok-client

You need to create an account with Ngrok, and then go to your dashboard, Auth and copy your AuthToken. Create ngrok.yml file and paste and save;

sudo gedit /opt/ngrok/ngrok.yml

paste the following, then your authtoken and save;

authtoken: 3***********

Now to start an ngrok tunnel, tell it the protocol (http), subdomain, and port number, and where to find your config file;

./ngrok http -subdomain=qaerialimaging 8000 --config /opt/ngrok/ngrok.yml

So your WebODM instance should now be available at qaerialimaging.ngrok.io.

However once you restart ubuntu your tunnel is lost. To make Ngrok start with Ubuntu you need to make it run as a service, then enable that service at boot. So create a ngrok.service file;

sudo gedit /etc/systemd/system/ngrok.service

And paste in the flowing, then save and exit;

[Unit]
Description=Share local port(s) with ngrok
After=syslog.target network.target

[Service]
Type=simple
Restart=always
RestartSec=1min
StandardOutput=null
StandardError=null
ExecStart=/opt/ngrok/ngrok start --all --config /opt/ngrok/ngrok.yml
ExecStop=/usr/bin/killall ngrok

[Install]
WantedBy=multi-user.target

We also need to tell it which tunnels to add when Ngrok starts, so edit the ngrok.yml config file;

authtoken: 3***********
region: eu
tunnels:
  qaerialimaging:
    proto: http
    addr: 8000
    subdomain: qaerialimaging

Note I’ve added a region, changing the web address to qaerialimaging.eu.ngrok.io. You can add additional tunnels here up to your max per client. I run plex so have added the local web page to it.

Finally we need to enable ngrok at boot, and start it running;

sudo systemctl enable ngrok.service
sudo systemctl start ngrok.service

Now your tunnel address should be available at your dashboard on the ngrok website, or by typing the address into your browser. If you’ve paid for basic tier or higher then you can reserve your most common addresses as well, so others cant use them on your downtime.

Remember to start WebODM using the -nodebug option if you give it access to the internet.

For example, heres a link to a sample job I did last year; Abandoned Church

This is how I got ngrok running. I’m no web developer so I might have missed something so I’m open to recommendations!

2 Likes