new version 1.1
All checks were successful
CI/CD Pipeline / build (push) Successful in 1m27s
CI/CD Pipeline / deploy (push) Successful in 2m9s

This commit is contained in:
2026-04-30 17:34:02 +02:00
parent 38388223ec
commit 3b46662807
2 changed files with 12 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ spec:
- name: gitea-creds - name: gitea-creds
containers: containers:
- name: helloo-cicdd - name: helloo-cicdd
image: git.fpmoz.sum.ba/Marijanela218/helloo-cicdd:latest image: git.fpmoz.sum.ba/Marijanela218/helloo-cicdd:1.1
ports: ports:
- containerPort: 8000 - containerPort: 8000
# ── Liveness: je li proces živ? ───────────────── # ── Liveness: je li proces živ? ─────────────────

19
main.py
View File

@@ -3,16 +3,17 @@ from fastapi import FastAPI
import os, datetime import os, datetime
app = FastAPI() app = FastAPI()
_healthy = True
@app.get("/health") @app.get("/health")
def health(): def health():
return { if not _healthy:
"status": "ok", return {"status": "unhealthy"}, 503
"version": os.getenv("APP_VERSION", "dev"), return {"status": "ok"}
"timestamp": datetime.datetime.utcnow().isoformat()
}
@app.get("/")
def root():
return {"poruka": "Zdravo s k3s!", "host": os.uname().nodename}
@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"}