Localhost and port forwarding


#1

I have (I think) loaded ver 2 onto a RaspberryPi, docker says I have the containers, and I can access the database.

  1. Doing this from home, I don’t have a static IP, but I can fake it out with noip.com giving me DDNS. The problem is in setting up port forwarding on my router, as I don’t know what ports the hosted UI is expecting to communicate with. It would be nice to have some documentation (tell me the answers and I can write it up on the wiki) as to what ports are needed for the UI (80?), and is this http or something else being communicated. It would be nice to have some simple tests that could be run from localhost to check things out.
  2. It would be nice if the hosted UI could take a web address and a port, that way I could set up portforwarding and designate an external port (or ports) that is open, and still route it internally into the correct place. This would possibly allow having multiple food computers (Raspberries); I currently have two Pi’s running, one as a LAMP web host, and the other as a food computer “iron bird” (a term from my old days at MacDonnnell Douglas where the engineers laid out airplane sensors and actuators on steel tables so they could test the electronics on something other that a real airplane).
    p.s.
    @gordonb: you may be seeing my son, Peter Webb on Tuesday while he is out there getting your current system packed up to take to the St. Louis Science Center. I am working with him behind the scenes.

[Help] Unable to Connect to UI
Sensor Programming and Deployment: How To
MVP - Product Design
#2

Having the same needs and happy to help with establishing e.g. a Getting Started tutorial and a test bench / troubleshooting guide


#3

I am answering my own questions here.
It appears that the hosted UI only interacts with the Couchdb, hence only needs port 5984 accessible.
Since my home network doesn’t have a static ip, the fix was fairly simple:

  1. On my router, I set up a static IP (DHCP Reservations) for the OpenAg RaspberryPi so that it always has the same internal address.
  2. On the router, I did a single port forwarding (5984 -> 5984) forwarding anything coming in on the router to 5984 to the internal IP (and port) of my RaspberryPi food computer.
  3. I used no-ip.com to create a DDNS (free DNS service).
  4. I just gave the hosted OpenAg UI my DDNS, and it connected me up (which it had not done before I got the port forwarding for 5984).

There is no need for complex multi port mapping. This works as long as you don’t have multiple food computers all using 5984 for Couchdb.


More Docs: I wrote a PFC2 step-by-step software install guide (edit: these instructions are out of date now)
#4

Since the :5984/_openag aliases to :5000 you would only need to forward to :5984, which you seem to have gotten figured out already :ok_hand:


#5

Hi @webbhm. Thank you for the clear instructions. Any luck running multiple PFC’s on same LAN? Have several “iron horses” here and would like to try the hosted UI before I move to the food server solution.


#6

@seanchoqThere is no problem running multiple food computers on one lan, and you could download the UI and run it locally (putting in your food computer’s private ip address).
The trouble is using the OpenAg UI with more than one. That problem does not currently have a solution. The limitation is that the UI assumes you are using port 5984, and there is no way to change parameter in the current code (which is hosted in gitHub).
Personally I think the UI needs some significant overhaul. All of the charting variables are in a control file in gitHub, so they cannot be changed for a customized build. I think the variables should be a table in the local database, which the hosted UI can read (as it does all the data). That way they could be different for each PFC.
Your dynamic IP cannot be stored in the database, but I don’t see why a port number could not be passed to the UI as the IP is. This would not actually require changing the database port on each PFC, it would only require some twiddling with the port forwarding - multiple ‘public’ ports with each being routed to a different internal IP, but all could have the same port number.

I have not seen any discussion on changing the UI code, but I am sure they would be happy if you wanted to give it a go. :slight_smile:


#7

Would sure like to see local UI on a TFT and some NAT traversal. I need to learn more about UI for this purpose. Any resources are much appreciated.

Two interesting projects attempting similar objective: