Giter VIP home page Giter VIP logo

2021-leaderboard-service's Introduction

2021-leaderboard-service

Leaderboard Service, baked with Quarkus and Infinispan

Run Infinispan with Docker

docker run -v $(pwd):/user-config -p 11222:11222 -e USER="admin" -e PASS="pass" infinispan/server:12.0.1.Final

Scheduling properties for deployments

Default values are 4s and 1s.

leaderboard.schedule=4s
stats.schedule=1s

Change them in the deployment in containers using the following env variables:

LEADERBOARD_SCHEDULE='3s'
STATS_SCHEDULE='0.5s''

Web Sockets

Leaderboard

ws://localhost:8080/leaderboard

Payload

[
  {
    "userId":"u6",
    "matchId":"m1",
    "gameId":"g1",
    "human":true,
    "userName": "Michael",
    "score":12,
    "timestamp":9090898,
    "gameStatus":"PLAYING"
  }, 
  {
    "userId":"u5",
    "matchId":"m1",
    "gameId":"g1",
    "human":true,
    "userName": "Jennifer",
    "score":12,
    "timestamp":9090898,
    "gameStatus":"PLAYING"
  }
  ...
]

Stats

ws://localhost:8080/stats

Payload

{
  "games-id": "g1",
  "games-status": "lobby",
  "games-played": 190,
  "total-hits": 199,
  "total-misses": 30,
  "total-sunk": 120,
  "human-shots": 300,
  "human-active": 21,
  "human-win": 0,
  "human-loss": 0,
  "human-hits": 8,
  "human-misses": 15,
  "human-sunks": 12,
  "human-carrier-sunks": 4,
  "human-submarine-sunks": 5,
  "human-destroyer-sunks": 2,
  "human-battleship-sunks": 1,
  "human-bonus": 0,
  "ai-shots": 500,
  "ai-active": 21,
  "ai-win": 0,
  "ai-loss": 0,
  "ai-hits": 0,
  "ai-misses": 0,
  "ai-sunks": 0,
  "ai-carrier-sunks": 0,
  "ai-submarine-sunks": 0,
  "ai-destroyer-sunks": 0,
  "ai-battleship-sunks": 0,
  "ai-bonus": 0
}

Run images (native or jvm)

  1. Run Infinispan
./run-infinispan.sh
  1. Build following the instructions the native or the jvm image (instructions in Dockerfile or Dockerfile.jvm)

  2. Run the application

./run-app.sh

Access

  • Infinispan Console in http://localhost:11222. Log using admin/pass credentials
  • Leaderboard: http://localhost:8080

docker commit 2afe01858f8b quay.io/redhatdemo/2021-leaderboard-service docker push quay.io/redhatdemo/2021-leaderboard-service

2021-leaderboard-service's People

Contributors

karesti avatar

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.