Restore with PublishAot so agent and probe images contain NativeAOT binaries instead of a launcher that needs a .dll, fail the build when the binary is too small, add agent and probe compose files, and document the [CI] marker in AGENTS.md.
34 lines
1.5 KiB
YAML
34 lines
1.5 KiB
YAML
# Agent:配置和身份都放在同目录的 .data/(挂载到容器的 /etc/monitor)。
|
||
#
|
||
# 第一次使用:
|
||
# mkdir -p .data && sudo chown 1654:1654 .data # 容器以 UID/GID 1654 运行
|
||
# MONITOR_JOIN_TOKEN=<加入令牌> MONITOR_SERVER=https://<backend> MONITOR_AGENT_NAME=<名字> \
|
||
# docker compose run --rm --entrypoint /usr/local/bin/fleet-enroll agent \
|
||
# --server "$MONITOR_SERVER" --join "$MONITOR_JOIN_TOKEN" --name "$MONITOR_AGENT_NAME" --identity-dir /etc/monitor/agent-id
|
||
# 再在 .data/agent.json 里写(fleet.identity_dir 要和上面一致):
|
||
# {"fleet":{"server":"https://<backend>","identity_dir":"/etc/monitor/agent-id"},"listen":{"bind":"0.0.0.0"},"limits":{"max_total_mbps":100,"max_total_pps":10000}}
|
||
# docker compose up -d
|
||
#
|
||
# 更新:改 MONITOR_VERSION(或 MONITOR_IMAGE),再 docker compose pull && docker compose up -d。.data 不动,身份和历史都保留。
|
||
services:
|
||
agent:
|
||
image: ${MONITOR_IMAGE:-registry.oeo.one/monitor/monitor-agent}:${MONITOR_VERSION:-0.1.1}
|
||
container_name: monitor-agent
|
||
restart: unless-stopped
|
||
init: true
|
||
# Probe 要直连 Agent 的 7443(TCP+UDP)和 7444(TCP),用宿主网络,不做端口映射
|
||
network_mode: host
|
||
volumes:
|
||
- ./.data:/etc/monitor
|
||
read_only: true
|
||
tmpfs:
|
||
- /tmp:rw,noexec,nosuid,size=64m,mode=1777
|
||
security_opt:
|
||
- no-new-privileges:true
|
||
cap_drop:
|
||
- ALL
|
||
# 要做 ICMP 测量时打开:
|
||
# cap_add:
|
||
# - NET_RAW
|
||
stop_grace_period: 20s
|