usgo / online-ratings Goto Github PK
View Code? Open in Web Editor NEWAGA Online Ratings protocol and implementation
License: MIT License
AGA Online Ratings protocol and implementation
License: MIT License
Versions:
docker-compose version 1.8.0, build f3628c7
docker-machine version 0.7.0, build a650a40
Docker version 1.12.0, build 8eab29e
online-ratings git commit ID 60ea273 Add utility function to dump flask env
I executed:
$ docker-machine create -d virtualbox dev
$ docker-compose build && docker-compose up -d
$ docker-machine env dev
# switch docker env
$ curl -v 192.168.99.100
500 Internal Service Error...
$ docker-compose logs web
(see attached web_logs)
FATAL: no pg_hba.conf entry for host "172.17.0.4", user "postgres", database "postgres", SSL off
The above error is rather confusing because postgres is not 172.17.0.4. 172.17.0.4 is actually the web container, and the postgres box should be at 172.17.0.3
$ docker exec -it onlineratings_web_1 bash
root@060177ce38c6:/usr/src/app# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.3 postgres_1 f851624c05f9 onlineratings_postgres_1
172.17.0.3 onlineratings_postgres_1 f851624c05f9
172.17.0.3 postgres f851624c05f9 onlineratings_postgres_1
172.17.0.4 060177ce38c6
So somehow the flask app container is not attempting to connect to the postgres container, and is falling back to trying to connect to a postgres instance within the flask container. There is no such postgres instance, and thus the stack trace in the logs.
I dumped the values in the Config object from the flask app to see what it was connecting to, and I got this:
SQLALCHEMY_DATABASE_URI=postgresql://postgres:lol-change-me-plz@postgres:5432/postgres
At this point, I was stumped - the sqlalchemy database URI would seem to be pointed at postgres, but nothing is happening.
@amj @Kashomon any thoughts?
We need to nail down the last remaining production configuration bits. One of these is nailing down the URL that we'll be using. Currently it's served out of dev.usgo.org, but that should probably be online-ratings.usgo.org (or perhaps a new domain name). @brilee -- Do you have some thoughts here?
e.g., stream keys on twitch. They're hidden until there's a 'show?' button clicked, which is just a little javascript to unhide/reveal/restyle the element in the dom.
Rating is currently being returned; it'd be nice to get sigma (the uncertainty) returned as well.
ADMINS = frozenset(['[email protected]'])
should be something like os.environ.get('ADMINS').split(',')
SECURITY_PASSWORD_SALT = 'SuPeRsEcReTsAlT'
should pull from environment
os.environ.get("AGA_MM_API_KEY", "")
should probably get pulled into config.py, and then imported into the AGA mm module.
UI should let a logged-in user browse the list of servers and create a token for that server (which should create a Player object in the background for that user_id, server_id combination)
While considering #88, please also consider adding of accounts from "the other direction", not only through the usgo online-ratings interface.
As a user, I should be able to go to some settings page on my favorite go server and link my AGA account to my go server account. This should be as streamlined and as simple as possible. For example, entering their AGA ID and clicking "Link". This action would then presumably forward them to a authentication or authorization page in the online-ratings system that would hold the users hand while finishing the account linking process. The server should be able to send along all of the necessary server-specific information, so all the user should need to do is click that button, login or create an account, maybe click a confirmation of "Yes link this account", and be done.
Letting the go server know the linking happened, via a post back, or simply relying on a user redirect back to the server, would be a great bonus.
Stupid simple solution is to pick [30k?], which makes sense to most people. Perhaps there's something fancy we could do with our integrators.
Everyone would really like to improve the deploy process. Currently, the process looks like:
This process could probably be improved. @duckpunch mentioned using Ansible script to provision the machine. A middle ground might be using Ansible with docker: https://www.ansible.com/docker
I would also personally love it if Green travis builds automatically initiated deploy process. This isn't trivial, however, and would doubtless require the building of a custom travis script and adding encrypted credentials to the travis script.
When we load in historical AGA data, it should be obvious that they are preloaded from existing data, and that they won't be counted towards the online rating.
Related to #31, we should solidify the v1 API and make any API choices before we go into Beta. @duckpunch is currently working on this.
Tournament results files produced by OpenGotha, etc, should be able to be uploaded to the 'Real Life Server' as tournaments, which should produce the related games. A ratings admin should be able to approve them.
The results file format is documented in:
There should be a periodic (daily? hourly?) job that updates the ratings database with the latest results.
It's going to be useful to integrate with travis continuous integration. Some details: https://docs.travis-ci.com/user/languages/python
Some hosts for this do not have enough resources to run a full virtual machine, is there a way to run without virtualbox?
seigenblues mentioned on reddit that the project was interested in some frontend work. I don't see any to-dos for frontend, so I figured I would clone the project and just see the state of things. I'm attempting to follow along with the readme instructions, but here's where I am.
Install Python3 - ok
Install pip - ok
Install postgres - this seemed to work. On my version Ubuntu 16.04, there is the package postgresql
and postgresql-9.5
. In order to get 9.4, I used the linked instructions to use an alternate repository. This seemed to work.
Install the python dependencies with pip. - This does not appear to be working. Here's what I have.
~/src/online-ratings/web$ pip install -r requirements.txt
<snip, lots of ok-looking output>
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.5
creating build/temp.linux-x86_64-3.5/psycopg
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x090505 -DHAVE_LO64=1 -I/usr/include/python3.5m -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.5/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.5/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:27:0:
./psycopg/psycopg.h:30:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
I found a few references on Stack Overflow with failures to build this package, but none of the suggestions worked for me (installed autotools, ran pip with sudo).
Linux: Install docker and docker-compose - ran hello-world with success
$ cp .env_example .env
$ docker-compose build
WARNING: Please be aware that .yml is the expected extension in most cases, and using .yaml can cause compatibility issues in future.
ERROR: In file './docker-compose.yaml' service 'version' doesn't have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.
So I commented out the "version" line, but then fail with:
WARNING: The DB_NAME variable is not set. Defaulting to a blank string.
WARNING: The DB_USER variable is not set. Defaulting to a blank string.
ERROR: Validation failed in file './docker-compose.yaml', reason(s):
Unsupported config option for 'volumes' service: 'pgdata'
Unsupported config option for 'services' service: 'psql'
I don't understand... I modified .env with the values for an empty database I set up in Postgres. Any tips appreciated.
On a game server, it'd be nice to be able to view the AGA ID for a player if they have one configured.
Bonus points: It'd also be nice to be able to submit an update to the AGA ID (and let it go through the verification step already in place in the online-ratings system)
I'm getting errors related to SMPT mailing in local dev. This happens any time I try to do a login/ registration.
@brilee -- does this happen for you too? Do we need to change the value of the following?
MAIL_SERVER=smtp_server.usgo.org
Full error example:
web_1 | Traceback (most recent call last):
web_1 | File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1817, in wsgi_app
web_1 | response = self.full_dispatch_request()
web_1 | File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1477, in full_dispatch_request
web_1 | rv = self.handle_user_exception(e)
web_1 | File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1381, in handle_user_exception
web_1 | reraise(exc_type, exc_value, tb)
web_1 | File "/usr/local/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
web_1 | raise value
web_1 | File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request
web_1 | rv = self.dispatch_request()
web_1 | File "/usr/local/lib/python3.4/site-packages/flask/app.py", line 1461, in dispatch_request
web_1 | return self.view_functions[rule.endpoint](**req.view_args)
web_1 | File "/usr/local/lib/python3.4/site-packages/flask_security/decorators.py", line 205, in wrapper
web_1 | return f(*args, **kwargs)
web_1 | File "/usr/local/lib/python3.4/site-packages/flask_security/views.py", line 117, in register
web_1 | user = register_user(**form.to_dict())
web_1 | File "/usr/local/lib/python3.4/site-packages/flask_security/registerable.py", line 41, in register_user
web_1 | user=user, confirmation_link=confirmation_link)
web_1 | File "/usr/local/lib/python3.4/site-packages/flask_security/utils.py", line 333, in send_mail
web_1 | mail.send(msg)
web_1 | File "/usr/local/lib/python3.4/site-packages/flask_mail.py", line 491, in send
web_1 | with self.connect() as connection:
web_1 | File "/usr/local/lib/python3.4/site-packages/flask_mail.py", line 144, in __enter__
web_1 | self.host = self.configure_host()
web_1 | File "/usr/local/lib/python3.4/site-packages/flask_mail.py", line 158, in configure_host
web_1 | host = smtplib.SMTP(self.mail.server, self.mail.port)
web_1 | File "/usr/local/lib/python3.4/smtplib.py", line 242, in __init__
web_1 | (code, msg) = self.connect(host, port)
web_1 | File "/usr/local/lib/python3.4/smtplib.py", line 321, in connect
web_1 | self.sock = self._get_socket(host, port, self.timeout)
web_1 | File "/usr/local/lib/python3.4/smtplib.py", line 292, in _get_socket
web_1 | self.source_address)
web_1 | File "/usr/local/lib/python3.4/socket.py", line 498, in create_connection
web_1 | for res in getaddrinfo(host, port, 0, SOCK_STREAM):
web_1 | File "/usr/local/lib/python3.4/socket.py", line 537, in getaddrinfo
web_1 | for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
web_1 | socket.gaierror: [Errno -2] Name or service not known
ratings are a number between 0 and 40, and they get transformed into 30k-7d+ in the display. should be easy, might be worth a jinja filter.
It'd be swell if game servers could provide a link back to the game, and for that link to show up somewhere within the ratings interface. This would be in addition to the recorded SGF.
In the case of OGS, this would allow users to easily pull up the game on OGS, look at any reviews that were done on that game and look at more detailed information that is lost when translating down to SGF (such as move timing, analysis messages in chat, link out to any applicable tournament view, explore the player's other games, challenge one of the players to a game, etc..)
When binding a player on a server to a Player
profile on AOR, it'd be nice if the server could submit the server's user id for that player, along with a URL to access that users profile on the server. (The rational of storing the user id would be to optionally enforce uniqueness and do lookups based on it)
See how good/bad/terrible the random constants are.
Also: come up with a way to compare some meaningful comparisons between the two algorithms. E.g., distribution of (rating_old - rating_elo++), what shape is that? how does that change across the ranks?
the permission check from
{% if user.can_reset_player_token(player) %}<tr><td>Token</td><td>{{ player.token }}</td></tr>{% endif %}
is an error when user
is an AnonymousUserMixin object, instead of our model-defined User object.
{% if not user.is_anonymous and user.can_reset_player_token(player) %}<tr><td>Token</td><td>{{ player.token }}</td></tr>{% endif %}
should fix the issue; needs to be tested.
I propose rewriting the client to rely on client-side templating rather than server-side templating. I have significant experience with AngularJS/AngularMaterial so that would be my preference. I could also see using TypeScript + Angular2.
One downside is it means the build is more complicated. However, moving the view-logic fully client-side makes for a far richer UI.
Since the API is crucial to Online Ratings, we should ensure we have decent API documentation. @duckpunch already has started this issue (feel free to close when you think it's done).
Its impossible to know who is using the system to test or play a rated game.
steps to repro:
Once this is done, /ratings is obsolete and can be removed.
Dependent on change the UI to be more client-side (via AngularJS or similar). Once we have more JavaScript we'll need to run both python and JS tests on one travis config. It's not trivial, but it's not too hard:
Before we can launch to beta, we need real users and integrate with one integrator. Then, we need to test to ensure the configuration actually works. We have a possible integrator lined up.
We've got the ratings math, and the games, and it's time to bring the two together.
Ideally, this would be a script that could be run via cron and would be parameterizable w/ the 'effective at' time.
Before we're truly production-worthy, we need a monitoring solution. https://prometheus.io/ is one solution suggested by @amj.
It would be really nice if members can manage their accounts/online ratings with the same username/password that they use to manage their membership
What does a test for a rating system even look like? Can we get a slice of historical data from somewhere and run it against our rating system, and check that the output is approximately right? Some sort of crude visualization tool to see how player ratings react to an event would be useful. (e.g. a numpy script that plots a line diagram of peoples' ratings over time.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.