mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-28 22:55:49 +08:00
# Description This PR fixes bounded ManagedSession reconnect cleanup and reorganizes the sample applications into domain-focused folders. ## Reconnect cleanup - Bounds reconnect integration cleanup with independent 30-second close and dispose limits. - Sends `CloseSession` through the awaited transport request path during `Session.DisposeAsync`. - Preserves explicit `Session.CloseAsync` behavior that waits for or cancels outstanding publish requests. - Covers the disposal request path with a regression test. ## Sample organization - `samples/OpenUsd`: `GeneratorServer`, `SiteCompositionServer` - `samples/Redundancy`: `RedundantClient`, `RedundantServer`, `RedundantPubSub` - `samples/Isa95`: `MinimalIsa95Server` - `samples/MinimalApi`: `MinimalBoilerServer`, `MinimalCalcServer`, `MinimalClient` - `samples/DI`: `PumpDeviceIntegrationServer` - `samples/Lds`: `ConsoleLdsServer` - `samples/Reference`: `ConsoleReferenceClient`, `ConsoleReferenceServer` - `samples/PubSub`: `ConsoleReferencePubSubClient` `UA.slnx` now exposes the same requested domain groups. Project references, tests, runtime sample probes, CI workflows, Dockerfiles, Compose files, helper scripts, and documentation were updated to the new paths. `samples/Robotics/MinimalRobotServer` remains under `Robotics`. ## Validation - `dotnet build UA.slnx` - 3 Redundancy short-haul sample tests - 70 DI sample tests - 914 OpenUSD tests - 1 WotCon model-materialization test - 137 AOT tests - `docker compose config` for all 6 moved Redundancy Compose files ## Related Issues - Fixes #4273 ## Checklist - [ ] I have signed the [CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf) and read the [CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md) doc. - [x] I have added tests that prove my fix is effective or that my feature works and increased code coverage. - [x] I have added all necessary documentation. - [x] I have verified that my changes do not introduce new build or analyzer warnings. - [x] I built the complete `UA.slnx` solution locally. - [ ] I ran all tests locally against at least .NET Framework and .NET 10. - [ ] I fixed all failing and flaky tests in the CI pipelines and all CodeQL warnings. - [x] I have addressed all PR feedback received. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com> Co-authored-by: Marc Schier <mschier@microsoft.com> Co-authored-by: Marc Schier <marcschier@users.noreply.github.com> Copilot-Session: a2c2838f-74ae-4997-a1d4-50574d9e0636
116 lines
4.8 KiB
YAML
116 lines
4.8 KiB
YAML
# Redundant OPC UA server set — one compose file, topology chosen from the environment.
|
|
#
|
|
# Pick the topology by setting HA_MODE / HA_CONSISTENCY (and REDUNDANCY_MODE) either
|
|
# inline or with --env-file. Three built-in topologies, each has a ready-made env file:
|
|
#
|
|
# * active/active, eventual consistency (CRDT gossip) — DEFAULT
|
|
# --env-file samples/Redundancy/RedundantServer/active-active-eventual.env
|
|
# * active/active, strong consistency (Raft)
|
|
# --env-file samples/Redundancy/RedundantServer/active-active-strong.env
|
|
# * active/passive, strong consistency (Raft)
|
|
# --env-file samples/Redundancy/RedundantServer/active-passive.env
|
|
#
|
|
# Three server replicas run in every topology (Raft needs 3 for a fault-tolerant quorum;
|
|
# active/active eventual works with 2 or 3 — remove server-c for a 2-node run). The
|
|
# replica count is therefore configurable by dropping/adding server-c.
|
|
#
|
|
# The build context is the repository root. Run from the repo root, e.g. active/passive:
|
|
# docker compose --env-file samples/Redundancy/RedundantServer/active-passive.env \
|
|
# -f samples/Redundancy/RedundantServer/docker-compose.yml up --build
|
|
#
|
|
# OPC UA endpoints on the host: replica-a opc.tcp://localhost:62543/RedundantServer,
|
|
# replica-b :62544, replica-c :62545. The Raft transport (6560) and CRDT gossip (4840)
|
|
# stay on the internal network and are addressed by container DNS.
|
|
#
|
|
# The transparent (nginx virtual endpoint) and GetEndpoints load-direction demos have
|
|
# their own folders: Transparent/docker-compose.yml and LoadDirection/docker-compose.yml.
|
|
|
|
x-server: &server
|
|
build:
|
|
context: ../../..
|
|
dockerfile: samples/Redundancy/RedundantServer/Dockerfile
|
|
image: opcua-redundant-server
|
|
command: ["--port", "62543"]
|
|
|
|
services:
|
|
server-a:
|
|
<<: *server
|
|
hostname: server-a
|
|
environment:
|
|
HA_HOST: server-a
|
|
HA_NODE_ID: replica-a
|
|
HA_MODE: ${HA_MODE:-aa}
|
|
HA_CONSISTENCY: ${HA_CONSISTENCY:-eventual}
|
|
REDUNDANCY_MODE: ${REDUNDANCY_MODE:-}
|
|
HA_GOSSIP_PORT: "4840"
|
|
HA_GOSSIP_PEERS: "server-b:4840,server-c:4840"
|
|
HA_RAFT_ID: "1"
|
|
HA_RAFT_MEMBERS: "3"
|
|
HA_RAFT_BIND: "tcp://0.0.0.0:6560"
|
|
HA_RAFT_PEERS: "tcp://server-b:6560,tcp://server-c:6560"
|
|
HA_REDUNDANT_PEERS: "urn:localhost:OPCFoundation:RedundantServer:replica-b|RedundantServer replica-b|opc.tcp://server-b:62543/RedundantServer,urn:localhost:OPCFoundation:RedundantServer:replica-c|RedundantServer replica-c|opc.tcp://server-c:62543/RedundantServer"
|
|
ports:
|
|
- "62543:62543"
|
|
|
|
server-b:
|
|
<<: *server
|
|
hostname: server-b
|
|
environment:
|
|
HA_HOST: server-b
|
|
HA_NODE_ID: replica-b
|
|
HA_MODE: ${HA_MODE:-aa}
|
|
HA_CONSISTENCY: ${HA_CONSISTENCY:-eventual}
|
|
REDUNDANCY_MODE: ${REDUNDANCY_MODE:-}
|
|
HA_GOSSIP_PORT: "4840"
|
|
HA_GOSSIP_PEERS: "server-a:4840,server-c:4840"
|
|
HA_RAFT_ID: "2"
|
|
HA_RAFT_MEMBERS: "3"
|
|
HA_RAFT_BIND: "tcp://0.0.0.0:6560"
|
|
HA_RAFT_PEERS: "tcp://server-a:6560,tcp://server-c:6560"
|
|
HA_REDUNDANT_PEERS: "urn:localhost:OPCFoundation:RedundantServer:replica-a|RedundantServer replica-a|opc.tcp://server-a:62543/RedundantServer,urn:localhost:OPCFoundation:RedundantServer:replica-c|RedundantServer replica-c|opc.tcp://server-c:62543/RedundantServer"
|
|
ports:
|
|
- "62544:62543"
|
|
|
|
server-c:
|
|
<<: *server
|
|
hostname: server-c
|
|
environment:
|
|
HA_HOST: server-c
|
|
HA_NODE_ID: replica-c
|
|
HA_MODE: ${HA_MODE:-aa}
|
|
HA_CONSISTENCY: ${HA_CONSISTENCY:-eventual}
|
|
REDUNDANCY_MODE: ${REDUNDANCY_MODE:-}
|
|
HA_GOSSIP_PORT: "4840"
|
|
HA_GOSSIP_PEERS: "server-a:4840,server-b:4840"
|
|
HA_RAFT_ID: "3"
|
|
HA_RAFT_MEMBERS: "3"
|
|
HA_RAFT_BIND: "tcp://0.0.0.0:6560"
|
|
HA_RAFT_PEERS: "tcp://server-a:6560,tcp://server-b:6560"
|
|
HA_REDUNDANT_PEERS: "urn:localhost:OPCFoundation:RedundantServer:replica-a|RedundantServer replica-a|opc.tcp://server-a:62543/RedundantServer,urn:localhost:OPCFoundation:RedundantServer:replica-b|RedundantServer replica-b|opc.tcp://server-b:62543/RedundantServer"
|
|
ports:
|
|
- "62545:62543"
|
|
|
|
# A managed client that connects to one replica and transparently discovers / fails
|
|
# over to the others. Part of the "clients" profile so `up` can start servers only.
|
|
# One client PROCESS per replica: CLIENT_REPLICAS scales the number of containers,
|
|
# each an independent managed client that fails over on its own.
|
|
client:
|
|
profiles: ["clients", "demo"]
|
|
build:
|
|
context: ../../..
|
|
dockerfile: samples/Redundancy/RedundantClient/Dockerfile
|
|
image: opcua-redundant-client
|
|
deploy:
|
|
replicas: ${CLIENT_REPLICAS:-1}
|
|
depends_on:
|
|
- server-a
|
|
- server-b
|
|
- server-c
|
|
command:
|
|
- "--server"
|
|
- "opc.tcp://server-a:62543/RedundantServer"
|
|
- "--autoaccept"
|
|
- "--nosecurity"
|
|
- "--duration"
|
|
- "00:10:00"
|