[[PageOutline]] = GeniusWebPython Parties Server This is the homepage of the GeniusWeb parties server. This server can provide a list of runnable parties, and create running instances of specified parties on a HTPT GET request. When an instance is made, a websocket link to the running party is provided to the caller. The GeniusWeb main page is [https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWeb here]. The Parties server runs on Tomcat 8. This server behaves almost identical to the java-oriented [https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPartiesServer partiesserver] and in fact is mostly a copy of it. The main difference is that this server can run python parties instead of java-based parties. The only difference is that in this server, instead of java-based parties inside a jar file, you plug in python-based parties inside a tar.gz file. == Installation == * Have a FRESH python **3.8 or 3.9** installed on your machine, for use with the pythonpartiesserver. This must be a full python installation including pip and venv support. We recommend downloading python from [https://www.python.org/downloads python.org], either run an installer or to build the sources. Especially if you build from sources, you can place the python executable anywhere you like, so you can place it where it does not interfere with your standard installation. Some package installers and standard installations (eg ubuntu22) appear to not support pip, venv etc out of the box. Then you need to install support for pip and venv. * Install your apache-tomcat 8 installation ​https://tomcat.apache.org/download-80.cgi. You can re-use an existing installation. * Download the parties server war file from [http://artifactory.ewi.tudelft.nl/artifactory/webapp/#/artifacts/browse/tree/General/libs-release-local/geniusweb/pypartiesserver the artifactory]. Go into the latest version of the pypartiesserver and download (right click) the war file. NOTICE: your browser must have cookies enabled to access the artifactory. * Copy the downloaded war file into the tomcat webapps directory * Set the environment variable PYTHON3EXE to point to python 3.8 or 3.9 (the python application you installed). * (Re)start tomcat Now your local pypartiesserver should be up and running. Note: the pythonpartiesserver installed and runs all parties in a virtualenv. So your installation will stay clean. === Tomcat from apt-get install If you install tomcat with {{{apt-get install}}} instead, then you may have to take additional steps to make this work with the python parties server. Otherwise python can not run properly. The following steps are needed * {{{sudo su -}}} * {{{vi /etc/systemd/system/multi-user.target.wants/tomcat9.service}}} * Under "Security" Change: * {{{PrivateTmp=yes }}} to {{{PrivateTmp=no}}} * {{{ProtectSystem=strict}}} to {{{ProtectSystem=no}}} * Restart tomcat == Upgrade To upgrade, * Stop tomcat * remove the old war file plus the unzipped version (if exists) from the tomcat webapps directory * repeat the installation as above = GUI After installing and starting, go to [http://localhost:8080/pypartiesserver-2.0.0] (replace 2.0.0 with the version you installed). You should get this webpage [[Image(server.png)]] You can click on "The parties list with currently runnable parties" to get [[Image(list.png)]] To create your own parties, refer to [https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/wiki/WikiStart#Writingaparty Writing a party]. == Adding or changing a Party To change a profile or add a new party, * Make sure the profiles server has been run (romcat will unzip the war file) * Locate the unzipped pypartiesserver folder inside your tomcat webapps directory * locate the partiesrepo directory inside that folder. This folder contains all current parties * Copy your new version of a party.tar.gz over an existing one. Or copy a new party.tar.gz into this folder. * The parties should now show up in the "list of party files" on the server webpage. Make sure you force refresh the page as some browsers show only old cached data. * If the file is visible in that list, but does not show up in list of "currently runnable parties" then the tar.gz does not contain a valid party. Check the apache tomcat logs to see why the tar.gz has been rejected. = Log file The log file name can be set by the party in its constructor. If it uses the default (None), then the party class name is used as log filename, and {{{.log}}} as extension. The {{{.log}}} file is in the directory where you start the server If you run from tomcat, it often is in the Eclipse application directory, eg in {{{Eclipse2020EE.app/Contents/MacOS}}}; if you manually start it, in the directory where you executed the startup.sh command; etc. = Debugging Debugging on the server is complicated because python programs are run as native processes, and thus are not directly controlled by your IDE. We recommend debugging directly in [https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython#Debugging GeniusWebPython]. If you really need to debug on the server, you may try [https://coderwall.com/p/ttbtgq/python-remote-debugging-with-pdb remote debugging with pdb], [http://charmyin.github.io/python/2014/11/09/debugger-python-remotely/ remote debugging eclipse] or [https://docs.microsoft.com/en-us/visualstudio/python/debugging-python-code-on-remote-linux-machines?view=vs-2019 remote debug visual studio]. = Communication protocol For the communication protocol of partiesservers, please refer to [https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPartiesServer/wiki/WikiStart#Communicationprotocol GeniusWebPartiesServer documentation] = Source code You can download the source repository of the implementation. Note that you don't need this if you just want to use the parties server to host your parties or to compile parties. {{{svn co https://tracinsy.ewi.tudelft.nl/pub/svn/GeniusWebPythonPartiesServer}}} Since this is a tomcat web application, you need Eclipse Enterprise edition if you want to run this from Eclipse. Also, to checkout from Eclipse, you need to prepare Eclipse for this. Check ​https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWeb/wiki/WikiStart It is maven based so you only need maven to compile the code.