I love open source, and I love self hostable software.   People constantly try to justify using proprietary software, and subscription model only software, and honestly, none of it can actually be justified to me.

Open Source gives insight into what's going on in the background, and allows (when wanted / needed) for audits.  Audits for security, for safety, good coding standards, old / deprecated code snippets, librarires, and APIs.  It just makes it sooooo much better overall.

Security through obscurity is a fool's errand.  You can make an argument that something is more secure because the code isn't right there for everyone to see.  In fact, pretty much anyone in the cyber security world can make exactly the opposite argument.

As for subscriptions, I really don't mind a subscription pricing of a SaaS solution.  Servers cost money, upkeep and maintenance take someone's time, bandwidth (sadly) costs money.  So charging a small amount for this makes complete sense.  The part I don't like about subscriptions is for proprietary software that I don't at least have the option to 1. own, and 2. run myself on my own system if I want to.

Trango - Another Great Solution

I stumbled upon Trango Self Hosted a while back, and have been wanting to get it setup, and do a video on it for a while.  It's really a very nice little piece of software, and works a lot like SnapDrop that I covered a few videos back.  

Once it's setup, even with a Public URL, it only shows you people on your local network (LAN).  Now, you can probably fool it if you really want to, but the idea is that you can keep your communication local.  For businesses, families, universities, and so much more this makes such an amazing concept.  

Installing Trango

What you Need

  1. Docker-CE installed and ready to go.

I use Docker on Ubuntu, but you can use it on any system you prefer.  I use a very simple script (below) to install everything you need, but you can also just take the items in the script line by line, and run them in your terminal.

2. NGinX-Proxy-Manager (NPM) Installed before Trango

NPM provides a way to have a fully qualified domain name (FQDN) like callme.thisismydomain.com, and to have LetsEncrypt SSL certificates that give us an HTTPS connection (which mobile devices have to have for WebRTC stuff).

3. A Domain Name you want to use to access your server.

If you don't have a domain name registrar yet, then I highly recommend Hover.  I use their service, and it is really nice.  Easy to use, and lots of features.  There are other options out there as well, so feel free to choose whoever you want, just make sure you can create a DNS A-Record with whoever you pick.

Best Order of Operations:

  1. Get a domain name you like. For our purposes, I'll use myhomenetwork.com, but you'll want your own.
  2. Install Docker-CE
  3. Install NPM on Docker

Install Docker-CE on Ubuntu

#!/bin/bash

sudo apt update

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# keep this line for Ubuntu 18.04 and remove the 20.04 line below
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

# keep this line for Ubuntu 20.04 and remove the 18.04 line above
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

sudo apt update

apt-cache policy docker-ce

sudo apt install docker-ce -y

# add current user to docker group so sudo isn't needed
sudo usermod -aG docker ${USER}

# install docker-compose
sudo apt install docker-compose -y

You can either run the above line by line (ignore the #!/bin/bash line), or copy the whole thing into a file, and name it something like docker_install.sh.

Make sure to remove the line indicated for the version you aren't running (either 18.04 or 20.04).  

Once saved, you can run the entire thing in one go with the command:

. ./docker_install.sh

Install NGinX Proxy Manager on Docker

I have a Video just for this topic, so I'll put it below. But essentially, you want to create a new directory:

mkdir npm

Move into that directory

cd npm

Now create two files:

nano config.json

And in this file put the following:

{
  "database": {
    "engine": "mysql",
    "host": "db",
    "name": "npm",
    "user": "<your desired username>",
    "password": "<a strong password>",
    "port": 3306
  }
}

Save and exit this file with CTRL+O then Enter / Return, then CTRL + X

Now make a second file:

nano docker-compose.yml

And put this into that file:

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./config.json:/app/config/production.json
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
  db:
    image: 'jc21/mariadb-aria:10.4'
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: '<username from config.json>'
      MYSQL_PASSWORD: '<strong password from config.json>'
    volumes:
      - ./data/mysql:/var/lib/mysql

Make sure to replace the items with < and > around it in each file, and that the username and passwords in each file match.

Now run the command:

docker-compose up -d

Give it a minute to pull down everything, and get started, and then in your browser go to the IP address of your server.  You should get a Congratulations screen.

if you go tot he IP address at port 81 (Example: http://192.168.1.x:81), you'll be prompted to login to NPM.

Default credentials are:

username: admin@example.com
passwrod: changeme

Make sure to update the email and password, from the default values, then log out, and back in using the new values you entered.

Install NGinX Proxy Manager

Congratulations, NGinX Proxy Manager is installed and running.  

Installing Trango itself

Now to the Meat of it all.  Now, we just need to run a fairly simple docker command to get Trango installed and setup, but there are a couple of caveats I want to explain as we go.

The command we want to run is:

docker run -d -p 9045:80 -p 9046:443 --name trango tak786/trango-self-hosted

-d = run it in the background as a daemon.

-p = set my host port and map it to the container port => host 9045 to container 80.

-p = set my host port and map it to the container port => host 9046 to container 443.

--name = name the container "trango"

tak786/trango-self-hosted = use the image I specify.

I map 9045 and 9046 on my host because NPM uses 80 and 443 already, which is what we want.  You can choose any ports you desire, as long as they aren't already in use on your host.  

Remember, left side is host, right side is container.  Adjust the host port, not the container port.

Now, after you give it about 30 seconds, try to access the Trango main page by going to the IP address of the host machine, and the port you mapped to the container port 443.  This is just an initial test to ensure Trango is up and running.

In my case, I would go to https://192.168.7.125:9046.  You should, of course use the IP of your host machine, and the port you used (if you didn't use the same port as me).  

As long as you see the main Trango page, you should be good.

It should look like what you see above.  NOTE: You may get an SSL Warning from the browser, so you'll have to accept that and move forward to see this.

Now, you can use this just as it is on Windows, MacOS, and Linux through your browser, but each machine will have to accept the Self Signed Certificate.  

If you'd like to use this on your movile devices using Android and iOS, then you'll need to also create a proxy with a LetsEncrypt certificate.

Trango from NGinX Proxy Manager

Hopefully by now you've setup a domain name (if you didn't already have one).  What we want to do is setup a Sub-domain on that domain name to point to your home public IP address (or your VPS, wherever you're running your Trango install).

To do this, you want to create an A record in yoru DNS management interface for your registrar.  I made an A record and entered the name "callme", and put in my home's Public IP address for the IP.  You can get your public IP address by visiting http://ipchicken.com.

With this A Record created, I now have a domain callme.myhomenetwork.com that points to my home public IP.

We aren't done, but getting close.  Now, we need to forward 2 (two) ports on our router, so when the request comes in for my trango page, it will be passed properly.  We need to forward ports 80, 443 to the host machine that is running NGinX Proxy Manager.

I can't cover all the routers out there, so you'll need to look up how to forward ports for your router make and model if you don't know how already.  

Once those ports are forwarded to your NPM machine, you'll want to create a new Host record in NPM itself.  

Under Hosts, click Add Host, and in the Details tab, you'll enter your sub-domain FQDN (for example callme.myhomenetwork.com), then press enter.

Next, change HTTP to HTTPS in the drop down, and then put in the IP address of your docker0 interface.  If you don't know the IP of the docker0 interface,  you can find it with this command:

ip addr show docker0

Usually the IP is 172.17.0.1

Enter the docker0 IP, then for the port enter the host port we entered for the 443 mapping (in my case I used 9046), so I'll enter 9046 into that field.

Enable Websocket Support for the entry with the switch, then click Save.

Now, just click the entry in the list to open it in a new tab, and make sure you get to the Trango page (again, you may have to accept the Self Signed Cert, but we'll fix that shortly).

If you get to Trango, great!  Now let's get a proper SSL certificate.  Click the 3 dots at the right endo fhte Host entry row, then select 'Edit'.

Now, move to the SSL tab.  Select 'Request a New Certificate' in the first dropdown field.  Enable the 'Force SSL' option.  Enter your email address, and Agree to the LetsEncrypt Terms of service.

Click Save, and be patient.  It may take a few seconds to a couple of minutes for LetsEncrypt to verity the URL and access to it.  

If the dialog goes away with no errors, you should be set.

Click the URL int he row, and it should open your Trango install in a new tab with SSL enabled.

Now, you should be able to reach Trango from your desktop and mobile browsers.  

Congratulations, you did it!