FreeTAKTeam / UI

FreeTAKServer Web User Interface project
MIT License
30 stars 29 forks source link

UI unable to Connect FTAK Server #20

Closed aaron1uk closed 2 years ago

aaron1uk commented 2 years ago

Yesterday I was experimenting with Free TAK Server in AWS, I currently have it setup so it accessed by it's public IP, I have setup the correct security group rules evidenced by the fact that I am able to connect from my Andriod Device App. The problem is with the UI, I am able to accesses and login with the default admin credentials however UI App is unable to communicate with the FTAK server.

Firefox Console reports a CORS issue, Chrome Console reports Connection Refused.

Just to be clear apps are running on same server and I used the first start wizard to setup.

I have experimented with the config.py currently I have:

# this IP will be used to connect with the FTS API
IP = 'Set as local IP Server is FTAK Running on'
# the public IP your server is exposing
APPIP = '0.0.0.0'

I think this may be the problem, where I have tried to set APPIP to the public IP I am using however I am unable to as I am unable to start the UI as I receive the following error:

File "/usr/local/lib/python3.8/dist-packages/FreeTAKServer-UI/run.py", line 107, in <module>
    wsgi.server(sock = eventlet.listen((app_config.APPIP, app_config.APPPort)), site=app)
  File "/usr/local/lib/python3.8/dist-packages/eventlet/convenience.py", line 78, in listen
    sock.bind(addr)
OSError: [Errno 99] Cannot assign requested address

I'm hoping this is a bug and I've not missed something vital in the Documentation.

cfsm-simr commented 2 years ago

I have a similar issue, also running FTS on AWS. Have you managed to solve the problem? Where did you see that error message? My WebUI appears to start with no errors but once I log in to the web UI using the default credentials, an error appears at the bottom of the screen saying "Sorry, there seems to be an error with the connection!".

I think I have followed the documentation correctly, the only place I was unsure was when the documentation says "add a new system user" but I don't know how to, and the WebUI won't let me add a new system user becuase I can't get it to work (perhaps becasue there isn't a new system user!).

cfsm-simr commented 2 years ago

I think I've managed to recreate the sock.bind error. In config.py, if I set APPIP to my AWS public IP, I get that error. If I set APPIP to my private IP (the address given to Eth0) then I don't get that error.

Let me know if you manage to get past that error and then if you bump into the same one I have; "Sorry, there seems to be an error with the connection!".

mattloretitsch-od commented 2 years ago

I seem to be having the same trouble deploying to an Azure instance. I got it working here in my home lab, but no go in the cloud. I did have to use my eth0 address for the UI to start, but same thing. Looks good, but fails when trying to connect.

mattloretitsch-od commented 2 years ago

Update on what I have found so far. If you watch all of the network connections from your browser, you can see the problem. It's trying to open a socket to the private 10.xxx address of my vm in Azure.

GET | http://10.2.0.4:19023/socket.io/?EIO=3&transport=polling&t=NnwPwfc

mattloretitsch-od commented 2 years ago

Got it! This didn't make sense to me at all, but seems to work. I had to change the IP to my public address. to 10.2.0.4 is my internal vnet address of the VM.

   # this IP will be used to connect with the FTS API
    IP = '52.170.xxx.xxx'

    # Port the  UI uses to communicate with the API
    PORT = '19023'

    # the public IP your server is exposing
    APPIP = '10.2.0.4'

    # webmap IP
    WEBMAPIP = "10.2.0.4"

    # webmap port
    WEBMAPPORT = 8000

    # this port will be used to listen
    APPPort = 5000
cfsm-simr commented 2 years ago

Bingo! Good spot with the GET request. I've changed my setup and now got it working. I think the commenting is slightly misleading. It perhaps makes sense if the idea was to have a local FTS-UI and a local web client both connecting to a remote, public-facing FTS. Thanks a lot for your help.