evilru / quake3-vsp-stats

VSP Stats Game Log Processor - updated and working version of vsp-0.45-xp-1.2-full.zip from https://vsp.goquake.com/ as docker image: https://hub.docker.com/r/evilru/quake3-vsp-stats.
MIT License
11 stars 10 forks source link

Are there any plans for a docker image with latest version? #8

Closed Locustv2 closed 3 years ago

Locustv2 commented 3 years ago

Hey, i am trying to find a stats processor for my server running on quakejs. It seems that the latest version of vsp is 0.50. Are you planning to have an update for that?

Also would it be possible to dockerize it so we can just use the image?

evilru commented 3 years ago

Hello!

The version I maintain here contains a fix to support https://www.excessiveplus.net/. It only contains the q3a media files. For more details, please have a look at the readme-xp.txt.

I only maintain compatibility to current php / db versions.

A docker image is a good idea :).

Actually, I have a docker-compose setup for testing in the php8 branch.

Let me think about a possible setup and the required vsp configuration settings.

Locustv2 commented 3 years ago

Does the version that you maintain works with regular baseq3 or other mods on quake?

evilru commented 3 years ago

Yes, it should work with most mods. I use it with osp and ra3.

The baseq3 version has a limitation: https://github.com/evilru/quake3-vsp-stats/issues/5

As you asked about a Dockerimage, I just started on it and have a first work in progress version ready: https://github.com/evilru/quake3-vsp-stats/tree/dockerimage

Locustv2 commented 3 years ago

Cool. the link you provided is a 404 on my side.

evilru commented 3 years ago

Hello, maybe you would like to try this first version of the docker-compose stack.

You should find everything you need in the readme. I will put the Image on dockerhub in the next days.

Please let me know if something does not work for you or if the documentation is hard to understand.

Locustv2 commented 3 years ago

I'll try that hopefully tonight and let you know. thanks

Locustv2 commented 3 years ago

Cool, i managed to do a test.

First test i just spawn the container with the original docker-compose you provided and i added just the volume for the games.log

Game was running and i waited several minutes but nothing on the page.

Then i added the Environment variables for LOGTYPE as well as DB_HOSTNAME and it seem to works. However i noticed that when i go to localhost on my browser, it redirects me to: http://localhost/pub/themes/bismarck/index.php? Is that normal.

Also, is there a way to set the default theme? And if possible parse more than 1 games.log? Or the only way would be to modify the /vsp/docker/import.sh?

Here is my docker-compose template:

version: '3.3'

services:
  db:
    # image: mysql:8.0.23
    image: mariadb:10.5.9
    restart: always
    environment:
      TZ: Europe/Berlin
      MYSQL_ROOT_PASSWORD: pass
      MYSQL_DATABASE: vsp
      MYSQL_USER: devuser
      MYSQL_PASSWORD: devpass
    ports:
      - "3306:3306"
  web:
    image: evilru/quake3-vsp-stats:latest
    restart: always
    depends_on:
      - db
    volumes:
      # - /path/to/your/games.log:/vsp/games.log
      # - /path/to/your/server.gif:/vsp/pub/images/server.gif
      # - /path/to/your/logo.gif:/vsp/pub/images/logo.gif
      - ./customcfg/lms.log:/vsp/games.log
    ports:
      - 8081:80
      # supervisor web gui would be available on port 9001
      - 9001:9001
    environment:
      TZ: Europe/Berlin
      # VSP_WEB_PASSWORD: vspweb
      DB_HOSTNAME: db
      DB_NAME: vsp
      DB_USERNAME: devuser
      DB_PASSWORD: devpass
      LOGTYPE: q3a
evilru commented 3 years ago

If you have multiple servers running, you could add additional config files and calls to the parser as described here: https://github.com/evilru/quake3-vsp-stats/tree/dev#extended-configuration-with-multiple-logfiles

I this what you are looking for?

regarding the redirect: what exactly do you mean? It is expected to do a redirect to the "startpage" I made the pub folder accessible so vsp.php could be called from the web: https://github.com/evilru/quake3-vsp-stats/tree/dev#vsp_web_password I might remove it in the future

I will add a env var for the skin as well.

evilru commented 3 years ago

new env var for settting the default skin https://github.com/evilru/quake3-vsp-stats/tree/dev#default_skin

Locustv2 commented 3 years ago

Ahh yeah that's what i was looking for. thanks.

Well for the redirect, let's say i would prefer for it to be accessible under my domain instead of having the long URL: i.e. the stats page are directly under http://localhost/ or http://localhost/stats instead of having pub/themes/bismarck/index.php?.

If it cannot be done then nevermind. probably the DNS can do the mapping.

evilru commented 3 years ago

I don't see how this could be accomplished without touching the whole application. It is written that way.

the url will be always one of

  1. /themes/bismarck/index.php
  2. /pub/themes/bismarck/index.php

The first one is the way it is meant to be used. The second allows calling /vsp.php from the web and requires the password to be configured.

And I am constantly thinking of changing it to the first variant.

What do you think about it? Is the possibility of having access to the parser from the web valuable to you? I have the feeling that whoever is running the container, can connect to the container and run the parser from the commandline..

Locustv2 commented 3 years ago

What What do you mean by having access to the parser>? and what is the port 9001 for in the compose file?

I am running a server on quake js (where you can play in browser). There were like 6-7 games played already but only 2 were logged. any idea? When i run the cron job manually it ways 6 games parsed but only 2 shows on the website... You can check at: http://locustv2.com:27970/

evilru commented 3 years ago

You can run the game log parser from the browser to check the output: http://locustv2.com:27970/vsp.php it outputs details about the found games

You need to set a password for it to work: https://github.com/evilru/quake3-vsp-stats/tree/dev#vsp_web_password

http://supervisord.org/ is used in the container to start the Webserver and Cron. It has a simple Webinterface which could be accessed on port 9001 if enabled in the image.

Locustv2 commented 3 years ago

I added a password: 123456 what do i need to run?

And how do i enable the webinterface?

Locustv2 commented 3 years ago

Ahh it seems that the game timestamp are always the same. http://locustv2.com:27970/pub/themes/bismarck/gamestat.php?config=cfg-default.php

From where are these timestamp taken? is it generated by vsp?

evilru commented 3 years ago

It looks like the base game does not add a timestamp to the games.log Why not running osp? It adds a timestamp. When quake was active, basically every server did run osp instead of the base game.

Locustv2 commented 3 years ago

i am using this: https://github.com/Locustv2/NoGhost Not sure what's wrong with the timestamp. afaik it should work because NoGhost servers used to also have a modified VSP @ http://noghost.net/cgi-bin/index_lms_monthly.php

Can you tell me which part of the log is used for timestamp? Is it that line? https://github.com/evilru/quake3-vsp-stats/blob/292a7e713672a65b844f86fca53bfbfda78b3c71/games.log#L33

Locustv2 commented 3 years ago

after going through https://github.com/evilru/quake3-vsp-stats/blob/dcad0a6ed445f399f6688a6715ca41c74c072752/vsp-q3a.php it seems that ServerTime might not be the issue (it's not present in any of my logs). but i might be wrong. it's hard to follow that code with spanish comments and weird function names 😅

evilru commented 3 years ago

Yes, this is the timestamp the parser tries to use. debugging the obfuscated code is pretty annoying, yes 😂

Be aware that this version of vsp was changed to work with excessive plus. https://github.com/evilru/quake3-vsp-stats/blob/master/readme-xp.txt#L90

I am not sure if the timestamp handling was introduced with with changes regarding xp or if was there before. To be honest, I never tried to make sense of this code mess 🤪

As I am only playing osp - this was never a problem for me :)

Locustv2 commented 3 years ago

I noticed that this is the check that's returning the message Analyzing game 0004 (00.81%) duplicated game timestamp, ignored

https://github.com/evilru/quake3-vsp-stats/blob/dcad0a6ed445f399f6688a6715ca41c74c072752/vsp.php#L926

Is there an environment variable to skip this check?

evilru commented 3 years ago

I've added the variable CHECK_UNIQUE_GAMEID to disable this check.

Locustv2 commented 3 years ago

Doesn't work.. I tried running the command

sed -ri -e 's!(\[\'\''check_unique_gameID\'\''\]\s=\s)1!\1$_ENV["CHECK_UNIQUE_GAMEID"]!g' pub/configs/cfg-default.php

directly in the container, but the value stays 1.

evilru commented 3 years ago

Just pushed a fix for the regex. You can run the updated Image.

Locustv2 commented 3 years ago

It works, thanks. However i guess it's not the best solution. Every 5 minutes the cron will read the log file and reprocess everything again resulting in same match being parsed multiple times.

I also had an issue where there were 2 UnnamedPlayer in a game and the parser returned a duplicate entry exception from the DB.. i think i will play a bit with OSP and maybe move to this mod.

evilru commented 3 years ago

Ok, thank you for your input regarding the docker image!