Przeglądaj źródła

Merge branch 'master' of https://git0.fmf.uni-lj.si/studen/websocket

NIX Worker 2 lat temu
rodzic
commit
eb2d2dcd07
1 zmienionych plików z 35 dodań i 10 usunięć
  1. 35 10
      README.md

+ 35 - 10
README.md

@@ -1,4 +1,6 @@
-### Installation
+# Installation 
+
+## Server and client
 
 After cloning, virtual environment with python3 needs to be created.
 
@@ -10,24 +12,42 @@ source ~/venv/socket/bin/activate
 pip install -r requirements.txt
 ```
 
-Update `serviceScripts/env.sh` to point to correct IPs. For a server, IP is available as
+## Server side
+
+### ID associated with websockets
+
+Normally, the designated user is `nixWorker`, and should be created if not present. `nixWorker` requires credentials to access the database (username, password) which should be provided in its `.labkey/server.json` file, refer to `labkeyInterface` documentation. Also, websockets will require `nixSuite` to be installed and pointed to by `.labkey/setup.json`.
+
+### Firewall
+
+Script `open_port.sh` will program the firewall on server side to limit websockets to only work for a limited number of clients. Both server and client ip need to be provided in `serviceScripts/env.sh`.
+
+To find IP address, run
+
 ```bash
 ip add show
 ```
-Select the ip with interface that has the highest probability that it points to a physical interface. In most systems this is eth0.
 
-Run `open_port.sh` to modify firewall to accept connection on the designated port.
+Select the IP address with interface that has the highest probability that it points to a physical interface rather than a docker connection. In most systems this is eth0.
 
-Run `start.sh` to start the server. Look for output/log at `$HOME/logs/socketServer.log`.
+The same call can be done on all clients that will be allowed to connect.
 
-### Debugging
+Run `sudo open_port.sh` to modify firewall to accept connection on the designated port.
 
-#### Testing
+Run `serviceScripts/start.sh` to start the server. Look for output/log at `~/logs/socketServer.log`.
+
+## Client side
+
+No install is required. No dependencies, since all communication is text only.
+
+## Testing
+
+### Client side
 
 ```bash
 ~/software/venv/socket/bin/python send.py server:TEST:1
 ```
-
+### Server side
 
 #### Open port
 
@@ -43,10 +63,15 @@ This address should be added to the `$IPCLIENT` address list in `env.sh` for `op
 
 #### Allowed origins
 
-Websockets further limits allowed connections to clients listed in `websocketServer.py`. The origin is part of the `send.py` makeup - adjust it so that `websocketServer.py` will take it as trustworthy. 
+Websockets further limits allowed connections to clients listed in `websocketServer.py`. The origin is hardcoded as a single name in `send.py` and as a list in `websocketServer.py`. For the communication to work, the name from `send.py` should be a member of the `websocketServer.py` list.
 
-The error associated with mis-configuration is 
+The error associated with mis-configuration of origins is:
 
 ```bash
 websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 403
 ```
+
+# Features
+## Concurrence
+
+Websocket will respond to any call submitted to the server with a separate invocation of the handler. This means that submitting multiple jobs will result in concurrent execution of all jobs, which might bog down the server. Websocket itself won't deal with scheduling, but the handler in `websocketServer.py` could be rewritten to delegate job handling to scheduler such as torque or slurm, should one run on the server.