Skip to content

shinbatsu/devops-bmstu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LMS System

Project Description

The project is an LMS (Learning Management System) designed to manage student learning outcomes.

LMS is a web application developed using the following technologies based on a "three-tier" architecture.

General Architecture Overview

Structurally, the application looks as follows:

!include <C4/C4_Container>

left to right direction

Person(user,user,"User")

System_Boundary(c1, "LMS") {
 System_Boundary(c2, "k8s Namespace") {

 Container(frontend, "Web Application", "ReactJS, Docker", "Web interface and static content")
 Container(backend, "API", "Python 3.8, Django, Docker Container", "Handles data modification", tags="backendContainer")
 Container(ingress, "Ingress Controller", "nginx, k8s, ingress", "Reverse proxy")

 System_Boundary(c4, "Monitoring Subsystem") {
 Container(prometheus, "Prometheus", "nginx, k8s, ingress", "Collects metrics and alerts")
 Container(graphana, "Grafana", "nginx, k8s, ingress", "System state visualization")
 Container(loki, "Loki", "nginx, k8s, ingress", "Log collection server")
 }
 }
 System_Boundary(c3, "Virtual Machine") {
 ContainerDb(database, "Database", "PostgreSQL 16", "Stores user data and application data model")
 }
}

Rel(backend,database,"SSL","JDBC, SQL")
Rel(user,ingress,"HTTPS","Download JS application")
Rel(user,ingress,"HTTPS,WSS","Access backend")
Rel(ingress,frontend,"HTTP","Download JS application")
Rel(ingress,backend,"HTTP,WSS","API requests")
Rel(backend,loki,"k8s-log driver","Log")
Rel(database,loki,"syslog","Log")
Rel(user,ingress,"HTTPS","Monitoring interface")
Rel(ingress,graphana,"HTTPS","Monitoring interface")

Object Groups / Managed Objects - Structure

Application

Frontend:

  1. Web Application (React): Visual part of the application that the user interacts with.
  2. Static Content: Application content – images, logos, icons.
  3. UX/UI, E2E Tests (Jest): Tests for user interaction with the application.

Backend:

  1. Django: Business logic processing, API.
  2. WSGI: Middleware interface for handling requests via the Python application (Django in this case).
  3. Unit Tests: Verifies API responses.
  4. Nginx: Server for handling incoming requests.

Database:

  1. PostgreSQL-16: Service for storing static system data.

Infrastructure

Monitoring and Logging:

  1. Prometheus: Collects system information (metrics/logs).
  2. Grafana: Visualizes logs.
  3. Loki: Stores logs.

CI/CD:

  1. GitLab CI/CD: Manages deployment and delivery within the application infrastructure.
  2. K8s: Resource distribution and potential system scaling within the cluster.
  3. Docker: Decomposes the application into independent container services.

Compute Resources:

  1. BASIS: Cloud with dedicated resources where the system will run.

Object Groups / Managed Objects - PlantUML Diagram

Diagram

!include <C4/C4_Container>

left to right direction

Person(dev, "Developer")
Person(ci, "CI/CD Server")

System_Boundary(lifecycle, "Lifecycle") {
 Container(development, "Code Development", "IDE, Git", "Implement business requirements")
 System_Boundary(monitoring_system, "Monitoring") {
 Container(lint, "Code Check", "Linters (e.g., Flake8, ESLint), Code Review", "Static analysis, style check, code review")
 Container(build, "Build and Test", "Docker, Unit Tests (UnitTest + Jest)", "Build Docker image, run unit tests")
 Container(integration_test, "Integration Testing", "E2E Tests, UI Tests", "Integration and UX/UI tests")
 Container(cicd_deploy, "CI/CD Deploy", "Kubernetes")
 }
}

Rel(dev, development, "", "Source code")
Rel(development, lint, "", "Source code")
Rel(lint, build, "", "Verified source code")
Rel(ci, lint, "Runs linters and static analyzers")
Rel(ci, build, "Performs build procedures")
Rel(build, integration_test, "", "Docker image")
Rel(ci, integration_test, "Runs integration tests", "")
Rel(integration_test, cicd_deploy, "", "Ready application")
Rel(ci, cicd_deploy, "Runs deployment pipeline")

Lifecycle

Stage Work Type Artifacts
Code Writing Functionality development Source code, application modules
Code Check Static analysis (linters), style check, code review Linter reports, review comments, fixes
Build Docker image build Docker image
Application Testing Integration tests (E2E), UX/UI tests Test results, bug reports
CI/CD Deployment Run pipeline to deploy in Kubernetes Docker image, deployed container, deployment logs
Results Collection Collect metrics (Prometheus), logs (Loki), dashboards (Grafana) Metrics, graphs, logs

Testing Procedure

Testing is performed in 2 stages:

  1. SAST code analysis using GitLab built-in tools
  2. Unit testing using automated tests developed alongside the code

Backend Component Unit Testing

Running Django Tests

Tests are run for the built application before container creation.

python manage.py test

Django Test Results

  • Test report files are created in the test_reports folder in the project root directory.
  • Logs are recorded in project.log in the project root directory.

Frontend Component Unit Testing

Testing is performed in 2 stages:

  1. SAST code analysis using GitLab built-in tools
  2. Unit testing using automated tests developed alongside the code

Running React Tests

Tests are run for the built application in interactive mode by default. To disable interactive mode, set the variable CI=true.

cd /app/build
CI=true npm test

React Test Results

After tests, a junit.xml file is created in /app/build.

Deployment Procedure

  1. See README.md for individual components
  2. Note deployment specifics for Kubernetes cluster

About

Mirror from GItlab. LMS System project from BMSTU DevOps course.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published