Running another server on WebThing Gateway

Hi Team,

Thank you for the wonderful gateway. I just stumbled upon this and it looks great!
I have a question. While tinkering around with the gateway, in one of the usecase, I needed some custom things to be done on my RPi. Hence I wrote a simple server accepting HTTP requests in NodeJS.
However, this server is only accessible via the local IP and not the Remote Gateway access URL.

Can you please help me out what changes do we need to do in case I want to run a webserver accessible via the remote gateway access url? It will be running on some other ports as 8000/8080 is used by Mozilla Gateway.

Abhijit

Hi Abhijit,

As I understand it the tunnelling service only tunnels ports 80 and 443 (which are locally forwarded to the gateway web server running on ports 8080 and 4443 using IP tables).

It’s not possible to run multiple web servers on the same port.

It may be possible to configure some kind of proxy server (e.g. nginx) to run on port 80 and have it forward requests to the gateway server and your own web server configured to run on different ports.

What exactly is it that you’re trying to do? We’re working on a new type of add-on called service add-ons which may enable you to expose additional resources through the built in web server, which could help in future.

Ben

the service add-ons sound very interesting, would that allow me to add a graphql like middleware* to the express server?

I would like to access the db through the controllers (e.g. call getThings) and send that response from a graphql resolver.

@benfrancis
Let’s say if I want to develop some new APIs for the gateway, I’d like to run a new server(on some other port, say 8082) so that I can access my APIs without modifiying the gateway code so that it does not get erased on gateway updates.

Can you suggest any other way?

whaat exactly are you facing?/

@abhijit.nathwani We’re very early in the process of defining what service add-ons are, so I don’t have a great answer to whether that would be possible.

In the meantime you can certainly run your own servers on your Raspberry Pi alongside the WebThings Gateway, though they will not be accessible over the tunnelling service.

Alright thanks for the info on this @benfrancis.

Abhijit