Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	docker-compose.yaml
  • Loading branch information
nakira974 committed Apr 19, 2023
2 parents 60c0c17 + 2bc779e commit 63ccf12
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 35 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ on:
branches: [ "master" ]

jobs:

login:
runs-on: ubuntu-latest
steps:
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
build:

runs-on: ubuntu-latest
Expand Down
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# k8s-image-recognition

This repository was made for my Final engineering study project at Unilasalle Amiens France, thank you to the staff of the school as well as to the teachers for these 3 years which complete my 6 years of studies in the field of software and system/network engineering.

A simple Image recognition model exposed on uvicorn, exposed by an Actix reverse proxy,
that runs in a k8s cluster hosted on aws
### Linux/MacOS
It concists in a simple automated k8s cluster build on AWS deploying an actix_web reverse proxy API to call an inference of google/pix2struct model that i trained for french road signs, stored in Huggingface.co.

CI\CD are building docker images resulting from the main branch's content.

## How to Use :
```shell
kompose convert -f .\docker-compose.yml
kubectl --kubeconfig=<Path to your configuration> apply -f .
kubectl get pod
kubectl get service
kubectl get deployment
```
### Linux/MacOS Image build requierments
```shell
echo "HUGGING_FACE_TOKEN=YOUR_HUGGINGFACE_TOKEN_TO_YOUR_MODEL" > ./descrivizio001/.env
```
### Windows
### Windows build requierments
```shell
New-Item -ItemType File -Path ".\descrivizio001\.env" -Value "HUGGING_FACE_TOKEN=YOUR_HUGGINGFACE_TOKEN_TO_YOUR_MODEL"
```

![k8s-load-balanced.drawio.png](doc%2Frsc%2Fimg%2Fk8s-load-balanced.drawio.png)
![k8s-load-balanced.drawio.png](doc%2Frsc%2Fimg%2Fk8s-load-balanced.drawio.png)
6 changes: 4 additions & 2 deletions aws_terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ resource "aws_nat_gateway" "nat" {
}

resource "aws_instance" "k8s_node" {
vpc_security_group_ids = [aws_vpc.k8s_vpc.default_security_group_id]
ami = "ami-064087b8d355e9051"
instance_type = "t3.medium"
associate_public_ip_address = true
Expand All @@ -63,7 +64,8 @@ resource "aws_instance" "k8s_master" {
associate_public_ip_address = true
instance_type = "t3.medium"

subnet_id = aws_subnet.public[0].id
vpc_security_group_ids = [aws_vpc.k8s_vpc.default_security_group_id]
subnet_id = aws_subnet.public[0].id
availability_zone = data.aws_availability_zones.available.names[0] # Specify the same availability zone as the associated ENI
#key_name= "nakira974-ssh"

Expand Down Expand Up @@ -339,4 +341,4 @@ output "public_ips" {
aws_instance.k8s_master.public_ip,
aws_instance.k8s_node.*.public_ip
]
}
}
27 changes: 0 additions & 27 deletions dev.docker-compose.yaml

This file was deleted.

15 changes: 15 additions & 0 deletions kube-docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"

services:
descrivizio001:
image : nakiradu77/k8s-image-recognition-descrivizio001:latest
ports:
- "7777:7777"
hostname: descrivizio001

descrivizio001-api:
image: nakiradu77/k8s-image-recognition-descrivizio001-api:latest
ports:
- "8085:8085"
depends_on:
- descrivizio001

0 comments on commit 63ccf12

Please sign in to comment.