Git Product home page Git Product logo

wca-statistics's Introduction

WCA Statistics

WCA Statistics is a collection data analysis over the WCA's database.

Backend Deploy backend Frontend Deploy frontend

Requirements

This project is composed of front end and backend. You can check the requirements in each one.

How to run it

This project is separated in server and client, backend and front and respectively. You can run each one by following instructions in client and server's folder, located in the README.

Run with docker

  • Build server's jar

./server/gradlew build -p server (or navigate to the server folder and execute ./gradlew build)

  • Download the database export and build it in a database called wca_development. You can use the file server/get_db_export.sh with
chmod +x server/get_db_export.sh
source server/get_db_export.sh
  • Run docker

docker-compose up

Generate all statistics

First, you'll need to start the server, then you can execute

chmod +x scripts/generate_all_statistics.sh
./scripts/generate_all_statistics.sh

Deploy

  • Frontend

GitHub actions will deploy after merging to main. Anyways, if you wanna do it manually, you can

cd client
export PUBLIC_URL="https://statistics-api.worldcubeassociation.org"
export REACT_APP_BASE_URL="https://statistics-api.worldcubeassociation.org"
yarn build
aws s3 cp build s3://{{STATISTICS_WEBSITE_BUCKET}} --recursive
  • Backend

GitHub actions will deploy after merging to main.

Docker cron

The file scripts/cron-docker.sh is used to make a fresh new download of the ropository and run the statistics over it. In the process or calculating statistics, the other sh files inside of scripts are used.

Deploy the cron image

The cron script also runs in its own container. This helps when running this periodically like in a cron schedule, using AWS Batch

  • Build the image

    docker build -t thewca/statistics-cron .

  • Deploy the image

    docker push thewca/statistics-cron

Run the image locally

You can also run this image locally. This image will download the export, update the database and calculate all the statistics.

docker run thewca/statistics-cron

Run cron

  • Export variables
export STATISTICS_PORT=8080
export DB_HOST={{SENSITIVE}}
export DB_DATABASE={{SENSITIVE}}
export DB_USERNAME={{SENSITIVE}}
export DB_PASSWORD={{SENSITIVE}}
export DB_PORT=3306
  • Run it

    source scripts/cron.sh

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.