Giter VIP home page Giter VIP logo

sauertracker's Introduction

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.

Written in ECMAScript 6, the new version of JavaScript, and transpiled to ECMAScript 5 using Babel. nde Powered by NodeJS, Pug (Jade), Sass, PostgreSQL, and Redis.

Important

The build process in this branch is broken. It was migrated from Gulp to Webpack, but the front-end JS could not be ported. A new front-end is being worked on, but in the meantime, this branch provides you with a precompiled set of assets that works.

Requirements

Node.js (tested on v6.10.3)
PostgreSQL (tested on v9.4.12)
Redis (tested on v4.0.6)

Configuration

There are 2 configuration files: config.json and vars.json.
config.json contains server-side only options, whereas vars.json is shared between the client and the server.
An example configuration is included in config.default.json. You must rename it to config.json before proceeding.
You will also need an (empty) PostgreSQL database. You can configure the connection URL in config.json.
To learn more, read the configuration file's wiki page.

Installation

# Clone the repository
git clone https://github.com/AngrySnout/SauerTracker
cd SauerTracker
# Install the dependencies
npm install
# Build the Tracker
npm run-script build

Upgrade

# Pull the repository
git pull origin master
# Update the dependencies
npm install
# Rebuild the Tracker
npm run-script build

Running

# Start it using forever, so it restarts automatically when it crashes
npm start
# Manually restart it
npm restart
# Or shut it down
npm stop

Docker

# Clone the repository
git clone https://github.com/AngrySnout/SauerTracker
cd SauerTracker
# Start SauerTracker
docker-compose up -d

Importing an Old Database

# If you don't have a dump file already, create one using
pg_dump SauerTracker > dump.sql
# Then put this file in the root directory, edit docker-compose.yml and uncomment the line
# - ./dump.sql:/docker-entrypoint-initdb.d/init.sql:ro
# Start only the database
docker-compose up postgres
# Wait for the import to finish then press CTRL+C to shut it down, recomment the line, and
# start SauerTracker
docker-compose up -d

Development

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

The Tracker

Then you simply run

gulp

in the root directory, which watches all files for changes and build them accordingly.

To run the Tracker, run

node index.js

in the root directory.

The Tracker has he following file tree:

  • assets * api/v2/schemas - Contains all JSON schemas for API v2. * fonts, images - Static files that don't frequently change. * js - Browser-side transpiled JavaScript files. * styles - CSS style files.
  • build - Where all transpiled server-side JavaScript files reside.
  • migrations - Database migrations.
  • src - The core of the tracker. This directory contains all server-side JavaScript code.
  • test - Tests for the src directory.
  • website * js - Client-side JavaScript files. * styles - Sass styles. * views - Webite views, written in Pug.
  • tracker.default.json - Default configuration file.
  • vars.json - Various variables used by the Tracker.
  • ...

The database

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:

knex migrate:latest

Documentation

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.

FAQ

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.

License

GNU General Public License v3.0

sauertracker's People

Contributors

ancientogro avatar angrysnout avatar jeanqussa avatar sauerbraten avatar void-foo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sauertracker's Issues

n+1 problem

I'd like to graph my performance in Venice. This requires me to get my kills from every venice game. To do this I need to do 1 api call to /api/games/find to get all my venice games..

and then an additional 730 api calls to /api/game/{id} to get the kills from each game. Now since I like your services, I decided to not spam your server with these requests, and just ask you here if there is a better way to do this. In case you have some way of providing me this data: ign = RED|skimmet
I'm looking for all games with serverdesc=venice

Thank you very much. :D

Site is SLOW

The site is terribly slow. Takes me 5 minutes to get anything looked up.

Original Colors in descriptionStyled

Hi, this is more a style suggestion than an issue...
Since descriptionStyled returns the server description and the colors, how about putting exactly the same color values โ€‹โ€‹as the ones from Sauer?

descriptionStyled
Small change, but I think it will be more readable :D.

#40ff80 green
#60a0ff blue
#ffc040 yellow
#ff4040 red
#808080 grey
#c040c0 purple
#ff8000 orange

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.