mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5489] RFC: multi-node support (one panel managing worker nodes) — would you accept it upstream? #3835
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3835
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @n0ctal on GitHub (Jun 22, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5489
Summary
3x-ui manages one server per panel. Operators running several servers currently run several
independent panels and duplicate every inbound/client change by hand. I'd like to ask whether you'd
be interested in a multi-node feature upstream — one "master" panel that owns the inbound/client
definitions and synchronizes them to "worker" nodes — and, if so, what shape you'd want before I send code.
What I've built (in a fork) and would adapt to your direction
panel API; workers keep serving with no extra moving parts.
per-node generation/fence — so a DB failure never leaves a node diverged, and a stale update can't
overwrite a newer one.
idempotent + retry-safe delivery, convergence after a node reconnects.
It's been running a real fleet for months.
The ask
This is a feature, not a small patch — it touches schema, a runtime/transport layer, API, and UI, so
I don't want to drop a large PR cold. Before writing anything upstream:
one big change?
Happy to write a short design doc first and adapt to whatever you prefer. Thanks for 3x-ui.
@github-actions[bot] commented on GitHub (Jun 22, 2026):
Multi-node management is already a first-class, shipping feature in 3x-ui — it has been present since well before the current v3.3.1 release. Your RFC describes capabilities that are substantially already implemented upstream.
What already exists in the codebase
internal/database/model/model.go—Nodestruct with per-nodeApiToken, selectableTlsVerifyMode(verify/skip/pin/mtls),InboundSyncMode(all/selected), andInboundTagsfor scoped sync.internal/web/service/node.go/inbound_node.go—NodeServiceand inbound-push logic including incremental client operations, a bulk-push threshold that falls back to full-snapshot reconcile (nodeBulkPushThreshold = 32), per-node serialized apply, and idempotent/retry-safe delivery.internal/web/service/node_tree.go,node_dirty_test.go,inbound_node_reconcile_test.go,node_bulk_dispatch_test.go, etc. — dirty-tracking, reconcile, and bulk dispatch paths with test coverage.internal/web/job/node_heartbeat_job.go— periodic heartbeat polling (concurrency-capped, timeout-bounded) to update node status, Xray version, CPU/mem/net metrics, and online clients.internal/web/job/node_traffic_sync_job.go— traffic aggregation and IP-limit sync across nodes, with aglobalPushinterval and a structural-change flag that gates full reconcile.internal/web/service/node_mtls.go.What this means for your RFC
The questions you posed (Is multi-node wanted? What shape?) are already answered by the shipped code. Before writing anything upstream, the productive next step is to diff your fork's approach against the existing implementation and identify:
Opening a design-doc issue or a discussion thread comparing your implementation with the existing one would be a natural first step before code.
This reply was generated automatically; a maintainer may follow up.
@n0ctal commented on GitHub (Jun 22, 2026):
Thanks — you're right, and I should have checked first: 3x-ui already ships multi-node (the
Nodemodel, heartbeat/traffic-sync jobs, inbound push with the dirty-flag + reconcile path, mTLS auth). My RFC was wrong-premised; apologies for the noise.What my fork actually does is harden the existing multi-node, not add it. Diffing against
main, the genuine differences (confirmed absent upstream) are three focused things, each offerable as a staged PR:desired_generation/applied_generationcolumns plus an in-transaction bump, used alongside the existing reconcile. To your specific question — does theConfigDirtyflag already cover the same invariant? — a boolean "needs resync" doesn't by itself give: (a) DB-commit-before-remote-apply, (b) stale-update fencing (a late/slow apply cannot ACK over a newer desired state), or (c) failed-apply visibility (desired > appliedsurvives a partial failure so the next reconcile heals it). The generation counter makes those explicit and idempotent. I'd write this up as a design note before any code.node-syncscope that authorizes only the exact master→worker sync routes (method+route allowlist, fail-closed), with panel-update authority kept on a separate credential — so a leaked worker token can't drive a remote panel update.(node, listen, port, transport)reservation acquired in the mutation transaction, instead of a check-then-insert that can race two overlapping listeners onto one port.If any of these are interesting I'll open a design-doc issue per item and then staged PRs. If not, no problem — I wanted to ask before sending code rather than drop a large diff. Thanks for 3x-ui.
@MHSanaei commented on GitHub (Jul 3, 2026):
Thanks for the thoughtful RFC and especially for the gracious follow-up after checking the tree — multi-node (a master panel managing worker nodes over mTLS, with heartbeat, config reconcile, and cross-node traffic/online aggregation) has been shipping in 3x-ui for a while, so the original question is resolved and I'm closing this issue.
The three hardening items you identified (generation fencing for durable-first sync, least-privilege node token scope, transactional port reservations) do look like genuine gaps worth discussing. Please open a separate, focused issue for each one you want to pursue so they can be evaluated and staged independently — a short design note followed by a small PR is exactly the right shape.