Coder Social home page Coder Social logo

cos301_dnd_backend's Introduction

COS301-DND-Backend

Branch Status
Master Build Status deployment diagram
Develop Build Status deployment diagram

Backed API Server

Deployment Diagram

deployment diagram

Features

  • HTTP/2 using gRPC (https://grpc.io/)
  • HTTPS in production mode
  • Real time sockets
  • Firebase authentication
  • Strongly typed service and message definition (Protobuf3)
  • Easy configuration with TOML
  • pep8 Compliance
  • Regression testing
  • Developer mode (SQLite)
  • Production mode (PostgreSQL and PyPy3)
  • SystemD service file

Coverage

Name Stmts Miss Cover
main.py 50 5 90%
server/character.py 281 73 74%
server/db.py 167 3 98%
server/firebase.py 4 0 100%
server/helpers.py 181 1 99%
server/log.py 18 0 100%
server/server_pb2.py 186 0 100%
server/session.py 643 200 69%
TOTAL 1530 282 82%

Requirements

sudo apt-get update
sudo apt-get install python3
sudo apt-get install pip3
sudo apt-get install nodejs
sudo apt-get install dart

Installing packages

make install

Running server

make run

Running the tests

make test

Generating code from protobuffers

python -m grpc.tools.protoc -I./protos --python_out=./server --grpc_python_out=./server ./protos/server.proto

Fedora Installation

sudo dnf update
sudo dnf install postgresql-server postgresql-contrib
sudo systemctl enable postgresql
sudo postgresql-setup --initdb --unit postgresql
sudo systemctl start postgresql
pypy -m ensurepip

Arch Linux Installation

pacman -S sudo
sudo pacaman -Syyu
sudo pacman -S postgresql

sudo -u postgres -i
initdb --locale en_US.UTF-8 -E UTF8 -D '/var/lib/postgres/data'
exit

sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo -u postgres -i

createuser --interactive

cos301_dnd_backend's People

Contributors

quantum-sicarius avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cos301_dnd_backend's Issues

Experiment/Switch to PyPy

PyPy is a JIT runtime for python programs should in theory help performance as this is a long running app which JIT works best for.

With this some proper profiling should be done to see if any benefits are experienced.

grpcio is not officially supported by PyPy however my tests are so far passing.

Move to SQLAlchemy

Firebase will only be used for authentication.

  • migrate existing sessions
  • complete all session functionality

Ready up logic incorrect.

The check if everyone is ready appears to use the count rather than the absolute value. If a player readies up multiple times the server decides that it is ready to start.

Add rpc calls to get ranges of sessions or characters.

For the lists in the client app we can not request all sessions or all characters as it will overload the device and the server. Currently there is support to limit the amount that gets sent however I should add ability to get the range. The client should then request a further range as it scrolls.

Add a configuration file.

In production I keep editing the code to use the login details of the production database. This should be set in a configuration file.

Optimize for presentiations.

Currently I think there are places where I can improve my database query's. There are also places where I terminate a database connection which should probably be pooled and reuse as connections are usually expensive.

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.