feat(logs-and-metrics): support multi-node swarms — agent runs as 1 replica on managers only (1/N coverage, can fail to start entirely)

未关闭
#5,997 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
18/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
docker, typescript

调研方向

Start in packages/server/src/setup/vector-setup.ts, around the vector and cadvisor service specs (roughly lines 501-509 and 552-559), where the Replicated mode and the node.role==manager constraint are set. Reproducing the problem needs a multi-node swarm, and the design choices (Mode: Global, Swarm Config for the Vector file) are open for maintainers to decide. Done means the agent runs on every eligible node and its config reaches each one, or the dashboard warns about single-node limits.

由索引模型根据 Issue 内容生成。

描述

enhancement
What problem will this feature address?

On a multi-node Docker Swarm, the Logs & Metrics agent only covers a fraction of the cluster (or fails to start entirely):

  1. dokploy-vector and dokploy-cadvisor are deployed as Replicated: { Replicas: 1 } with Placement.Constraints: ["node.role==manager"] (packages/server/src/setup/vector-setup.ts, ~lines 501–509 and 552–559). On a swarm with 4 managers + 3 workers, the scheduler picks one manager.
  2. Every data source is node-local: container logs come from the bind-mounted local /var/run/docker.sock, host metrics from the local /proc + /sys mounts, container metrics from a loopback scrape of cAdvisor (127.0.0.1:4510). So only the containers and host metrics of that single manager are shipped — coverage ≈ 1/N, and there is no placement guarantee that it is even the "interesting" node.
  3. Worse, the Vector config is written to a node-local path (/etc/dokploy/vector/vector.yaml) that exists only on the host where the control plane wrote it. If the scheduler places the task on a manager without that file, the bind mount fails and the task cannot start at all — the service flaps until it happens to land on the right node (0/N coverage in the meantime). Docker provides no placement guarantee for 1-replica services.

Net effect: in a multi-node swarm the feature is silently partial (logs/metrics of ~1 node out of N), and can be entirely down due to the missing bind-mount source — with no warning in the UI.

Describe the solution you'd like

Deploy the agent in a way that matches multi-node swarms:

  • Mode: Global (optionally with a configurable constraint, e.g. managers-only vs all nodes), so every node runs Vector + cAdvisor — this also guarantees vector↔cadvisor co-location per node, which the current loopback scrape requires.
  • Distribute the Vector config to every node via a Swarm Config object (instead of a node-local bind mount), so the file exists wherever the task runs; per-node identity can be injected with {{.Node.Hostname}} env templating and attached as a tag/label to host metrics.
  • If per-node coverage is out of scope for now, at minimum warn in the dashboard when deploying the agent to a swarm with more than one eligible node, and document the single-node limitation.
Describe alternatives you've considered
  • Enabling the agent anyway and accepting 1/N coverage (current behavior, confusing).
  • Registering each node as a separate "remote server" so each gets its own agent — requires SSH-to-self connectivity per node and multiplies servers in the UI for what is one logical cluster.
  • Self-managing a global Vector stack outside Dokploy (works, but leaves Dokploy's agent ecosystem behind).
Additional context
  • Verified against canary source on 2026-11-12; observed in a real 7-node production swarm (4 managers / 3 workers).
  • Related: #5991 (same feature area).
  • Happy to discuss the approach or send a PR if the maintainers agree on the direction (global mode + swarm config seems the smallest sound change).
主要语言
TypeScript
星标
38.8k
派生
3.2k
平均合并
1 天 10 小时
30 天内合并 PR
110

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Dokploy/dokploy 的其他 Issue

查看 Dokploy/dokploy 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。