Skip to content

oumaima-kboubi/Scouts-Tunisia-Camp-System

Repository files navigation

Scouts-Tunisia-Camp-System 🏕️

Table of Contents
  1. About The Project
  2. Getting Started
  3. Devops
  4. CI pipeline
  5. The App frontend Overview
  6. Contact

About this project 🤔

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 🔝)

Architecture🧱

image

Built With 🛠️

  • 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.

Containerization Solution 🛢️

  • Docker, a solution for building,sharing and running application images.

Orchestration Solution 🎵

  • Kubernetes a solution for orchestrating containers.

Provisioning Solution ☁️

  • Terraform, a solution for provisioning, changing, and versioning resources on any environment.

Monitoring Solution 👀

  • 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 🔝)

Getting Started 🎉

In order to run this project and extend its functionalities you need to follow some few steps :

Prerequisites 🧷

  • 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.

Installation 🔧

  1. Clone the repo
    git clone https://github.com/oumaima-kboubi/Scouts-Tunisia-Camp-System.git
If you want to build on top of the project
  1. Install NPM packages under each project
    npm install
  2. 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
    ...
  3. 2- run all projects, ensure that all ports are well set and enjoy!
Or if you want to use docker
  1. make sure you have docker installed.

  2. 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
  1. 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
Or if you want to use terraform and helm
  1. 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 🔝)

Devops ♾️

This project implement the principles of observability, automation and deployment like so:

Observabalitiy 👀

1- Metrics

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:

image

image

⚡We can use more sophisticated tools like Prometheus & Grafana Dashboarding tool:

  • Prometheus is scrapping all the pods

image

  • Grafana Dashboarding for the business metrics and some other general metrics

image

image

2- Logs

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

image

  • A structured requests is formated into a JSON document according to the labels specified in its implementation.

image

Automation ⚡

Microstacks

The goal of microstacks is to create a well isolated and maintainable infrastructure layers.

  1. First Stack: This stack is dedicated to the kubernetes cluster provisioning.

  2. Second Stack: this stack takes care of creating the infrastructure for this project.

  3. Third Stack: This section takes care of installing ingress-controller in the cluster

  4. 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
PS ( the cluster and the backend are in diffrent regions because of subscription limit )

image

image

Deployment ☁️

YAML files

Each of the services has its own YAML files in an ordred way

  1. 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

  1. Service

  2. Ingress

  3. Secrets

💡 These files varies from a service to an other depnding on its requirements

HELM Chart

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 🔝)

CI pipeline ♾️

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.

image

  • These are the images in the Dokerhub repo

image

The App frontend Overview💻

( in case when you saw the repository i run out of credit 🤷🏼‍♀️)
  • Login Page

image

  • Register Page

image

  • My Space Page

image

  • Add Memory Page

image

  • Edit Memory Page

image

  • Commun Memories Space Page

image

( Go to the 🔝)

Contact 📞

📧 Oumaima Kboubi - Kaboubioumaima@gmail.com

My CV Website

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages