Files
AgentsMeeting/gateway/scripts/service_registry.py
T

85 lines
3.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
service_registry.py — 共享服务注册表
所有监控组件(watchdog、Tier1、Tier2)统一从此文件读取服务定义。
新增服务只需在此添加一条记录,三处监控自动生效。
"""
import os
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
GATEWAY_DIR = os.path.dirname(SCRIPT_DIR)
BASE = os.path.dirname(GATEWAY_DIR)
TEMP = os.path.join(GATEWAY_DIR, "temp")
PYTHON = r"C:\Users\hmo\AppData\Local\Programs\Python\Python310\python.exe"
SERVICES = [
{
"name": "xmpp_bot",
"script": os.path.join(BASE, "xmpp_agent_core.py"),
"args": ["--agent", "xxm"],
"workdir": BASE,
"pid_file": os.path.join(TEMP, ".xmpp_bot.pid"),
"port": 5807, # xxm 的 HTTP bridge 已从 5802 迁移到 5807(见 xmpp_agent_core.py AGENTS.xxm.http_port
"health_url": "http://127.0.0.1:5807/health",
"accept_401": False, # /health 现在返回 200(免认证)
"depends_on": [],
"log_files": lambda: [os.path.join(GATEWAY_DIR, "logs", "xmpp_xxm.log"),
os.path.join(GATEWAY_DIR, "logs", "bridge.log")],
"description": "XMPP Bot (xxm@yoin.fun)",
},
{
"name": "article_processor",
"script": None, # 外部服务,由 self-growing-knowledge 项目管理,AgentsMeeting 不再启动
"args": [],
"workdir": None,
"pid_file": None,
"port": 5810,
"health_url": "http://192.168.1.16:5810/health",
"accept_401": False,
"depends_on": [],
"remote": True, # 标记为远程外部服务
"log_files": lambda: [],
"description": "微信文章全文抓取服务(外部,self-growing-knowledge)",
},
{
"name": "dashboard",
"script": os.path.join(SCRIPT_DIR, "dashboard.py"),
"args": [],
"workdir": SCRIPT_DIR,
"pid_file": None, # dashboard 管理自身进程
"port": 5803,
"health_url": "http://127.0.0.1:5803/api/health",
"accept_401": False,
"depends_on": ["xmpp_bot"],
"log_files": lambda: [],
"description": "AgentsMeeting 管理门户",
},
{
"name": "gateway_mohe",
"script": None,
"args": [],
"workdir": None,
"pid_file": None,
"port": 8646,
"health_url": "http://192.168.1.246:8646/v1/health",
"accept_401": True, # may need auth
"depends_on": ["ejabberd"],
"remote": True, # 服务运行在 Linux 246,不检查本地端口
"log_files": lambda: [],
"description": "Hermes Gateway (mohe@yoin.fun)",
},
{
"name": "gateway_zhiwei",
"script": None,
"args": [],
"workdir": None,
"pid_file": None,
"port": 8643,
"health_url": "http://192.168.1.246:8643/v1/health",
"accept_401": True,
"depends_on": ["ejabberd"],
"remote": True, # 服务运行在 Linux 246,不检查本地端口
"log_files": lambda: [],
"description": "Hermes Gateway (zhiwei@yoin.fun)",
},
]