Skip to content

Commit f407d9c

Browse files
committed
Added new documenation
1 parent fd74bba commit f407d9c

18 files changed

+296
-5281
lines changed

Docs/Git_Strategies.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -115,27 +115,3 @@ However, after that, it creates a release tag only if there is a push event dire
115115

116116
---
117117

118-
## Collaboration
119-
120-
To ensure smooth teamwork and efficient contributions, here is how the collaboration is structured for the project:
121-
122-
- **Central Repository:**
123-
All code is stored in a single GitHub repository, serving as the source of truth.
124-
Contributors use branches to work independently without affecting production code.
125-
126-
- **Branching and PRs:**
127-
Developers use feature branches to work on changes safely. Pull Requests (PRs) are reviewed and merged into develop id using Gitflow or directly into main.
128-
129-
- **Code Reviews:**
130-
PRs are reviewed for quality, alignment with project goals, and functionality. Automated tests validate stability before merging.
131-
132-
- **Documentation:**
133-
Contributors can refer also to:
134-
135-
- `README.md` for more overview project details
136-
137-
- **Automation:**
138-
GitHub Actions is responsible for automating the testing and deployment, saving time and reducing manual errors.
139-
140-
- **Task Management:**
141-
Use GitHub Issues for tracking tasks and bugs. PR discussions can help for collaboration on the ongoing work.

Docs/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Overview
44
--------
55

66
Dynamic web application developed using Django, allowing for easy addition, update, display, and deletion of game information. The application integrates with a PostgreSQL database to efficiently store and retrieve game data for a videogames company (Threading Labs).
7-
7+
88
Table of Contents
99
-----------------
1010
- [Project Structure](#project-structure)
@@ -73,6 +73,9 @@ The architecture is composed by these following:
7373
- `release_date`: Date
7474
- `description`: String (100 chars)
7575
- `genre_id`: Foreign key pointing to the `Genre` table
76+
77+
![image](https://github.com/user-attachments/assets/518023ae-2e0e-4241-896a-583a16dc843c)
78+
7679

7780

7881
- **Local Environment**: The application is running in a local server allowing staff members to access the WebApp by connecting to the IP address of the local machine.

Docs/WEBAPP.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
Overview
2+
--------
3+
4+
An end-to-end DevOps solution designed to deploy a Django web application securely and efficiently, integrating technologies such as Django (with CRUD operations, authentication, and permissions) [Django Web Appliation](./docs/README.md), PostgreSQL database management, Nginx as a reverse proxy web server, Gunicorn application server, UFW firewall for network security, Ubuntu LTS on a Linux virtual machine for isolated deployment, Logical Volume Management (LVM) for scalable storage, automated backups for disaster recovery, Netdata for real-time monitoring, and automated CI/CD pipelines built with GitHub Actions, with a customized GitHub Workflow, see [GitHub Workflow](./docs/Git_Strategies.md) supporting GitFlow and trunk-based strategies.
5+
6+
7+
Table of Contents
8+
-----------------
9+
- [Project Structure](#project-structure)
10+
- [Features](#features)
11+
- [Analysis and Design](#analysis-and-design)
12+
- [System Architecture](#system-architecture)
13+
- [How The Components Work Together](#security)
14+
- [Reason of the Chosen Architecture](#testing)
15+
- [Implementation Guide](#setup-and-deployment-steps)
16+
17+
## Project Structure
18+
-----------------
19+
20+
21+
## Features
22+
--------
23+
24+
- **Django Web App**: CRUD operations, secure login and logout for staff members, user permissions for certain accesses and intuitive UI.
25+
- **Customized GitHub Actions Workflow**: A reusable workflow that gets triggered for both Gitflow and TrunkBased development methodologies.
26+
- **Security and best practices**: CSRF protection, use of environmental variables for database credentials, LVM-based volume isolation, regular automated backups and UFW for allowing only necessary traffic.
27+
- **Monitoring and Maintenance**: Netdata installed for real time monitoring.
28+
29+
## Analysis and Design
30+
-------------------
31+
32+
### System Architecture
33+
34+
![img.png](img.png)![image](https://github.com/user-attachments/assets/9d3de266-75fe-41f7-a89f-6c847b73d8c6)
35+
36+
Components
37+
----------
38+
39+
### 1. Virtual Machine
40+
41+
- **Purpose**:
42+
The virtual machine is the base of the infrastructure. It provides an isolated and secure environment to host the web application, database, and supporting tools. It ensures efficiency in resource management, scalability, and reliability for the production environment.
43+
44+
- **Role in the architecture**:
45+
Hosts the Linux environment (Ubuntu LTS) required to safely run all project components. It guarantees system independence, minimizing external interference, and ensures consistent performance. This setup also simplifies future migration to cloud platforms.
46+
47+
### 2. Nginx Web Server
48+
49+
- **Purpose**:
50+
Lightweight, high-performance web server and reverse proxy responsible for handling incoming HTTP/HTTPS requests and routing them to the Django application.
51+
52+
- **Role in the architecture**:
53+
Acts as a reverse proxy, forwarding client requests to the Django application, serving static files, and securing connections by enabling TLS encryption, protecting user requests against interception or modification.
54+
55+
### 3. Django Web Application
56+
57+
- **Purpose**:
58+
The Django web application is the core of the project, responsible for providing CRUD management functionalities for the videogames catalog.
59+
60+
- **Role in the architecture**:
61+
Handles user interactions, manages business logic, and communicates with the PostgreSQL database to retrieve and store data. It runs on a dedicated logical volume (`django_volume`) for improved isolation and simplified storage management.
62+
63+
### 4. PostgreSQL Database
64+
65+
- **Purpose**:
66+
Stores all the videogame data managed by the web application.
67+
68+
- **Role in the architecture**:
69+
Manages and stores videogame data such as titles, genres, release dates, and descriptions. It utilizes a dedicated logical volume (`pg_volume`) to separate data storage from other system files, improving security and performance.
70+
71+
### 5. Automated Backups
72+
73+
- **Purpose**:
74+
Ensures data integrity and allows quick recovery in the event of system failure or disasters.
75+
76+
- **Role in the architecture**:
77+
Automatically performs regular backups of the PostgreSQL database and critical application files, storing these backups in a dedicated logical volume (`backup_volume`) to minimize downtime in case of data loss.
78+
79+
### 6. Monitoring (Netdata)
80+
81+
- **Purpose**:
82+
Tracks real-time system performance metrics such as memory usage, CPU load, and disk space utilization.
83+
84+
- **Role in the architecture**:
85+
Detects potential issues like high resource usage early and alerts administrators, enabling proactive management to ensure ongoing system stability.
86+
87+
### 7. UFW Firewall
88+
89+
- **Purpose**:
90+
Secures the virtual machine by controlling incoming and outgoing network traffic.
91+
92+
- **Role in the architecture**:
93+
Ensures only essential network ports (SSH, HTTP, HTTPS) are accessible, preventing unauthorized access and protecting the application from external threats.
94+
95+
### 8. Logical Volume Management (LVM)
96+
97+
- **Purpose**:
98+
Provides flexibility and scalability for disk storage management, allowing for controlled data growth.
99+
100+
- **Role in the architecture**:
101+
Allocates dedicated logical volumes for organized storage of the web application, PostgreSQL database, and automated backups. It allows resizing storage dynamically without service disruption, ensuring scalability and continuous operation.
102+
103+
104+
## How the Components Work Together
105+
-----------------------------------
106+
Incoming Requests enter the system by the UFW, which is mean to ensure that only
107+
legitimate traffic is allowed, by restricting access to only specific ports for HTTP and HTTPS.
108+
Once validated, Nginx is in charge of processing this requests, and forwarding to the web
109+
application.
110+
The Django web application handles the user interaction and requests so that when data is
111+
required, it interacts with the PostgreSQL database. The database is isolated in its own
112+
pg_volume, ensuring efficiency in the performance and better security. Automated backups
113+
are scheduled at a certain time of the day to provide recoveries. Backups include all the
114+
database files from the pg_volume. These backups are stored in another dedicated
115+
backup_volume, for an easy recovery in case of system failures.
116+
Regarding the monitoring, the system monitoring tools have alerts configured to detect
117+
potential issues to encourage their fast resolution.
118+
In terms of scalability, the LVM makes the architecture designed for future growth. Either if
119+
user demands or data volume increases, the storage volumes can be resized dynamically
120+
without disrupting the system.
121+
122+
123+
## Reason of The Chosen Architecture
124+
--------------------------------------
125+
This architecture establishes security by controlling invalid access and filter the malicious
126+
requests. It has great level of reliability, since the components are isolated and the possibility
127+
of having issues does not mean having them everywhere but only in their own isolated
128+
environment. The automated backups protect the system from disasters. Moreover, the
129+
architecture provides scalability, performance metrics and management easiness where
130+
manual effort for backups is reduced and logical volumes also simplify the disk management.
131+
132+
133+
134+
## Implementation Guide
135+
136+
For the full implementation Guide see [Linux Environment Documentation PDF](./docs/Linux Environment Documentation.pdf)
137+

Docs/img.png

126 KB
Loading

ML_pipeline/Ubuntu_files/flask_inference.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

ML_pipeline/Ubuntu_files/process_prometheus_data.py

Lines changed: 0 additions & 112 deletions
This file was deleted.

0 commit comments

Comments
 (0)