leobz / Organize-matches

Football match management web service: Java, React, MongoDB, Telegram Bot, Vegeta load tests, Certbot and AWS.
MIT License
0 stars 0 forks source link
football java reactjs spring-boot telegram-bot

Organize Matches

Overview

A basic tool to create, edit and apply to football matches https://partidos.com.ar/. We use vegeta load testing tool, docker, NoSQL database, React, and Java with Springboot. The API is documented using OpenApi 3.0, the deployment uses AWS EC2 instance + Cloudflare DNS and there is also a TelegramBot client.

Contents


Setup

  1. Install Docker + Docker Compose: https://www.docker.com/

  2. In the root of the project /organize-matches, create a .env file with the following content:

DOCKER_REGISTRY=tacs2022
# Opcional
# TELEGRAM_BOT_TOKEN=<TOKEN-para-activar-Telegram-Text-Commands>
  1. Optional: Login to the Docker registry (required for Docker image pushes)
$ docker login -u tacs2022 -p <registry-password>
  1. For the database creation to work, a file named mongo-pass.txt with the password of the root user of the database (e.g. Pass1234!@) should be created in the root of the project /organize-matches.

Basic Commands: Development

Build docker image - MacOS/Linux:

$ make build # Create docker image of all components (backend+frontend)

Run app locally - MacOS/Linux:

# Starts all containers locally.
# Needs to run 'make build' beforehand to pick up the latest changes
make dev

Stop app locally - MacOS/Linux:

make stop # Terminates the execution of all containers

To push an image with the version to be deployed to Dockerhub:

make push-images

Development URLs


Basic Commands: Production

Inside EC2 instance:

  1. Download latest tagged image from Docker registry

    make pull-images
  2. Run docker project with volume - MacOS/Linux:

    # Stop/Clean up old containers
    make stop
  3. Run docker project with volume - MacOS/Linux:

    # Start containers with a dedicated volume for the Mongo container.
    make prod

Load Testing

To see the available HTTP load tests, execute the following command:

make help | grep lt

To modify load testing parameters, modify the following variables in the Makefile:

VEGETA_DURATION = 10s # Test duration in seconds
VEGETA_RATE = 0 # Maximum request rate per second. (0 is infinite)
VEGETA_MAX_WORKERS = 1000 # Maximum number of users (Note: 1 user can make N requests)

Documentation

Architecture Diagram

Architecture-Diagram

MongoDB

We decided to use the MongoDB NoSQL database because we believe that the functionality may vary in the future, and this database is more flexible for adding new functionality than, for example, Cassandra.