28 lines
562 B
Python
28 lines
562 B
Python
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"}
|