- 在data-service中添加aktools依赖和运行配置 - 更新Traefik配置添加压缩中间件 - 修改Consul配置启用ACL - 更新README添加架构图和开发指南 - 添加架构图文档
28 lines
747 B
Python
28 lines
747 B
Python
import time
|
|
import requests
|
|
|
|
def register_to_consul():
|
|
time.sleep(3) # 等待服务稳定再注册
|
|
service_name = "aktools-service" # AKTools 主服务
|
|
port = 8001 # AKTools 端口
|
|
|
|
payload = {
|
|
"Name": service_name,
|
|
"ID": f"{service_name}-1",
|
|
"Address": service_name, # 容器名作为地址
|
|
"Port": port,
|
|
"Check": {
|
|
"TCP": f"{service_name}:{port}",
|
|
"Interval": "10s"
|
|
}
|
|
}
|
|
|
|
try:
|
|
requests.put("http://consul:8500/v1/agent/service/register", json=payload)
|
|
print(f"[{service_name}] Registered to Consul")
|
|
except Exception as e:
|
|
print(f"❌ Consul register failed: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
register_to_consul()
|