]> git.rm.cloudns.org Git - xonotic/xonstatdb.git/commitdiff
Update README, set perms.
authorAnt Zucaro <azucaro@gmail.com>
Mon, 27 May 2024 18:53:42 +0000 (14:53 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Mon, 27 May 2024 18:53:42 +0000 (14:53 -0400)
README.md
queries/identify_bad_rank_games.sql [changed mode: 0644->0755]
queries/player_retention_3months.sql [changed mode: 0644->0755]
queries/show_elo_rot.sql [changed mode: 0644->0755]
queries/win_ratio_by_player_id.sql [changed mode: 0644->0755]

index c18762f6c61d32bb366d36c11a5ef0b70e99fa16..c451ab9105cfffc004097cc61f716db1feb4305c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,9 +1,17 @@
-This is the source for **xonstatdb**, the [Xonotic][xonotic] [Statistics database][xonstat].
+# XonStatDB
+
+This is the source for the database underlying [XonStat][xonstat], the statistics application for the arena-style FPS [Xonotic][xonotic]. 
 All code herein is intended for the PostgreSQL database management server.
 
-----
+## Clone
+
+```
+git clone git@gitlab.com:xonotic/xonstatdb.git
+```
 
-To build, first create the user that will own all of the objects in the database.
+## Prepare
+
+Prepare the database by first creating the user that will own all of the objects in the database.
 You must run this as an administrator user in your cluster.
 See your operating system's guidelines for how this is set up on your system.
 
@@ -46,56 +54,50 @@ like *Peer authentication failed for user "xonstat"*:
 
     $ psql -h localhost -U xonstat xonstatdb
 
-Create the schema in which all of the xonstat tables will reside:
-
-    xonstatdb=>
-    
-    CREATE SCHEMA xonstat
-        AUTHORIZATION xonstat;
 
 Create the plpgsql language, if it doesn't exist:
 
     CREATE LANGUAGE plpgsql;
 
-Now load the initial tables:
+## Initialize
 
-    \i build/build_full.sql
+Initial schema setup and subsequent migrations for XonStatDB are handled using [goose][goose]. You may want to familiarize yourself with that tool before proceeding. 
 
-   *Note: You will see a lot of NOTICE messages. This is normal.*
+```
+goose postgres "user=xonstat host=localhost dbname=xonstatdb sslmode=disable password=$PASSWORD" up
+```
 
-And that's it!
+That's it!
 
-Do note that there are a few maintenance scripts that can be used
+## Maintenance Scripts
+
+There are a few maintenance scripts that can be used
 once the database begins accumulating data. These can be found in 
-the scripts subdirectory and are intended to be implemented as cron jobs. 
+the scripts subdirectory and are intended to be implemented as cron jobs.
 A summary of what they do follows:
 
-  update\_elos.sql - will decrease player elo records by one point 
-                    day for every day after 30 days of inactivity
-                    until they hit the elo "floor" of 100. This 
-                    prevents inactive players from staying on the 
-                    leaderboard/ranks for too long.
-
-  update\_ranks.sql - will populate the player\_ranks table each day
-                     according to the elo values when it is run.
-
-  refresh\_$TABLE\_mv.sql - updates the "materialized view" named by $TABLE.
-
-  purge\_anticheat\_log.sql - deletes old anticheat data.
-
-There is also a "merge players" function in the functions sub-
-directory. This can be used to merge two players together into one
-record in the presentation layer of XonStat. It can be run as follows:
+- refresh_*.sh: refreshes data in various materialized views
+- purge_anticheat_log.sh: prunes the anticheat signal data 
 
-  select merge\_players(winner\_player\_id, loser\_player\_id);
+An example crontab using these: 
+```
+# refresh the materialized views in xonstatdb
+00 07 * * * ~/bin/refresh_summary_stats.sh
+10 07 * * * ~/bin/refresh_active_players.sh
+15 07 * * * ~/bin/refresh_active_servers.sh
+20 07 * * * ~/bin/refresh_active_maps.sh
+25 07 * * * ~/bin/refresh_recent_game_stats.sh
 
-The "winner" player ID is the account that remains active after the
-transaction.
+# prune the anticheats
+20 08 * * * ~/bin/purge_anticheat_log.sh
+```
 
-Enjoy!
 
 [xonotic]: http://www.xonotic.org/
 [xonstat]: http://stats.xonotic.org/
+[goose]: https://github.com/pressly/goose
 
 ----
 
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)