update response

This commit is contained in:
Admin 2025-12-19 10:27:50 +07:00
parent 91f51ee47b
commit 415319db81
2 changed files with 53 additions and 1 deletions

View File

@ -1 +1,50 @@
uvicorn app.main:app --workers 1 uvicorn app.main:app --workers 1
nohup ./venv/bin/python -m uvicorn app.main:app \
--port 8000 \
--workers 1 \
> health-agent.log 2>&1 &
ps aux | grep uvicorn
#!/usr/bin/env bash
APP_DIR="/home/devops/projects/healthy-checker"
LOG_FILE="$APP_DIR/health-agent.log"
PYTHON="$APP_DIR/venv/bin/python"
PORT=8000
echo "Restarting Health Agent..."
cd "$APP_DIR" || exit 1
# Kill uvicorn process đang chạy
PIDS=$(ps aux | grep "[u]vicorn app.main:app" | awk '{print $2}')
if [ -n "$PIDS" ]; then
echo "Stopping running process: $PIDS"
kill $PIDS
sleep 2
fi
# Start lại bằng nohup
echo "Starting Health Agent..."
nohup "$PYTHON" -m uvicorn app.main:app \
--port $PORT \
--workers 1 \
> "$LOG_FILE" 2>&1 &
sleep 1
# Verify
NEW_PID=$(ps aux | grep "[u]vicorn app.main:app" | awk '{print $2}')
if [ -n "$NEW_PID" ]; then
echo "Health Agent started (PID: $NEW_PID)"
else
echo "Failed to start Health Agent"
fi

View File

@ -55,7 +55,10 @@ def health():
"last_updated": data.get("last_updated"), "last_updated": data.get("last_updated"),
}) })
return render_response(health_schema, services) return {
"code": 200,
"data": render_response(health_schema, services)
}
@app.get("/services") @app.get("/services")
def services_list(): def services_list():