This is the Lynchburg Server. It provides the game API backbone and a http frontend accessible
to all participants via smartphone or PC. The Unity game client will connect to and communicate with
this server automatically. You need to host an instance of this server yourself, as the creators of
Lynchburg do not provide an "official" server.
to all participants via a smartphone or a PC. The official Unity game client will connect to and communicate with
this API automatically. You need to host an instance of this server application yourself, as the creators of
Lynchburg do not provide an "official" server for public use.
This is a web2py application (python3). web2py is an open-source webframework available
at http://www.web2py.com/
#### License
The Lynchburg Server is licensed under the AGPL 3.0 License. For more information check the [LICENSE](/LICENSE) file.
For information about contributers goto the [Project Lynchburg landing page](https://git.noc.ruhr-uni-bochum.de/lynchburg/lynchburg-page)
#### Installation
There are two ways to install the server:
1) Hard: Cloning this repo and installing it manually step-by-step making sure everything works including websockets
1) Easy: Using the [Dockerfile](https://git.noc.ruhr-uni-bochum.de/lynchburg/lynchburg-docker). (Follow the link for docker instructions)
1) Hard: Cloning this repo and installing it manually step-by-step while making sure everything works (including WebSockets)
1) Easy: Using the [Dockerfile](https://git.noc.ruhr-uni-bochum.de/lynchburg/lynchburg-docker)
##### Manual installation
1) Make sure python3 is installed on your system and in your $PATH
1) Install the ``tornado``python module
1) Download web2py (the latest "source code" version for "normal users") and extract it.
1) Make sure ``python3`` is installed on your system and in your $PATH
1) Install the ``tornado``Python module
1) Download web2py (recommended is the latest "source code" version for "Python 3.x") and extract it.
1) Open the ``applications`` folder and clone this repo into it using ``git clone git@git.noc.ruhr-uni-bochum.de:lynchburg/lynchburg-server.git lynchburg``.
1) Make sure you follow all steps of the "Starting the Websockets server" section.
1) Start web2py using ``python3 ./web2py.py -a <admin_pw> -i 0.0.0.0 -p 80`` to start the server on all interfaces port 80.
1) You should now be able to see the admin interface on ``/`` and the Lynchburg web application on ``/lynchburg``
1) Start the WebSockets as described in the appropriate section.
1) Start web2py using ``python3 ./web2py.py -a <admin_pw> -i 0.0.0.0 -p 80``. It will start the server with an admin password of your choice on all interfaces on port 80 (port 80 requires root privileges on Linux hosts).
1) (Optional) Start the web2py Scheduler as described in the appropriate secion.
1) Veryify that it works by browsing to the admin interface at ``/`` and the Lynchburg web application at ``/lynchburg``.
#### Websockets
To communicate with the player clients directly the server uses Websockets. To make this communication works, you have to also start the Websockets server that web2py comes with and run it on port ``8888``.
Make sure (as is the default) that the ``app.rproxy`` setting in [private/appconfig.ini](private/appconfig.ini) is set to ``false``, if you want to access the Websockets server directly.
If you plan to use a reverse proxy, set ``app.rproxy`` to ``true`` and route the http traffic to ``/realtime``to the port 8888 with a connection upgrade.
To communicate with player clients directly, the server uses WebSockets. To make this communication work, you have to also start the WebSockets server that web2py comes with and run it on port ``8888`` (this port can not be changed).
Make sure - as is the default - that the reverse proxy setting ``app.rproxy`` setting in [private/appconfig.ini](private/appconfig.ini) is set to ``false``, if you want to access the Websockets server directly.
If you plan to use a reverse proxy, set ``app.rproxy`` to ``true`` and route the http traffic to ``/realtime``on port 80 to 127.0.0.1 on port 8888 (this can not be changed). Nginx requires a connection upgrade for that.
##### Starting the Websockets server:
##### Starting the Websockets server
1) Create a file called ``websocket_key.txt`` in the application folder and insert a alpha-numeric key of your choice.
1) Create a file called ``websocket_key.txt`` in the web2py root folder (The same folder web2py.py is in. NOT your application root folder) and insert a alpha-numeric key of your choice.
1) Copy the ``websocket_messaging.py``into the root folder of web2py (The same folder web2py.py is in. NOT your application root folder)
1) Copy the ``websocket_messaging.py``from the ``gluon/contrib`` folder into the web2py root folder (The same folder web2py.py is in. NOT your application root folder)
```
cp ./gluon/contrib/websocket_messaging.py ./
```
...
...
@@ -49,15 +56,13 @@ If you plan to use a reverse proxy, set ``app.rproxy`` to ``true`` and route the
python ./websocket_messaging.py --help
```
In case the ``websocket_messaging.py`` file is still broken for python3.8 and newer, try using the modified version
from the [Lynchburg Docker repository](https://git.noc.ruhr-uni-bochum.de/lynchburg/lynchburg-docker/-/blob/master/files/websocket_messaging.py).
#### Scheduler
Workaround: In case the ``websocket_messaging.py`` file is still broken for python3.8 and newer, try using the modified version
from the [Lynchburg Docker repository](https://git.noc.ruhr-uni-bochum.de/lynchburg/lynchburg-docker/-/blob/master/files/websocket_messaging.py). (This Modification is under the LGPLv3 license as per web2py LICENSE)
web2py has an internal scheduler feature. The Lynchburg Server makes use of that feature for some maintanance function. Alltough setting up the scheduler is optional, it is recommended as
it provides a better user experience. When everything else is started accordingly enter:
#### Starting the web2py Scheduler
web2py has an internal scheduler feature. The Lynchburg Server makes use of that feature for some maintanance function. Alltough setting up the scheduler is optional, it is recommended as it provides a better user experience. When everything else is started accordingly enter:
```
python ./web2py.py -K lynchburg
python3 ./web2py.py -K lynchburg
```
to start a scheduler process. (Note: If you rename the application change ``lynchburg`` to the new name accordingly)
\ No newline at end of file
to start a scheduler process. (Note: If you rename the application, change ``lynchburg`` to the new name accordingly)