PolaricServer / webapp2

Re-write of client app. Based on OpenLayers 5+
GNU Affero General Public License v3.0
15 stars 4 forks source link

Extend Basic Sample #38

Closed alexander-pick closed 3 years ago

alexander-pick commented 3 years ago

Is it possible to somehow extend basic to speak to the backend? At the moment it seems Basic is just a map and menus, very close to minimal. How to add APRS points from the backend to it? I tried it with the polaric example but it seems broken for some reason and wants to connect websockets instead of port 8081. There are comments that the port should be used but no indicator how it is done.

ohanssen commented 3 years ago

To use the polaricserver-nordic example with your own backend, you need to comment out the following lines:

SERVER("https://aprs.no"); WSPREFIX("ws"); AJAXPREFIX("srv");

Sorry, it was a mistake from my side. I'll check in a update... This example is very close to the setup of aprs.no, so maybe it is a good idea to have a simpler example with a backend. I'll look into it.

alexander-pick commented 3 years ago

Thanks a lot for the quick answer! Is it possible to document the proxy config you are using for the websockets somehow? I want to open the instance to the public but I don't want the config panel public available.

ohanssen commented 3 years ago

To make it public you should of course have some knowlegde of how to set up a web server. It is a good idea to secure it and use TLS/SSL, which require certificates. You also need to decide if you want virtual hosts, other services, etc.. Do I could perhaps write some doc for the Polaric Server setup in particular.

alexander-pick commented 3 years ago

Don't worry, I am quite familiar with webservers ;) I actually I wanted to place it behind cloudflare. But from your description it sounded like you proxy the websockets to a backend server based on these two endpoints in the config (mod_proxy maybe?). And I wanted to get a bit of insight how you build the setup here.

At the moment I configured the entire system to work on my LAN and just use the backend hosted on 8081 by commenting the sockets out, that isn't a suitable solution for a public accessible system.

ohanssen commented 3 years ago

I have started adding some on this in the wiki doc. But I will need some time.. You will need mod_proxy, mod_proxy_http and mod_proxy_wstunnel. I use this for REST API:

    ProxyPass /srv http://localhost:8081 nocanon
    ProxyPass /srv/* http://localhost:8081 nocanon
    ProxyPassReverse /srv http://localhost:8081
    SetEnv  proxy-nokeepalive 1
    ProxyTimeout 180

And this for Websocket.

<Location "/ws/">
   ProxyPass ws://localhost:8081/
   ProxyPassReverse ws://localhost:8081/
   ProxyPreserveHost on
</Location>

I use virtual hosts and SSL and I have made two config files with this proxy setup (one for the https port). You may need some redirects and rewrites to make it work smoothly :)

alexander-pick commented 3 years ago

Thanks that helps me a lot!