https://github.com/laurobmb/fastapi
olá, esse repositório é um exemplo de caso usando a ferramenta FASTAPI dentro de um container para coletar dados do host, este repositório é voltado para estudo.
https://github.com/laurobmb/fastapi
applicationset docker dockerfile fastapi kubernetes kustomize openshift podman python python3 uvicorn
Last synced: about 1 month ago
JSON representation
olá, esse repositório é um exemplo de caso usando a ferramenta FASTAPI dentro de um container para coletar dados do host, este repositório é voltado para estudo.
- Host: GitHub
- URL: https://github.com/laurobmb/fastapi
- Owner: laurobmb
- Created: 2020-06-26T16:21:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-26T20:10:25.000Z (about 1 year ago)
- Last Synced: 2025-03-26T21:23:17.034Z (about 1 year ago)
- Topics: applicationset, docker, dockerfile, fastapi, kubernetes, kustomize, openshift, podman, python, python3, uvicorn
- Language: HTML
- Homepage:
- Size: 182 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FastAPI using Docker
[](https://quay.io/repository/laurobmb/python_fastapi)




This project is using FASTAPI inside a container. Just compile the Dockerfile and run it on the host
## Build
podman build -t fastapi:v1.0 .
## Execute
podman run -it -p 8000:8000 fastapi:v1.0
## Deploy Kubernetes with YAML
kubectl apply -f k8s/deployment.yaml
## Deploy OCP
### Configurando projeto
oc new-project fastapi
### Deploy
oc new-app --name fastapi --labels app=fastapi https://github.com/laurobmb/fastapi.git#master --context-dir app --strategy=docker --env ENVIROMENT="prod"
oc new-app --name fastapi --labels app=fastapi https://github.com/laurobmb/fastapi.git#master --context-dir app --strategy=source --env ENVIROMENT="prod"
### Expor rota
oc -n fastapi expose service fastapi
oc -n fastapi expose service fastapi --name fastapi-hml --hostname fastapi-fastapi.hml.lagomes.rhbr-lab.com
oc -n fastapi create route edge fastapi-tls --service fastapi
### Create secret
oc -n fastapi create secret generic fastapi-secret --from-literal=username=admin --from-literal=password=secret
oc -n fastapi set env --from=secret/fastapi-secret deployment/fastapi
oc -n fastapi set volume deployment/fastapi --name=secrets-vol --add --mount-path=/opt/secrets/ --secret-name=fastapi-secret --overwrite
### Create configmap
oc -n fastapi create configmap fastapi-page --from-literal=index.html='
This is a configmap file from production environment
'
oc -n fastapi set volume deployment/fastapi --name=page-vol --add --mount-path=/opt/config/ --configmap-name=fastapi-page --overwrite
### Create resources limits
oc -n fastapi set resources deployment/fastapi --limits=cpu=200m,memory=128Mi --requests=cpu=100m,memory=64Mi
oc -n fastapi autoscale deployment fastapi --max 10 --min 3 --cpu-percent=80
oc -n fastapi create quota fastapi-quota --hard=cpu=500m,memory=500Mi
### Create healthcheck
oc -n fastapi set probe deployment/fastapi --readiness --initial-delay-seconds=10 --timeout-seconds=30 --get-url=http://:8080/health
oc -n fastapi set probe deployment/fastapi --liveness --initial-delay-seconds=10 --timeout-seconds=30 --get-url=http://:8080/health