diff options
-rw-r--r-- | readme.md | 81 |
1 files changed, 48 insertions, 33 deletions
@@ -1,25 +1,19 @@ Installation ============ -Install the following packages: +These instructions assume you are running Debian Jessie. Install dependencies: - - apache2 - - nodejs (>= 10.0.22) - - python3 (>= 3.4) - - python3-ply - - python3-psycopg2 - - python3-termcolor - - swi-prolog-nox (>= 7.2) + apt install apache2 nodejs npm python3 python3-ply python3-psycopg2 python3-termcolor SWI prolog ---------- -To use the correct SWI prolog package (>= 7.2) on Debian, add a custom +To use the correct SWI prolog package (>= 7.3) on Debian, add a custom repository by creating the file /etc/apt/sources.list.d/prolog.list containing the following 2 lines: -deb http://ppa.launchpad.net/swi-prolog/stable/ubuntu trusty main -deb-src http://ppa.launchpad.net/swi-prolog/stable/ubuntu trusty main +deb http://ppa.launchpad.net/swi-prolog/devel/ubuntu trusty main +deb-src http://ppa.launchpad.net/swi-prolog/devel/ubuntu trusty main After that run the following sequence of shell statements to update the package cache, register the new repository's key, and again refresh @@ -33,44 +27,65 @@ libseccomp ---------- A new version of libseccomp (≥ 2.2) with Python bindings is needed to sandbox -Python interpreters. This is not available yet in most distributions, so fetch -the latest sources with +Python interpreters. This is not available yet in most distributions. You can +download custom-built packages for Debian Jessie at - git clone https://github.com/seccomp/libseccomp + http://codeq.si/libseccomp2_2.2.3-2_amd64.deb + http://codeq.si/seccomp_2.2.3-2_amd64.deb + +and install them using + + dpkg --install libseccomp2_2.2.3-2_amd64.deb seccomp_2.2.3-2_amd64.deb -then build and install it with +Alternatively, fetch the latest sources with - ./configure --enable-python - make - make install + git clone https://github.com/seccomp/libseccomp + +and configure with --enable-python. nodejs ------ -Run "npm install" inside the "web" directory to install all dependencies (they -will be installed inside the "web" directory) +Run "npm install" inside the codeq-server/web directory to install all +dependencies (they will be installed inside the web directory) Settings ======== - - point webroot to codeq-web - - set up reverse proxy for /ws/ to the node server: - - using the command a2enmod enable apache modules: proxy, proxy_http, proxy_wstunnel, rewrite - - add to the apache configuration the following directives: - RewriteEngine on - RewriteCond %{REQUEST_URI} ^/ws/ [NC] - RewriteCond %{QUERY_STRING} transport=websocket [NC] - RewriteRule /(.*) ws://localhost:8083/$1 [P,L] - ProxyPass /ws/ http://localhost:8083/ws/ - ProxyPassReverse /ws/ http://localhost:8083/ws/ - - set problems path via environment variable CODEQ_PROBLEMS (defaults to /var/local/codeq-problems) - - set DB settings via environment variables CODEQ_DB_HOST, CODEQ_DB_DATABASE, CODEQ_DB_USER and CODEQ_DB_PASS +Replace $webroot in this section with the path to codeq-web repo. Remember to +grant read access to $webroot to the apache user. + +Set environment variables: + + CODEQ_PROBLEMS=<path to codeq-problems repo> + CODEQ_WEB_OUTPUT=$webroot/data + CODEQ_DB_HOST=<address of database server> + CODEQ_DB_DATABASE=<database name, default is 'codeq'> + CODEQ_DB_USER=<database user, default is 'codeq'> + CODEQ_DB_PASS=<database password, default is 'c0d3q'> + +Set up apache: + + a2enmod proxy proxy_http proxy_wstunnel rewrite + +Add the following directives to the VirtualHost configuration: + + DocumentRoot "$webroot" + <Directory "$webroot"> + Require all granted + </Directory> + + RewriteEngine on + RewriteCond %{REQUEST_URI} ^/ws/ [NC] + RewriteCond %{QUERY_STRING} transport=websocket [NC] + RewriteRule /(.*) ws://localhost:8083/$1 [P,L] + ProxyPass /ws/ http://localhost:8083/ws/ + ProxyPassReverse /ws/ http://localhost:8083/ws/ Running ======= - first build static JSON data with scripts/build_web_resources.py, read its heading comment for details - - the output of the script must go to the data subdirectory of where you have codeq-web - run the prolog interpreter server: swipl prolog/runner/main.pl - run the session daemon: python3 daemon.py - run the web server for client communication: node web/main.js |