Table of Contents
This project is part of DevOps Lab for the GL5 DevOps field. We are meant to create a distributed application, then use it with different tools to put to real field different DevOps concepts.
Scouts Tunisia Camp System is an application that offers you a safe space to share your memories in your scouting adventures & camps and explore & like other's memories. It's a Frontend/Backend application with basic CRUD features and a DB connection.
You can access the Memory Space here 🥳
It uses the monorepo strategy ✅:
1- ⚡ front-service/tunisian-scouts-system-app : The frontend application that will be exposed to the users.
2- ⚡ auth-service: a service that handles authentification and users.
3- ⚡ reservation-service: the core of the application (CRUD functions).
4- ⚡ infrastructure: diffrent files to prepare the deployment of the app infra and the app setup.
5- ⚡ terraform-microstacks: terraform files to initiate the infrastructure of the project.
( Go to the 🔝)
- NodeJS, As an asynchronous event-driven JavaScript runtime framework for building server-side applications.
- ExpressJS, A minimalist and flexible Node.js web application infrastructure.
- Angular, A component-based framework for building scalable web applications.
- Atlas MongoDB, A fully-managed cloud database that handles all the deploying, managing, and healing DB deployments on the Azure cloud service provider.
- NPM A package manager.
- HELM A package manager for Kubernetes.
- Docker, a solution for building,sharing and running application images.
- Kubernetes a solution for orchestrating containers.
- Terraform, a solution for provisioning, changing, and versioning resources on any environment.
- Prometheus An open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.
- Grafana Grafana is the open source analytics & monitoring solution for every database.
- DataDog Datadog is a monitoring and analytics tool that can be used to determine performance metrics as well as event monitoring for infrastructure and cloud services.
- ArgoCd declarative, GitOps continuous delivery tool for Kubernetes.
( Go to the 🔝)
In order to run this project and extend its functionalities you need to follow some few steps :
- Make sure that Node.js (>= 10.13.0) is installed on your operating system. ( Download Here)
- Make sure that Docker is installed.
- Make sure that Helm and terraform are installed.
- Clone the repo
git clone https://github.com/oumaima-kboubi/Scouts-Tunisia-Camp-System.git
- Install NPM packages under each project
npm install
- 1- Add a .env file for required projects
#AUTH-SERVICE MONGO_URI="MongoDb connection string" # for auth-service APP_PORT=3001 TOKEN_KEY="whatever you choose" # for the JWT Token #RESERVATION-SERVICE MONGO_URI="MongoDb connection string" # for reservation-service APP_PORT=3002 ...
- 2- run all projects, ensure that all ports are well set and enjoy!
-
make sure you have docker installed.
-
1- pull the images :
docker pull oumaimakboubi/ms-auth:latest # auth-service
docker pull oumaimakboubi/ms-reservation:latest # reservation-service
docker pull oumaimakboubi/ms-front:latest # front-service
- 2- run the following docker run command:
sudo docker run -d -p 3001:3001 --name ms-auth oumaimakboubi/ms-auth:latest
sudo docker run -d -p 3002:3002 --name ms-auth oumaimakboubi/ms-reservation:latest
sudo docker run -d -p 4200:4200 --name ms-auth oumaimakboubi/ms-front:latest
- make sure you have terraform and helm installed.
4.1 make sure you have an azure account and a valid connection
4.2 run the following terrafom commands in each microstack:
terraform init
terraform apply
( Go to the 🔝)
This project implement the principles of observability, automation and deployment like so:
I used prometheus
and and prom-client
in NodeJS to expose http metrics (number of total requests ... ).
Business logic metrics : i used business related metrcis which presents a general statistics on the App (number of successful login requests, number of added memory articles ..)
⚡First Of all every service has its own metrics routes:
⚡We can use more sophisticated tools like Prometheus & Grafana Dashboarding tool:
- Prometheus is scrapping all the pods
- Grafana Dashboarding for the business metrics and some other general metrics
I used the implemented Logger
logic in NodeJS and just added a request id , a timestamp of the request as well as different levels of logs. All the structured requests are gathered by DataDog
- A structured requests is formated into a JSON document according to the labels specified in its implementation.
The goal of microstacks is to create a well isolated and maintainable infrastructure layers.
-
First Stack: This stack is dedicated to the kubernetes cluster provisioning.
-
Second Stack: this stack takes care of creating the infrastructure for this project.
-
Third Stack: This section takes care of installing ingress-controller in the cluster
-
Fourth Stack: Setting up observability layer in the cluster
- The following is the resource groupe overview: kubernetes cluster + a container to persist the TF State
Each of the services has its own YAML files in an ordred way
- Deployment we can add arbitrary labels by chnaging the
values.yaml
file in this section
labelsAuth: #auth-service
app: ms-auth
env: production
labelsRes: #reservation-service
app: ms-reservation
env: production
labelsFront: #front-service
app: ms-front
env: production
-
Service
-
Ingress
-
Secrets
💡 These files varies from a service to an other depnding on its requirements
I used Helm Charts to facilitate the use of Terraform microstacks when installing the infrastructure and the app
The helm chart can be configured through this file values.yaml
fot it to be more generic and empowers scalability and maintenability.
deployment:
replicas: 3
image:
tag: latest
authname: oumaimakboubi/ms-auth:latest
reservationname: oumaimakboubi/ms-reservation:latest
frontname: oumaimakboubi/ms-front:latest
http:
frontendport: 4200
authport: 3001
reservationport: 3002
labelsAuth: # This is a way to add arbitrary labels to the deployments
app: ms-auth
env: production
labelsRes:
app: ms-reservation
env: production
labelsFront:
app: ms-front
env: production
Concerning the deployment strategy I couldn't work on that due to time contraint but I choose a blue/green deployment because I want to maintain two identical production environments. The use case of this app consists on having an app that is always up and running especially during the national and international camps ( A/B testing won't be the best choice in this case). So during the deployment i need to have one environment which is the active environment (blue) and the other is inactive (green). During an update I wanted the new version deployed and tested and redirecting the user's traffic after it has been verified to be working as it should.
( Go to the 🔝)
The project pipeline code can be found under .github/workflows
, this is a simple pipeline that just ensures at each push command to the github repo to build the image then save it in the DOCKERHUB repo.
- All the jobs are running in parrallel in order to make the image building and pushing musch faster.
- These are the images in the Dokerhub repo
- Login Page
- Register Page
- My Space Page
- Add Memory Page
- Edit Memory Page
- Commun Memories Space Page
( Go to the 🔝)
📧 Oumaima Kboubi - Kaboubioumaima@gmail.com
My CV Website