init: hello-cicd projectsetup
Some checks failed
CI/CD Pipeline popravak / build (push) Successful in 1m19s
CI/CD Pipeline popravak / deploy (push) Failing after 1m5s

This commit is contained in:
2026-05-03 09:50:32 +02:00
parent 6b201ad7b8
commit 9969093c91

23
main.py
View File

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