Sauer Tracker 2
Global server and player stats tracking for Cube 2: Sauerbraten.
This is the second iteration of sauertracker.net. It has many improvements over the original Tracker.
Powered by NodeJS, Pug (Jade), Sass, PostgreSQL, and Redis.
Node.js (tested on v6.10.3)
PostgreSQL (tested on v9.4.12)
Redis (tested on v4.0.6)
There are 2 configuration files: tracker.json and vars.json.
tracker.json contains server-side only options, whereas vars.json is shared between the client and the server.
An example configuration is included in tracker.default.json. You must rename it to tracker.json before proceeding.
You will also need an (empty) PostgreSQL database. You can configure the connection URL in tracker.json.
To learn more, read the configuration file's wiki page.
# Clone the repository git clone https://github.com/AngrySnout/SauerTracker cd SauerTracker # Install the dependencies npm install # Build the Tracker npm run-script build
# Pull the repository git pull origin master # Update the dependencies npm install # Rebuild the Tracker npm run-script build
# Start it using forever, so it restarts automatically when it crashes npm start # Manually restart it npm restart # Or shut it down npm stop
For development it is easier to have Gulp and Knex installed globally. This can be achieved with:
npm install gulp -g npm install knex -g
Then you simply run
in the root directory, which watches all files for changes and build them accordingly.
To run the Tracker, run
in the root directory.
The Tracker has he following file tree:
- api/v2/schemas - Contains all JSON schemas for API v2.
- fonts, images - Static files that don't frequently change.
- styles - CSS style files.
- migrations - Database migrations.
- test - Tests for the src directory.
- styles - Sass styles.
- views - Webite views, written in Pug.
- tracker.default.json - Default configuration file.
- vars.json - Various variables used by the Tracker.
The Tracker uses Knex for building queries and handling database interaction. If you wish to make changes to the database schema, you have to create a new migration using:
knex migrate:make migration_name
This will create a new file in /migrations, in which you should put all changes to the schema (more about migrations). When you're done run:
You can use ESDoc to generate documentation. The Tracker's documentation is poor, but should give you an overview of some of the functionality. To generate the docs run the following commands:
npm install esdoc -g esdoc -c esdoc.json
This will create the docs in the /esdoc directory.
What is the point of having Redis as a requirement?
The Tracker uses Redis for persistent cache storage. By delegating caching responsibilities to Redis, restarts and crashes have little effect on the performance of the Tracker.
GNU General Public License v3.0