diff --git a/Dockerfile b/Dockerfile index 998b5fa..6b22924 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,10 +88,15 @@ RUN go mod download COPY agent/ ./ -# 编译容器目标架构 Linux Agent,同时固定产出 Windows AMD64 便于 Windows 主机下载安装。 // Logan.Li -RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build \ +# 交叉编译主流服务器平台 Agent:Linux x86_64 / Linux ARM64 / Windows x86_64。 +# Go 在 CGO_ENABLED=0 下可原生交叉编译,无需 QEMU,故一次性产出全部目标, +# 与 router/agent_static.go 的下载清单保持一致,避免 ARM 主机下载 404。 // Logan.Li +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ -ldflags="-s -w -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" \ - -o bin/aiops-agent-linux-${TARGETARCH} . + -o bin/aiops-agent-linux-amd64 . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build \ + -ldflags="-s -w -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" \ + -o bin/aiops-agent-linux-arm64 . RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build \ -ldflags="-s -w -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME}" \ -o bin/aiops-agent-windows-amd64.exe . @@ -128,7 +133,9 @@ RUN addgroup -S -g 10001 aiops && \ chmod 1777 /tmp # 复制 agent 二进制。 // Logan.Li -COPY --from=agent-builder /agent/bin/aiops-agent-linux-${TARGETARCH} /app/agent/bin/aiops-agent-linux-${TARGETARCH} +# 复制主流平台 agent 二进制(与 router/agent_static.go 的下载清单一一对应)。 // Logan.Li +COPY --from=agent-builder /agent/bin/aiops-agent-linux-amd64 /app/agent/bin/aiops-agent-linux-amd64 +COPY --from=agent-builder /agent/bin/aiops-agent-linux-arm64 /app/agent/bin/aiops-agent-linux-arm64 COPY --from=agent-builder /agent/bin/aiops-agent-windows-amd64.exe /app/agent/bin/aiops-agent-windows-amd64.exe # 复制 agent 安装脚本 diff --git a/docker-compose.yml b/docker-compose.yml index a013a47..0139c51 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,9 @@ services: - "127.0.0.1:6379:6379" volumes: - redis_data:/data - command: redis-server --appendonly yes + # appendonly: 分时热数据需持久化,避免重启丢窗口; + # maxmemory + volatile-lru: 只淘汰带 TTL 的键(ZSET 热数据),保护 SetNX 分布式锁等无 TTL 键。 // Logan.Li + command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy volatile-lru --maxmemory-samples 5 healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s diff --git a/docs/reference/api-reference.md b/docs/reference/api-reference.md index 10f5747..e8746e8 100644 --- a/docs/reference/api-reference.md +++ b/docs/reference/api-reference.md @@ -630,7 +630,7 @@ Agent 执行完任务后,回传执行结果。 "downloads": { "linux_amd64": "/api/v1/agent/aiops-agent-linux-amd64", "linux_arm64": "/api/v1/agent/aiops-agent-linux-arm64", - "darwin_arm64": "/api/v1/agent/aiops-agent-darwin-arm64" + "windows_amd64": "/api/v1/agent/aiops-agent-windows-amd64.exe" }, "install_script": "/api/v1/agent/install.sh" }