<commit_before># NoGameSpy-Vietcong

[![Build Status](https://travis-ci.org/garncarz/nogamespy-vietcong.svg?branch=master)](https://travis-ci.org/garncarz/nogamespy-vietcong)
[![Coverage Status](https://coveralls.io/repos/github/garncarz/nogamespy-vietcong/badge.svg?branch=master)](https://coveralls.io/github/garncarz/nogamespy-vietcong?branch=master)

Crawls servers hosting multi-player game and saves information via ORM into DB.
Acts as an alternative master server.


## Installation

Needed: Python 3

`pip install -r requirements.txt`

`./setup.py build`

`alembic upgrade head` (needs to be rerun every time a DB migration is released)


## Usage

`PYTHONPATH=build/lib.linux-x86_64-3.6 ./app.py --help`
(the exact `lib*` subdirectory name depends on the version of Python)


## Development


`alembic revision [--autogenerate] -m "<migration message>"` (creates a new DB migration)

`./test.sh` (runs tests and also generates a coverage)


## Docker

`docker build -t nogamespy-vietcong .`

`docker run -it nogamespy-vietcong bash`

`docker run -it -v <local volume path>:/app/volume nogamespy-vietcong ./app.py --help`<commit_msg>Readme: Docker user usage.<commit_after># NoGameSpy-Vietcong

[![Build Status](https://travis-ci.org/garncarz/nogamespy-vietcong.svg?branch=master)](https://travis-ci.org/garncarz/nogamespy-vietcong)
[![Coverage Status](https://coveralls.io/repos/github/garncarz/nogamespy-vietcong/badge.svg?branch=master)](https://coveralls.io/github/garncarz/nogamespy-vietcong?branch=master)

Crawls servers hosting multi-player game and saves information via ORM into DB.
Acts as an alternative master server.


## Usage

Needed: Docker

If you want to overwrite settings or persist a SQLite database (but PostgreSQL/MySQL can be used as well),
create your local volume directory (`$VOLUME`).
The application will use `db.sqlite` and `settings_local.py` from this location.

Ports used are:
- 28900 TCP for the master server (game clients fetching the server list)
- 27900 UDP for the heartbeat service (game servers introducing themselves)

DB schema creation:
`docker run -it -v $VOLUME:/app/volume garncarz/nogamespy-vietcong ./app.py --create-db-schema`

Master server:
`docker run -it -v $VOLUME:/app/volume -p 28900:28900 garncarz/nogamespy-vietcong ./app.py --master`

Heartbeat service:
`docker run -it -v $VOLUME:/app/volume -p 27900:27900/udp garncarz/nogamespy-vietcong ./app.py --heartbeat`

Pull new servers from Qtracker:
`docker run -it -v $VOLUME:/app/volume garncarz/nogamespy-vietcong ./app.py --new`

Refresh servers (players, maps, etc.):
`docker run -it -v $VOLUME:/app/volume garncarz/nogamespy-vietcong ./app.py --refresh`


## Development

Needed: Python 3, Docker

Optionally: PostgreSQL or MySQL

`pip install -r requirements.txt`

`./setup.py build`

`alembic upgrade head` (needs to be rerun every time a DB migration is released)

`PYTHONPATH=build/lib.linux-x86_64-3.6 ./app.py --help`
(the exact `lib*` subdirectory name depends on the version of Python)

`alembic revision [--autogenerate] -m "<migration message>"` (creates a new DB migration)

`./test.sh` (runs tests and also generates a coverage)

`docker build -t nogamespy-vietcong .`

`docker run -it nogamespy-vietcong bash`

`docker run -it -v <local volume path>:/app/volume nogamespy-vietcong ./app.py --help`
{'fraction_non_alphanumeric': 0.12635054021608644, 'fraction_numerical': 0.013205282112845138, 'mean_word_length': 4.5365448504983386, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5573686', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1153, 'n_words': 333}