Compare commits
3 Commits
6b381a8f89
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c18e48133b | |||
| 86cc2c1c69 | |||
| 576fe12817 |
13
Dockerfile
13
Dockerfile
@@ -1,13 +0,0 @@
|
|||||||
FROM python:3.12-slim
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY requirements.txt .
|
|
||||||
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
COPY app/ ./app/
|
|
||||||
|
|
||||||
EXPOSE 8000
|
|
||||||
|
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
||||||
27
app/main.py
27
app/main.py
@@ -1,27 +0,0 @@
|
|||||||
import os, signal
|
|
||||||
from fastapi import FastAPI
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
_healthy = True
|
|
||||||
|
|
||||||
@app.get("/")
|
|
||||||
def root ():
|
|
||||||
return {"poruka": "Hello iz mog Docker containera v2!"}
|
|
||||||
|
|
||||||
@app.get("/info")
|
|
||||||
def info():
|
|
||||||
return {
|
|
||||||
"python": platform.python_version(),
|
|
||||||
"verzija": "2.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
@app.get("/health")
|
|
||||||
def health():
|
|
||||||
return {"status": "ok"}
|
|
||||||
|
|
||||||
@app.post("/break")
|
|
||||||
def break_health():
|
|
||||||
"""Simulira pad servisa za testiranje liveness probe-a"""
|
|
||||||
global _healthy
|
|
||||||
_healthy = False
|
|
||||||
return {"message": "Servis je sada nezdrav — ocekuj restart"}
|
|
||||||
@@ -16,7 +16,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: moj-servis
|
- name: moj-servis
|
||||||
image: git.fpmoz.sum.ba/mirko416/moj-servis:2.0
|
image: git.fpmoz.sum.ba/mirko416/moj-servis:1.1
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
# ── Liveness: je li proces živ? ─────────────────
|
# ── Liveness: je li proces živ? ─────────────────
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ metadata:
|
|||||||
name: moj-servis-ingress
|
name: moj-servis-ingress
|
||||||
namespace: student-mirko416
|
namespace: student-mirko416
|
||||||
annotations:
|
annotations:
|
||||||
traefik.ingress.kubernetes.io/router.entrypoints: web
|
traefik.ingress.kubernetes.io/router.entrypoints: web,websecure
|
||||||
|
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||||
spec:
|
spec:
|
||||||
|
ingressClassName: traefik
|
||||||
rules:
|
rules:
|
||||||
- host: mirko416.argocd.fpmoz.sum.ba
|
- host: moj-servis-mirko416.argocd.fpmoz.sum.ba
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ spec:
|
|||||||
- port: 80
|
- port: 80
|
||||||
targetPort: 8000
|
targetPort: 8000
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
type: NodePort
|
type: ClusterIP
|
||||||
|
|||||||
Submodule manifesti deleted from 2d93d7175f
@@ -1,2 +0,0 @@
|
|||||||
fastapi==0.111.0
|
|
||||||
uvicorn[standard]==0.29.0
|
|
||||||
Reference in New Issue
Block a user