forked from antzucaro/XonStat
-
Notifications
You must be signed in to change notification settings - Fork 15
/
install-instructions.txt
92 lines (77 loc) · 3.47 KB
/
install-instructions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
0) preparation
==============
# create system user “xonstat” with random password. it will be used to run the website
sudo adduser xonstat
1) feeder
===========================
# the feeder is a nodejs application which connects to QL servers,
# optionally saves match data as .json.gz files and
# optionally reformats and forwards the data to the XonStat python HTTP server
# I am using Ubuntu 15.04 for this, with the wily/universe repository
# On Ubuntu 14.04 installing npm caused problems with dependencies (node-gyp, ...)
# but can be installed fine after manually installing node-gyp from wily/universe
sudo apt-get install git # eventually already installed
sudo apt-get install nodejs # eventually already installed
sudo apt-get install npm # eventually already installed
sudo apt-get remove libzmq-dev
sudo apt-get remove libzmq1
sudo apt-get install libzmq3
sudo apt-get install libzmq3-dev
sudo apt-get install libzmq3-dbg
sudo ln -s /usr/bin/nodejs /usr/bin/node # ignore error if there is already a "node" command
# as xonstat user
cd ~
git clone https://github.com/PredatH0r/XonStat.git
cd XonStat/feeder
npm install
mkdir ql-match-jsons
# edit cfg.json for your server list.
# server entries have the format "ip:port/password". hostnames are not allowed.
# the config file can even be edited while the feeder is running. it will automatically re-load the config.
# you can change the logLevel to DEBUG to see any sort of activity on the QL zmq stats ports
nohup node feeder.node.js >>feeder.log 2>&1 &
2) database
============
# as xonstat user
sudo apt-get install postgresql
cd ~
git clone https://github.com/antzucaro/xonstatdb.git
the following steps are described on https://github.com/antzucaro/xonstatdb:
# as root user
su - postgres
createuser -P xonstat # use "xonstat" as password or modify "development.ini" later with the correct password
psql
CREATE DATABASE xonstatdb WITH ENCODING='UTF8' OWNER=xonstat CONNECTION LIMIT=-1;
\q
exit
# as xonstat user
cd ~/xonstatdb
psql -U xonstat xonstatdb
CREATE SCHEMA xonstat AUTHORIZATION xonstat;
CREATE LANGUAGE plpgsql; # ignore error/warning
\i build/build_full.sql
\i ../XonStat/sql/qlstats-init.sql # this is an extra-step to modify the xonstat database for QL
\q
3) python based website
=======================
# some of th
sudo apt-get install python-pip
sudo apt-get install python-dev
sudo apt-get install postgresql-server-dev-9.4 # 9.4 on wily, 9.3 on trusty, ... use "apt-cache policy postgresql" to find the right version
sudo python -m pip install pastescript
# as xonstat user
cd ~/XonStat
mkdir lib
mkdir lib/python
export PYTHONPATH=/home/xonstat/XonStat/lib/python
python setup.py install --home=/home/xonstat/XonStat
# before starting the web server you can edit development.ini e.g. to set the number of required players per team
export PYTHONPATH=/home/xonstat/XonStat/lib/python
nohup paster serve development.ini >>paster.log 2>&1 &
now you can connect to http://<machine-ip>:8080
4) final notes
==============
The feeder sends match data to <machine-ip>:8080/submission.py
There is no built-in security feature that would prevent anyone from the outside calling this script and submit bogus data.
One was of handling this is use a front-facing tool like nginx which forwards all external requests from port 80 to internal port 8080, but blocks the /submission.py URL from external access.
The feeder can still connect using the loopback IP http://127.0.0.1/submission.py