DevOps Course Project - MiniTwit
Project Overview and Objective
The MiniTwit project is a scaled-down Twitter-like web application developed for the DevOps course, focusing on implementing DevOps practices to ensure a resilient, scalable, and efficient system. The project emphasizes continuous integration and deployment, monitoring, and logging within a Docker-based infrastructure. This application has been re-engineered from its original Python version into a Go and React stack, aligning it with modern development standards and offering a robust platform for continuous delivery.
Technical Stack and Dependencies
MiniTwit is developed using Go for the backend, leveraging the GORM ORM for database interactions and the Gorilla toolkit for simplified API handling. The frontend is built with React, which replaced the initial Go templates, enhancing interactivity and user experience. Infrastructure is containerized through Docker, with Docker Swarm providing the necessary orchestration for scaling and load distribution. Prometheus and Grafana are used for real-time monitoring and visualization, and Loki supports efficient logging.
CI/CD Pipeline and Automation
The MiniTwit project incorporates a detailed CI/CD pipeline configured through GitHub Actions. Upon a pull request, the pipeline initiates several quality checks, including code analysis via SonarCloud and CodeClimate, Docker security scans, and static code analysis. If approved, the pipeline merges changes to the main branch, synchronizing updates with the production environment on DigitalOcean. This deployment uses a blue-green strategy in Docker Swarm, which minimizes downtime and enables seamless updates. The automated testing and deployment pipeline not only ensures code quality but also streamlines the development process, enabling rapid and reliable feature delivery.
Monitoring, Logging, and Security
For monitoring, Prometheus collects metrics from exposed endpoints, which Grafana visualizes on customizable dashboards. This setup aids in tracking critical performance metrics, such as user interactions and server health. Loki aggregates logs from system outputs, with Grafana providing an accessible interface for log review. Security measures include regular vulnerability scans with Docker Scout, automated security checks through the CI/CD pipeline, and proactive monitoring to address potential risks. Port scanning and code analysis tools like Nmap and Skipfish further enhance the application’s security posture.
Scaling Strategy and Infrastructure Management
The Docker Swarm orchestrator distributes workloads across multiple nodes, enabling horizontal scaling. The use of a manager node as a load balancer enhances system availability, while worker nodes handle application-specific tasks. Additionally, the project utilizes Terraform for infrastructure as code (IaC), which simplifies resource provisioning on DigitalOcean and allows for easy vertical scaling adjustments. This infrastructure configuration supports both horizontal and vertical scaling, ensuring the system can adapt to varying loads and minimizing the risk of single points of failure.