docs: mount the host os-release and fix the agent public host after tunnel enrollment [SKIP TESTS]

This commit is contained in:
justme committed 2026-10-06 23:11:26 +08:00
1 parent 8f44e924a4
commit d69581dcb5
3 files changed
+5 -1

No files matched your search

+3 -1
View File
@@ -212,7 +212,7 @@ Restart=always
RestartSec=5
TimeoutStopSec=30
ExecStartPre=-/usr/bin/podman rm -f monitor-agent
ExecStart=/usr/bin/podman run --rm --name monitor-agent --network host --read-only --security-opt no-new-privileges --cap-drop all -v /opt/monitor/etc:/etc/monitor:Z ${IMAGE}
ExecStart=/usr/bin/podman run --rm --name monitor-agent --network host --read-only --security-opt no-new-privileges --cap-drop all -v /etc/os-release:/etc/os-release:ro -v /opt/monitor/etc:/etc/monitor:Z ${IMAGE}
ExecStop=/usr/bin/podman stop -t 20 monitor-agent
[Install]
@@ -222,7 +222,9 @@ WantedBy=multi-user.target
- **数据目录**(上面挂到容器 `/etc/monitor` 的 `/opt/monitor/etc`)归容器用户(UID/GID 1654),里面放 `agent.json`、身份目录(`fleet-enroll` 注册之后的 `agent-id/`),Probe 放 `probe.json` 和 `agents.json`。`agent.json` 里的 `fleet.identity_dir` 写容器里的路径(例如 `/etc/monitor/agent-id`)。
- **首次注册 Agent**:`podman run --rm --network host -v <数据目录>:/etc/monitor --entrypoint /usr/local/bin/fleet-enroll <镜像> --server https://<面板> --join <加入令牌> --name <名字> --identity-dir /etc/monitor/agent-id`,再写 `agent.json`。Probe:在管理端创建(或轮换密钥)之后下载 `probe.json`,放进数据目录。
- **拉取私有镜像**需要 Registry 的登录信息:用 `podman login --authfile /etc/monitor-update/registry-auth.json …` 生成一份只有 root 能读(600)的认证文件,更新器用它拉取,容器本身用不到。
- **挂载宿主机的 `/etc/os-release`(只读)**:节点读系统名展示在面板上,不挂的话读到的是镜像里的 Ubuntu。
- **ICMP 目标任务**要在 `podman run` 里加 `--cap-add NET_RAW`。
- **经隧道注册之后检查 Agent 的 `public_host`**:面板看到的来源地址是隧道的出口(通常是内网地址),要在管理端改成这台机器自己的公网地址(`PATCH /api/admin/agents/{id}`),Probe 才连得上。
- `packaging/compose/` 里的 compose 文件是不带宿主机更新器的简单方式:更新靠手动改版本再 `docker compose pull && up -d`,面板的更新按钮对它不起作用。
## 容器节点的更新(Agent、Probe)
+1
View File
@@ -21,6 +21,7 @@ services:
network_mode: host
volumes:
- ./.data:/etc/monitor
- /etc/os-release:/etc/os-release:ro # 让节点读到宿主机的系统名(镜像里是 Ubuntu)
read_only: true
tmpfs:
- /tmp:rw,noexec,nosuid,size=64m,mode=1777
+1
View File
@@ -16,6 +16,7 @@ services:
network_mode: host
volumes:
- ./.data:/etc/monitor
- /etc/os-release:/etc/os-release:ro # 让节点读到宿主机的系统名(镜像里是 Ubuntu)
read_only: true
tmpfs:
- /tmp:rw,noexec,nosuid,size=64m,mode=1777