Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aliartiza75/flask-frontend-application
Front-end application build in flask, its backend api's exists in aliartiza75/ht-be repository.
https://github.com/aliartiza75/flask-frontend-application
docker dockerfiles flask helm kubernetes
Last synced: about 1 month ago
JSON representation
Front-end application build in flask, its backend api's exists in aliartiza75/ht-be repository.
- Host: GitHub
- URL: https://github.com/aliartiza75/flask-frontend-application
- Owner: aliartiza75
- Created: 2019-02-09T06:56:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-26T00:09:58.000Z (4 months ago)
- Last Synced: 2024-11-18T08:29:16.660Z (3 months ago)
- Topics: docker, dockerfiles, flask, helm, kubernetes
- Language: Python
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)[](https://sonarcloud.io/summary/new_code?id=aliartiza75_flask-frontend-application)
# Flask Frontend Application
This repository contains frontend logic and kubernetes manifests. I have used `minikube` for this project. Installation steps is given in this [gist](https://gist.github.com/aliartiza75/3a34f059de62c7de04727dae6a363ea8)
# Guidelines for containerizing frontend
* Building image
```bash
sudo docker build -t ht-fe:0.0.1 -f Dockerfile .
```* To run docker container on host machine
```bash
sudo docker run -e FLASK_ENV=development -e FLASK_HOST_IP=0.0.0.0 -e=FLASK_HOST_PORT=5001 -e BE_IP_ADDR=<172.17.0.4>:5001 -p 9002:5001 ht-fe:0.0.1
```# Kubernetes deployment Guidelines
Before the creation of frontend deployement, backend deployment and service *must* be created. Guideline for creating the backend deployment and service is given in the `README.md` file of backend respository. Once pre-requisites are completed. Frontend `deployment.yaml` file must be updated by changing the `BE_IP_ADDR` env variable with the ip address of the backend pod.
* To get the ip address of the backend pod, use the command given below:
```bash
# to get pod list
sudo kubectl get pods# to get the information of the backend pod
sudo kubectl describe pod
```* Once the above changes are done, create the frontend deployment.
```bash
sudo kubectl apply -f deployment.yaml
```* To create the frontend service
```bash
sudo kubectl apply -f htfe_service.yaml
```
* To access the frontend service
```bash
# to get list of services, copy the CLUSTER_IP
sudo kubectl get service# Open the browser and type this URL. It will display a web page containing two buttons. The Get Date button will call the backend service
http://CLUSTER_IP:5002
```* To curl the backend service from frontend pod
```bash
# To get pod list.
sudo kubectl get pods# Copy the pod id of the frontend service and use the command below to enter the pod
sudo kubectl exec -it /bin/bash# To curl the backend service
curl -X GET "http://:5001/datetime"
```# Guidelines for helm charts deployment
* Helm installation guidelines [link](https://helm.sh/docs/install/#installing-the-helm-client)* Once the helm is installed, use the command given below to install tiller in kubernetes cluster:
```bash
helm init
```* To create a helm chart folder:
```bash
helm create
```* To dry run the helm chart for debugging:
```bash
sudo helm install --dry-run --debug
```* To purge a release
```bash
sudo helm del --purge
```* To check the status of a release
```bash
sudo helm ls --all
```* To search a helm package name
```bash
sudo helm search
```* To create a package from the helm charts folder
```bash
sudo helm package
```# Important Notes
* Start the minikube cluster in the virtual machine drive in none mode [--vm-driver=none], otherwise services will not be accessible.
* Minikube will pull images from the dockerhub.
* In some cases minikube cluster doesn't work properly, one quick fix is to delete the cluster and restart the minikube cluster.