fix: 统一 agent 默认端口为 8000(search_agent 系列保持 8080)
- 修改 template_manager.py、k8s_manager.py 中的端口映射 - 更新 jina_search_agent、azure_blob_agent 系列、a2a_litellm_agent 的代码和 Dockerfile 为 8000 - 添加端口修改脚本和测试脚本 Made-with: Cursor
This commit is contained in:
@@ -24,7 +24,7 @@ COPY agents/a2a_litellm_agent/*.py /app/
|
||||
|
||||
# 设置环境变量
|
||||
ENV SERVICE_HOST=0.0.0.0
|
||||
ENV SERVICE_PORT=8080
|
||||
ENV SERVICE_PORT=8000
|
||||
ENV POD_NAME=a2a-litellm-agent
|
||||
ENV TEMPLATE_TYPE=a2a_litellm_agent
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
@@ -34,10 +34,10 @@ ENV AGENT_CALLBACK_URL=http://mcp-server.taiji-ai.svc.cluster.local:8002/api/v1/
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
||||
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health').read()" || exit 1
|
||||
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health').read()" || exit 1
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 8080
|
||||
EXPOSE 8000
|
||||
|
||||
# 启动命令
|
||||
CMD ["python", "main.py"]
|
||||
|
||||
@@ -26,7 +26,7 @@ logger = structlog.get_logger()
|
||||
|
||||
# 环境变量配置
|
||||
SERVICE_HOST = os.getenv("SERVICE_HOST", "0.0.0.0")
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8080"))
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8000"))
|
||||
POD_NAME = os.getenv("POD_NAME", "a2a-litellm-agent")
|
||||
TEMPLATE_TYPE = os.getenv("TEMPLATE_TYPE", "a2a_litellm_agent")
|
||||
|
||||
@@ -523,12 +523,12 @@ def create_app(api_key: Optional[str] = None, model: Optional[str] = None) -> Fa
|
||||
创建FastAPI应用(用于uvicorn启动)
|
||||
|
||||
使用方式:
|
||||
uvicorn a2a_server:app --host 0.0.0.0 --port 8080
|
||||
uvicorn a2a_server:app --host 0.0.0.0 --port 8000
|
||||
|
||||
或设置环境变量后:
|
||||
export LITELLM_API_KEY="your-key"
|
||||
export MODEL_NAME="your-model"
|
||||
uvicorn a2a_server:app --host 0.0.0.0 --port 8080
|
||||
uvicorn a2a_server:app --host 0.0.0.0 --port 8000
|
||||
"""
|
||||
server = A2AAgentServer(api_key=api_key, model=model)
|
||||
return server.app
|
||||
|
||||
@@ -70,7 +70,7 @@ class AgentConfig:
|
||||
version: str = "1.0.0"
|
||||
|
||||
# 服务端口
|
||||
port: int = 8080
|
||||
port: int = 8000
|
||||
|
||||
# 服务主机
|
||||
host: str = "0.0.0.0"
|
||||
|
||||
@@ -8,7 +8,7 @@ from a2a_server import create_app
|
||||
|
||||
# 环境变量配置
|
||||
SERVICE_HOST = os.getenv("SERVICE_HOST", "0.0.0.0")
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8080"))
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8000"))
|
||||
POD_NAME = os.getenv("POD_NAME", "a2a-litellm-agent")
|
||||
TEMPLATE_TYPE = os.getenv("TEMPLATE_TYPE", "a2a_litellm_agent")
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ COPY common/api_key_utils.py /app/common/
|
||||
# 设置环境变量
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV SERVICE_HOST=0.0.0.0
|
||||
ENV SERVICE_PORT=8080
|
||||
ENV SERVICE_PORT=8000
|
||||
|
||||
# 健康检查 - 使用Python避免僵尸进程
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health').read()" || exit 1
|
||||
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health').read()" || exit 1
|
||||
|
||||
# 运行agent (直接使用Python,避免shell)
|
||||
CMD ["python3", "-u", "azure_blob_agent.py"]
|
||||
|
||||
@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# 环境变量配置
|
||||
SERVICE_HOST = os.getenv("SERVICE_HOST", "0.0.0.0")
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8080"))
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8000"))
|
||||
POD_NAME = os.getenv("POD_NAME", "azure-blob-agent")
|
||||
TEMPLATE_TYPE = os.getenv("TEMPLATE_TYPE", "azure_blob_agent")
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ COPY agents/azure_blob_agent_a2a/azure_blob_agent_a2a.py /app/
|
||||
COPY common/api_key_utils.py /app/common/
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 8080
|
||||
EXPOSE 8000
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD python -c "import requests; requests.get('http://localhost:8080/health', timeout=5)"
|
||||
CMD python -c "import requests; requests.get('http://localhost:8000/health', timeout=5)"
|
||||
|
||||
# 启动应用
|
||||
CMD ["python", "azure_blob_agent_a2a.py"]
|
||||
|
||||
@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# 环境变量配置
|
||||
SERVICE_HOST = os.getenv("SERVICE_HOST", "0.0.0.0")
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8080"))
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8000"))
|
||||
POD_NAME = os.getenv("POD_NAME", "azure-blob-agent-a2a")
|
||||
TEMPLATE_TYPE = os.getenv("TEMPLATE_TYPE", "azure_blob_agent_a2a")
|
||||
AGENT_FRAMEWORK = os.getenv("AGENT_FRAMEWORK", "a2a")
|
||||
|
||||
@@ -18,11 +18,11 @@ RUN pip install --no-cache-dir -r requirements_mcp.txt
|
||||
COPY agents/azure_blob_agent_mcp/azure_blob_agent_mcp.py /app/
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 8080
|
||||
EXPOSE 8000
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD python -c "import requests; requests.get('http://localhost:8080/health', timeout=5)"
|
||||
CMD python -c "import requests; requests.get('http://localhost:8000/health', timeout=5)"
|
||||
|
||||
# 启动应用
|
||||
CMD ["python", "azure_blob_agent_mcp.py"]
|
||||
|
||||
@@ -22,7 +22,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# 环境变量配置
|
||||
SERVICE_HOST = os.getenv("SERVICE_HOST", "0.0.0.0")
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8080"))
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8000"))
|
||||
POD_NAME = os.getenv("POD_NAME", "azure-blob-agent-mcp")
|
||||
TEMPLATE_TYPE = os.getenv("TEMPLATE_TYPE", "azure_blob_agent_mcp")
|
||||
AGENT_FRAMEWORK = os.getenv("AGENT_FRAMEWORK", "mcp")
|
||||
|
||||
@@ -25,7 +25,7 @@ COPY agents/jina_search_agent/jina_search_agent.py /app/
|
||||
# 环境变量
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV SERVICE_HOST=0.0.0.0
|
||||
ENV SERVICE_PORT=8080
|
||||
ENV SERVICE_PORT=8000
|
||||
|
||||
# 默认 Jina API Key (硬编码)
|
||||
ENV JINA_API_KEY=jina_e26dc30420a44a1e859216528065b203TkMRmsoz-FgMDQC5FZX9jr5oF2CI
|
||||
@@ -35,8 +35,8 @@ ENV AGENT_CALLBACK_URL=http://mcp-server:8002/api/v1/billing/agent-callback
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
|
||||
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health').read()" || exit 1
|
||||
CMD python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health').read()" || exit 1
|
||||
|
||||
EXPOSE 8080
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["python3", "-u", "jina_search_agent.py"]
|
||||
|
||||
@@ -31,7 +31,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# 环境变量
|
||||
SERVICE_HOST = os.getenv("SERVICE_HOST", "0.0.0.0")
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8080"))
|
||||
SERVICE_PORT = int(os.getenv("SERVICE_PORT", "8000"))
|
||||
POD_NAME = os.getenv("POD_NAME", "jina-search-agent")
|
||||
USER_ID = os.getenv("USER_ID", "")
|
||||
JINA_API_KEY = os.getenv("JINA_API_KEY", "")
|
||||
|
||||
Reference in New Issue
Block a user