/EmeraldGames

Service for having multiplayer cash tournaments in games

Primary LanguageJavaScript

Emerald Games Site

Important! Need to update setup to include the changes that need to be made to required libraries

Table of contents

  1. Setup
  2. Celery
  3. Database
  4. Important notes on dependencies (If project isn't working)

SECTION 1: Setup

Install all of the requirements.

pip install -r requirements.txt

Install redis and rabbitmq. There are used by celery.

See section Important Notes on Dependencies if there are problems with setup

SECTION 2: Celery

Celery is used for periodic tasks. As of writing this (Jan 12th 2019) it is used for aborting all matches that went past their max_match_length. This is so players will have their money returned to them if an error occurs in a match and the game does not abort.

Start celery:

celery -A djangop worker --loglevel=info -P gevent

Start celery beat:

celery -A djangop beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler

Celery also requires redis to be running, open ubuntu and run

service redis-server start

SECTION 3: Database

If the database has to be recreated and your getting a no such table error. Try the command:

python manage.py migrate --run-syncdb

Important Notes on Dependencies

Channel Layers

If there is an issue with channel layers remove the line importing Group. Replace all lines that use group with the new format:
# This example uses WebSocket consumer, which is synchronous, and so
# needs the async channel layer functions to be converted.
from asgiref.sync import async_to_sync
class ChatConsumer(WebsocketConsumer):
def connect(self):
    async_to_sync(self.channel_layer.group_add)("chat", self.channel_name)

def disconnect(self, close_code):
    async_to_sync(self.channel_layer.group_discard)("chat", self.channel_name)

Django Rest Framework

If there is an issue with djangorestframework... The version of djangorestframework doesn't work with this version of django. There should be a folder provided with the modified package rest_framework. If you cant find it just ask for it. This version should replace the one the environment.

Celery

If there is an issue with celery... There was a problem with celery before and I had modify it. Let me know if celery isn't working.

Channels Presence

There was also an issue with channels_presence. It didn't work with the current version of channels and I had to modify it.