Skip to content

Arquisoft/wichat_es1c

 
 

Repository files navigation

📱 wichat_es1c

Actions Status Quality Gate Status Coverage Duplicated Lines (%) Security Rating Vulnerabilities CodeScene general CodeScene Average Code Health CodeScene Hotspot Code Health


👨‍💻 Developers

🧑‍💼 Name GitHub Username
Daniel Alberto Alonso Fernández
David Álvarez Cabezas
Alejandro Fernández García
Mario García Prieto

Logo

📖 About the Project

This is a base project for the Software Architecture course (2024/2025). It is a basic application composed of several components:

  • User Service: Handles the insertion of new users in the system.
  • LLM Service: Communicates with the LLM (Language Learning Model).
  • Gateway Service: Acts as a intermediary proxy for the above services.
  • Webapp: A React-based web application for login and user management.

✨ Key Features

  1. User Registration and Login: Allows users to securely register and authenticate.
  2. ChatBot: Provides users with hints for game questions.
  3. Profile Management: Users can update their personal information.
  4. Rankings: Includes a global ranking of all users' games and a personal ranking where users can access their answers and the correct ones for each game.
  5. User Management: Administrators have access to a menu to view all registered users and delete any user if needed.

🚀 Quick Start Guide

1️⃣ Clone the Project

git clone [email protected]:arquisoft/wichat_es1c.git

2️⃣ LLM API Key Configuration

To enable LLM communication, configure an API key for either Gemini or Empathy. Follow these steps:

  1. Create a .env file in the webapp directory:

    REACT_APP_LLM_API_KEY="YOUR-API-KEY"
  2. Create another .env file in the root directory (next to docker-compose.yml):

    LLM_API_KEY="YOUR-API-KEY"

Note: These files are excluded from version control via .gitignore. For deployment, add the API key as a repository secret (LLM_API_KEY).


3️⃣ Launching with Docker

To start the application using Docker Compose:

docker compose --profile dev up --build

4️⃣ Component-by-Component Start

  1. Start the database:

    docker run -d -p 27017:27017 --name=my-mongo mongo:latest

    Alternatively, use a cloud service like MongoDB Atlas.

  2. Start the services:

    • Navigate to each service directory (auth, user, gateway) and run:
      npm install
      npm start
  3. Start the webapp:

    • Navigate to the webapp directory and run:
      npm install
      npm start

The app will be available at http://localhost:3000.


🌐 Deployment

Machine Requirements

  • OS: Linux (Ubuntu 20.04 or higher, recommended 24.04).
  • Docker: Installed.
  • Ports: Open ports (3000 for the webapp, 8000 for the gateway).

Install Docker on the Machine

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt update
sudo apt install docker-ce
sudo usermod -aG docker ${USER}

Continuous Delivery with GitHub Actions

Deployment is automated using GitHub Actions. The process is triggered when a new release is created. The workflow includes:

  1. Running unit and e2e tests.
  2. Pushing Docker images to GitHub Packages.
  3. Deploying the application via SSH.

Deployment Workflow

deploy:
  name: Deploy over SSH
  runs-on: ubuntu-latest
  needs: [docker-push-userservice, docker-push-authservice, docker-push-llmservice, docker-push-gatewayservice, docker-push-webapp]
  steps:
    - name: Deploy over SSH
      uses: fifsky/ssh-action@master
      with:
        host: ${{ secrets.DEPLOY_HOST }}
        user: ${{ secrets.DEPLOY_USER }}
        key: ${{ secrets.DEPLOY_KEY }}
        command: |
          wget https://raw.githubusercontent.com/arquisoft/wichat_es1c/master/docker-compose.yml -O docker-compose.yml
          docker compose --profile prod down
          docker compose --profile prod up -d --pull always

Required Secrets

  • DEPLOY_HOST: IP address of the remote machine.
  • DEPLOY_USER: User with SSH access.
  • DEPLOY_KEY: SSH private key for authentication.

🛠️ Technologies Used

  • Frontend: React
  • Backend: Node.js, Express
  • Database: MongoDB
  • Containerization: Docker
  • CI/CD: GitHub Actions
  • Code Coverage: SonarCloud
  • Load Testing: Gatling
  • Deployment: Azure

Packages

 
 
 

Languages

  • HTML 61.6%
  • JavaScript 32.5%
  • CSS 4.5%
  • Other 1.4%