Files
AgentsMeeting/gateway/scripts/service_registry.py
T
hmo 1dd3f9aad5 fix: watchdog revival — port 5807 in registry, skip remote/self-managed services, add to start.bat
- service_registry: xmpp_bot port 5802 -> 5807 (matches xmpp_agent_core), fix health_url/log
- xmpp_watchdog: skip services without script or pid_file (dashboard self-managed, gateway_* remote) — previously crashed on open(None)
- start.bat: launch watchdog after xxm bot so crash auto-recovery runs on boot
2026-08-05 09:57:51 +08:00

85 lines
3.2 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": os.path.join(os.path.dirname(BASE), "self-growing-knowledge",
"scripts", "article_processor.py"),
"args": [],
"workdir": os.path.join(os.path.dirname(BASE), "self-growing-knowledge"),
"pid_file": os.path.join(TEMP, ".article_processor.pid"),
"port": 5810,
"health_url": "http://127.0.0.1:5810/health",
"accept_401": False,
"depends_on": [],
"log_files": lambda: [os.path.join(GATEWAY_DIR, "logs", "article_processor.log")],
"description": "微信文章全文抓取服务",
},
{
"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)",
},
]