|
| 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 | + |
| 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 | + |
0 commit comments