Create a virtual environment
virtualenv env
Start the frontend
Add the following .env
file in the frontend
directory
BACKEND_HOST=backend-service
BACKEND_PORT=8000
Install dependencies
cd frontend
pip install -r requirements.txt
python3 main.py
Start the backend
Add the following .env
file in the backend
directory
MODEL_PATH=Rumesh/mbart-si-simp
MAX_LENGTH=700
NUM_BEAMS=5
TASK=com-sim
ENABLE_METRICS=1
REDIS_HOST=redis-service
REDIS_PORT=6379
Install dependencies
cd backend
pip install -r requirements.txt -r requirements-local.txt
python3 main.py
Install Docker: Refer - https://docs.docker.com/engine/install/ubuntu/
Add the .env
files to the respective directories.
From the root of the repository,
docker-compose up --build
Login to docker hub
docker login
Build and push the docker images
cd backend
docker build -t rumeshms16/mabrt-simp:1.0.0 .
docker push rumeshms16/mabrt-simp:1.0.0
cd frontend
docker build -t rumeshms16/simp-frontend:1.0.0 .
docker push rumeshms16/simp-frontend:1.0.0
See k8s-resources
Install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Install minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb
Install Helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
Add the grafana chart to Helm
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
Start minikube
minikube start
Run the minikube dashboard (optional)
minikube dashboard &
Add monitoring tools: Grafana, Loki, Promtail
helm upgrade --install loki grafana/loki-stack --set grafana.enabled=true,prometheus.enabled=true,prometheus.alertmanager.persistentVolume.enabled=false,prometheus.server.persistentVolume.enabled=false --set-file extraScrapeConfigs=k8s-resources/extraScrapeConfigs.yaml --set-file prometheus.extraScrapeConfigs=extraScrapeConfigs.yaml
The --set-file flag sets the prometheus config required for prometheus to scrape metrics from the backend.
Deploy the application on k8s
helm install mbart-deploy ./helm-chart
Access Grafana: get the admin
password
kubectl get secret --namespace default loki-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
Port forward to access services
kubectl port-forward svc/frontend-service 5000:5000 --address=0.0.0.0 &
kubectl port-forward svc/loki-grafana 3000:80 --address=0.0.0.0 &
todo
We use Prometheus to collect metrics, Loki to collect logs, and Grafana to visualize them. todo
see test