From 9b1869ac14bf62239bda76413ed7b94c5a49d278 Mon Sep 17 00:00:00 2001 From: danielcruzmx Date: Wed, 11 Mar 2026 18:18:42 -0600 Subject: [PATCH] agregando fastapi --- apps/api/Containerfile | 5 +++ .../api/code/__pycache__/main.cpython-311.pyc | Bin 0 -> 430 bytes apps/api/code/main.py | 7 ++++ apps/api/requirements.txt | 8 +++++ infra/api_pod.yaml | 33 ++++++++++++++++++ infra/db_pod.yaml | 6 ++-- 6 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 apps/api/Containerfile create mode 100644 apps/api/code/__pycache__/main.cpython-311.pyc create mode 100644 apps/api/code/main.py create mode 100644 apps/api/requirements.txt create mode 100644 infra/api_pod.yaml diff --git a/apps/api/Containerfile b/apps/api/Containerfile new file mode 100644 index 0000000..752fa42 --- /dev/null +++ b/apps/api/Containerfile @@ -0,0 +1,5 @@ +FROM python:3.11-slim +COPY . /home +WORKDIR /home +RUN pip install --upgrade pip +RUN pip install --no-cache-dir -r requirements.txt diff --git a/apps/api/code/__pycache__/main.cpython-311.pyc b/apps/api/code/__pycache__/main.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9e5879c96b567f5b453a73e86d5528d4e1e8d898 GIT binary patch literal 430 zcmZ3^%ge<81O_adGSh(cV-N=hn4yf%NkGPQh7^Vr#vF!R#wbQc1}277#$`a!)iAXT zQB0{!3t&3nq98^J(=tY&N+5=S6y_ENG`%b-EWr$#tS>8_ sZ_I4TY+!!C$kHy}B;Fz1DAOYIfr*h(;sXPa_{hw_#D^>Z76n@f0FFIVYXATM literal 0 HcmV?d00001 diff --git a/apps/api/code/main.py b/apps/api/code/main.py new file mode 100644 index 0000000..ddc240c --- /dev/null +++ b/apps/api/code/main.py @@ -0,0 +1,7 @@ +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/") +async def root(): + return("Hola Mundo") diff --git a/apps/api/requirements.txt b/apps/api/requirements.txt new file mode 100644 index 0000000..e2de34a --- /dev/null +++ b/apps/api/requirements.txt @@ -0,0 +1,8 @@ +fastapi +redis +gunicorn +postgres +uvicorn +SQLAlchemy +pydantic +databases diff --git a/infra/api_pod.yaml b/infra/api_pod.yaml new file mode 100644 index 0000000..dc0e42c --- /dev/null +++ b/infra/api_pod.yaml @@ -0,0 +1,33 @@ +--- +apiVersion: v1 + +kind: Pod + +metadata: + name: api_stack_pod + labels: + app: ciec_stack + +spec: + containers: + - name: fastapi-app + image: localhost/fastapi + command: ["uvicorn","main:app","--host=0.0.0.0","--port=8000","--reload"] + ports: + - containerPort: 8000 + hostPort: 8082 + envFrom: + - configMapRef: + name: ciec-config + volumeMounts: + - name: apps-storage + mountPath: /home + - name: redis-cache + image: docker.io/library/redis:latest + ports: + - containerPort: 6379 + volumes: + - name: apps-storage + hostPath: + path: /home/danielcruzmx/projecto_ciec_v6/apps/api/code + type: DirectoryOrCreate diff --git a/infra/db_pod.yaml b/infra/db_pod.yaml index 43b3c81..120d6d9 100644 --- a/infra/db_pod.yaml +++ b/infra/db_pod.yaml @@ -6,7 +6,7 @@ kind: Pod metadata: name: db_stack_pod labels: - app: db_stack + app: ciec_stack spec: containers: @@ -16,7 +16,7 @@ spec: - containerPort: 5432 envFrom: - configMapRef: - name: postgres-config + name: ciec-config volumeMounts: - name: postgres-storage mountPath: /var/lib/postgresql @@ -27,7 +27,7 @@ spec: hostPort: 8081 envFrom: - configMapRef: - name: postgres-config + name: ciec-config volumeMounts: - name: pgadmin-data mountPath: /var/lib/pgadmin