Giter Club home page Giter Club logo

online-ratings's People

Stargazers

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

Watchers

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

online-ratings's Issues

docker-compose not linking containers properly on Docker for Mac/VirtualBox

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.

web_logs.txt

@amj @Kashomon any thoughts?

Finish Prod Configuration

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?

Fix hardcoded config values

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.

Allow a go server to initiate account linking

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.

Improve Deploy Process

Everyone would really like to improve the deploy process. Currently, the process looks like:

  • ssh into the machine.
  • apt install docker/docker machine
  • DL the container[s] and run them.

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.

Fix Link AGA ID email

screen shot 2016-10-05 at 9 50 37 pm

Email needs to be formatted better with spacing and such. The dev.usgo.org long link should show up as something like "Click here to link your AGA account". AGA Management Site should be the AGA Membership Manager as well.

Be able to ingest tournament results files

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:

Difficulty with dev setup for Ubuntu 16.04

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.

  1. Install Python3 - ok

  2. Install pip - ok

  3. 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.

  4. 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).

  1. Run the tests! - ok

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.

Request for the AGA ID to be made available for a profile

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)

SMTP Errors in Local Dev

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

Add capability to provide a link back to the game server's record of the game

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..)

Request to add server user url fields to the Player model and interface

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)

Run the new rank algorithm on the IRL game data.

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?

/players/<player_id> 500s on logged-out users

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.

Rewrite client in JS/TS and take advantage of client-side templating

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.

Add API Docs

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).

Work with an integrator to test integration!

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.

write script for updating ratings

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.

Figure out how to test ratings math

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.)

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.