Files
nginx-ui/internal/clustersync/errors.go
0xJacky 9f70d47b35 feat(cluster): unify multi-node configuration synchronization
Deployment to other nodes was file by file, manual, and always validated
against the local Nginx. One synchronization engine now backs every path.

- Directory deployment: a directory carries its own deployment targets and
  every file below it inherits them, so a whole tree replicates in one
  request per node (#1559).
- Node sync: one action pushes all configurations, sites and streams to the
  selected nodes, which is what a freshly added node needs (#1484).
- Namespace replication: the namespace record is mirrored to its member nodes
  and synced sites and streams carry the namespace name, so every node groups
  them identically (#1744).
- Automatic sync: a namespace can switch to the auto strategy with its own
  interval and a cron job re-pushes its content (#1582).
- deploy_mode=remote no longer touches the local Nginx: no sites-enabled
  symlink, no local nginx -t and no local reload. The deployment intent moves
  to the database, and moving a site into a remote namespace detaches its
  leftover local symlink (#1505).

The receiving side gains a batch config endpoint that writes every file and
reloads once, with a per-file fallback for nodes that predate it. Disabling a
site or stream became idempotent so converging a node reports no spurious
failures, renaming only tests and reloads when the enabled tree actually
changed, and stream delete now removes the stream record instead of a site one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 18:07:34 +08:00

16 lines
696 B
Go

package clustersync
import "github.com/uozi-tech/cosy"
var (
e = cosy.NewErrorScope("cluster_sync")
// ErrPathOutsideConfDir guards directory deployment against traversal.
ErrPathOutsideConfDir = e.New(50014, "path is not under the nginx conf dir")
// ErrNoTargetNode is returned when no enabled node matches the request.
ErrNoTargetNode = e.New(40404, "no enabled target node was found")
// ErrNamespaceHasNoNode is returned when a namespace has no member node.
ErrNamespaceHasNoNode = e.New(40405, "the namespace has no node to sync with")
// ErrEmptyScope is returned when a run would replicate nothing.
ErrEmptyScope = e.New(40006, "select at least one kind of content to sync")
)