Menu

Developer Install

Dave Drouin

Installing a developer environment is actually far less involved than a full deployment install. You just need to download the code, run the setup for the pykb library and create a few directories. There's a debug mode that'll enable you to examine the variables and execute arbitrary code at any level in a stack trace to help in debugging a crash.

Install a database engine if you've yet to do so pf course. Choose PostgreSQL, MySQL or both. For PostgreSQL just follow the instruction for the production install for that portion: [Step by Step Killboard Installation Instructions]. You'll need to run the sql scripts to install the database schema, data and aggregation stored function. However since your database will be tiny, you don't really need to do the extra stuff to increase the memory, buffers etc for PostgreSQL from the defaults. So you can skip the shmmax stuff and postgresql.conf edits. You do still have to adjust the pg_hba.conf file though.

The uWSGI, Nginx, Varnish and fail2ban instructions can all be skipped. You also do not have to use virtualenv - you can just install pykb into your main python location if you want.

The crontab stuff is optional when developing too - you can just run the aggregate updates manually once in a while. Although it is important to run the aggregate updates before more than say ~3,000 kills are added / updated otherwise it'll take quite a while. That's why it runs every 2 minutes in crontab.

So grab the code:

sudo apt-get install mercurial
hg clone ssh://ddrouin@hg.code.sf.net/p/pykb/code pykb-code

Add these dependencies in case you don't already have them:

sudo apt-get install libyaml-dev
sudo apt-get install libpq-dev python-dev
sudo apt-get install libxml2-dev libxslt-dev

Run the setup in pykb-code

python setup.py install

There's a default config file in pykb-code/pykb/conf - just use that and edit as needed. Although the web app, liquidkb.py will expect it to be elsewhere so if you'll be running that then it'll be less of a hassle to just copy there and edit that one instead:

/etc/liquidkb/pykb.yml

Create this directory: /tmp/Mako for storing cached compiled templates. Then install the modification for flask to support mako:

sudo apt-get install git-core
git clone https://github.com/tzellman/flask-mako/
cd flask-mako
python setup.py install

That should be it.

Now you can cd to the web directory and run the web app. It'll be served on http://localhost:5000

cd pykb-code/web
python liquidkb.py

You can turn on debug mode in the pykb.yml as well. Be sure to check that file to verify that the right database parameters are present. Uncomment the MySQL or PostgreSQL sections as applicable (but not both!)

If you install uWSGI and use that to run the web app then create /tmp/mako as well since the mako templates will go there instead of /tmp/Mako to avoid clobbering those created when running under werkzeug.

If you want to contribue some code please be sure to adhere to the Python programming style guidelines: http://www.python.org/dev/peps/pep-0008/ 4 space indentation - no tabs, terminate lines with \n not \r\n (Windows) or \r (Mac). 79 characters per line max and so on.


Related

Wiki: Home
Wiki: Step by Step Killboard Installation Instructions

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.