This repository contains a simple Poker Session Logging Application designed to demonstrate various DevOps practices, including containerization, orchestration, monitoring, and CI/CD. The main goal is to showcase a basic application and the implementation of DevOps tools and workflows around it.
- FastAPI Application: A RESTful API to log poker sessions.
- Dockerized: The application is containerized using Docker.
- Kubernetes: Deployment on a local Minikube cluster using Kubernetes.
- Helm Charts: Kubernetes manifests converted to Helm charts for easier deployment.
- Monitoring: Integration with Prometheus for monitoring and Grafana for visualization.
- CI/CD: Automated CI/CD pipeline using GitHub Actions.
- Docker
- Minikube
- kubectl
- Helm
- GitHub account (for CI/CD)
-
Clone the repository:
git clone https://github.com/SkanderGhariani/devops-project.git cd devops-project
-
Build and run the Docker container:
docker build -t poker-session-app . docker run -p 8000:8000 poker-session-app
-
Start Minikube:
minikube start
-
Deploy the application using Helm:
helm install poker-app helm/poker-app
-
Forward the service port to access the application:
kubectl port-forward svc/poker-session-service -n poker-app 8000:80 &
-
Deploy Prometheus and Grafana using Helm:
helm install prometheus stable/prometheus helm install grafana stable/grafana
-
Forward the service ports to access Prometheus and Grafana:
- Prometheus:
kubectl port-forward svc/prometheus-server -n poker-app 9090:80
- Grafana:
kubectl port-forward svc/grafana 3000:80 -n poker-app
- Prometheus:
-
Configure Prometheus with alerting rules:
apiVersion: v1 kind: ConfigMap metadata: name: prometheus-alert-rules namespace: poker-app data: alerting_rules.yaml: | groups: - name: example rules: - alert: HighErrorRate expr: rate(http_requests_total{status=~"4..|5.."}[1m]) > 0.05 for: 1m labels: severity: page annotations: summary: "High error rate detected" description: "High error rate detected for the past 1 minutes."
-
Apply the ConfigMap:
kubectl apply -f path/to/alerting_rules.yaml
-
GitHub Actions workflow is set up to automate testing and deployment. On every push, the workflow will:
- Build and test the Docker image
- Push the image to Docker Hub
- Deploy the application to the Minikube cluster
-
To view and customize the workflow, check
.github/workflows/ci-cd.yml
in the repository.
This project demonstrates the implementation of a simple application with various DevOps tools and practices. Feel free to explore the repository and use it as a reference for your DevOps learning journey.