SRL Stats website and server backend
AGPL-3.0 License
==== SRL Stats ====
SRL Stats System. http://wizzup.org/stats/
The SRL Stats system is a system created solely for the purpose to ``collect'' statistics from scripts written by the SRL Community. Every user can own multiple scripts at the system and commit statistics to other scripts, not necessarily his own.
If you want to run the system, you'll need the following components: Python: * jinja2 * sqlalchemy * flup (WSGIServer) * matplotlib * simplejson * numpy
The system uses WSGI/FCGI. I used lighttpd, but apache and other should work fine too. (But I have no instructions on how to set it up with apache. If you have done it please send in contributions to merlijn on wizzup.org)
==== Directories ====
My folder setup:
/srv/srlstats/srlstats <-- location of the sources. /srv/srlstats/web/ <--- location of static files
==== Lighttpd Setup ====
$HTTP["host"] == "stats.myhost.com" { # Rewrite to make it pretty. We'll also need a file stats.fcgi # to prevent 404s. XXX Ugly hack <-- url.rewrite-once += ( "^(?:(?!.static.)).*$" => "stats.fcgi" )
fastcgi.server += ( ".fcgi" =>
( "statsfcgi" =>
(
"socket" => "/tmp/stats.sock",
"docroot" => "/srv/srlstats/srlstats"
)
)
)
server.document-root = "/srv/srlstats/web"
}
==== Website and Database configuration ====
The config.py file contains the base url, you'll want to change this.
Also fill in stats_credentials.py:
dbu = 'statsdbuserhere' dbpwd = 'somepasshere' dwh = 'localhost' dbp = '5432' # postgresql port dbname = 'statsdbnamehere'
And if you want to use a different database, edit sql.py appropriately. (Change the engine line)
===== Spawn FCGI ====
This is how I used it: www-data is lighttpd, srlstats is user for srl-stats.
$ spawn-fcgi -U www-data -G www-data -u srlstats -g srlstats -d /srv/srlstats/srlstats/ -f /srv/srlstats/srlstats/stats.py -s /tmp/stats.sock