An open API service indexing awesome lists of open source software.

https://github.com/yashindane/lbph-devops

LinuxWorld Informatics Pvt Ltd. Summer Project ✨
https://github.com/yashindane/lbph-devops

Last synced: 8 months ago
JSON representation

LinuxWorld Informatics Pvt Ltd. Summer Project ✨

Awesome Lists containing this project

README

          

# lbph-devops

![lbph-readme](https://user-images.githubusercontent.com/53041219/207011037-07436fc3-1a7c-4200-9ba2-aa558781f4a1.png)

🎥 Demo link -> [Link](https://www.linkedin.com/posts/yash-indane-aa6534179_devopstools-devops-awscloud-activity-6837735602532687872-NrS-)

📃 Project Certificate -> [Link](https://www.linkedin.com/posts/yash-indane-aa6534179_linuxworld-informatics-pvt-ltd-summer-project-activity-6846320944047357952-bJGm)

## Setup

The following things need to be present on the VM where the job will run:

### 1. Python

### 2. kubectl

Download by :

```
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
```

Install by :

```
$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
```

### 3. aws cli

```
$ yum install aws -y
```

### 4. git

```
$ yum install git -y
```

### 5. docker

For RHEL VM ->

Configure a repo for docker

```
[docker]
baseurl=https://download.docker.com/linux/centos/7/x86_64/stable/
gpgcheck=0
```

```
$ yum install docker-ce --nobest
```

For Amazon Linux ->

```
$ yum whatprovides docker
```

```
$ yum install
```

### 6. cv2

```
$ pip3 install --upgrade pip setuptools wheel
```

```
$ pip3 install opencv-python
```

```
$ yum install opencv opencv-devel opencv-python
```

LBPH requires a library called `opencv-contrib-python`

```
$ pip3 install opencv-contrib-python
```

## Other Settings

### Adding Webhhook

### Jenkins Job

Select Build as Execute Shell ->

![jenkins_build](https://user-images.githubusercontent.com/53041219/207033892-a734d32c-6990-4276-af8a-8ac14761089f.png)

### Log in to the DockerHub account

It is required to login from the Jenkins sever to the account on docker Hub where the new container-image will be pushed

```
$ docker login -u -p
```

### AWS login

It is required to login from the Jenkins server with the user account that created the `EKS cluster` in AWS.

```
$ aws configure
```

### Connecting to EKS cluster

Configure a EKS cluster in AWS and connect to it from the Jenkins server

```
$ aws eks update-kubeconfig --region --name
```

To check if connected successfully run

```
$ kubectl get nodes
```

### docker and jenkins setup

This has to be done so that Jenkins can run docker commands

```
$ systemctl start docker
```

```
$ usermod -aG docker jenkins
```

```
$ systemctl restart jenkins
```

```
$ setenforce 0
```

### Important Note

Name the initial deployment name `face-app-deployment` and name of EKS cluster as `face-app`

Initially any container-image can be used from this repo -> [Link](https://hub.docker.com/repository/docker/yashindane/lbphrecog)

## Working

Upload a folder (the name of the folder should be name of person) , which has 100 images of that person's face.

Code for getting the cropped face images -> [Link](https://github.com/YashIndane/face-cropper/blob/main/cropped_face_generator.py)

When the folder is uploaded to this repository, this triggers the `Jenkins job` via a hook trigger. The repo is now cloned inside the job workspace.

The Jenkins job executes the `code_builder.sh` script. This script builds code to train the LBPH model and saves the models. Similarly the backend code for LBPH recognition is build and saved.

Now the new docker image is build and pushed to Docker hub, and then a rolling update command is executed by the `job`, so that the `EKS cluster` uses the updated image.