// mbproxy configuration (Linux / systemd). Copy to /etc/mbproxy/appsettings.json and // edit before starting the service. install.sh seeds this file only when none exists — // an existing appsettings.json is always preserved across reinstalls. // // JSONC: // and /* */ comments are accepted. The file is hot-reloaded on save. // This is the Linux counterpart of mbproxy.config.template.json — identical keys, with // a /var/log/mbproxy log path; shipped as appsettings.json by a `dotnet publish -r linux-*`. // // FULL REFERENCE — every key, type, default, range, validation rule and hot-reload // behaviour — lives in docs/Operations/Configuration.md. The notes below are brief // pointers only; consult that document before editing. { "Mbproxy": { // Fleet-wide BCD tag list — applies to every PLC. Each entry: Address (Modbus // PDU-decimal), Width (16 or 32), optional Name (debug-view label) and CacheTtlMs. // Per-PLC Add/Remove overrides go under Plcs[].BcdTags. Trailing comments give the // 4xxxx Modbus address and the DirectLOGIC V-memory reference. "BcdTags": { "Global": [ // 16-bit setpoints { "Address": 1536, "Width": 16, "Name": "Left ArgonSP" }, // 41537 { "Address": 1539, "Width": 16, "Name": "Right ArgonSP" }, // 41540 { "Address": 1544, "Width": 16, "Name": "Left ChlorineSP" }, // 41545 · V3010 { "Address": 1545, "Width": 16, "Name": "Right ChlorineSP" }, // 41546 · V3011 { "Address": 1546, "Width": 16, "Name": "Left HydrogenSP" }, // 41547 · V3012 { "Address": 1547, "Width": 16, "Name": "Right HydrogenSP" }, // 41548 · V3013 { "Address": 1548, "Width": 16, "Name": "Left AirSP" }, // 41549 · V3014 { "Address": 1549, "Width": 16, "Name": "Right AirSP" }, // 41550 · V3015 // 32-bit runtimes — CDAB pair spanning Address and Address+1 { "Address": 4616, "Width": 32, "Name": "MTA Runtime Left (min)" }, // 44617/44618 · V11010 { "Address": 4618, "Width": 32, "Name": "MTA Runtime Right (min)" }, // 44619/44620 · V11012 { "Address": 4626, "Width": 32, "Name": "FRR Runtime Left (min)" }, // 44627/44628 · V11022 { "Address": 4628, "Width": 32, "Name": "FRR Runtime Right (min)" } // 44629/44630 · V11024 ] }, // One entry per PLC: upstream clients connect to ListenPort, the proxy forwards to // Host:Port. ListenPort must be unique. Optional per-PLC "BcdTags": { "Add", "Remove" }. "Plcs": [ { "Name": "Z28061", "ListenPort": 5020, "Host": "10.210.192.5", "Port": 502 } ], // Read-only HTTP status page / dashboard. Set to 0 to disable the admin endpoint. "AdminPort": 8080, // Backend connect / request / graceful-shutdown timeouts (ms), plus TCP keepalive // and the idle-backend FC03 heartbeat. BackendHeartbeatIdleMs must exceed // BackendRequestTimeoutMs. See docs/Architecture/Keepalive.md. "Connection": { "BackendConnectTimeoutMs": 3000, "BackendRequestTimeoutMs": 3000, "GracefulShutdownTimeoutMs": 10000, "Keepalive": { "Enabled": true, "TcpIdleTimeMs": 30000, "TcpProbeIntervalMs": 5000, "TcpProbeCount": 4, "BackendHeartbeatIdleMs": 30000, "BackendHeartbeatProbeAddress": 0 } }, // Polly policies: backend-connect retry, listener-bind recovery, read coalescing. // BackendConnect / ListenerRecovery are restart-only (not hot-reloaded). "Resilience": { "BackendConnect": { "MaxAttempts": 3, "BackoffMs": [ 100, 500, 2000 ] }, "ListenerRecovery": { "InitialBackoffMs": [ 1000, 2000, 5000, 15000, 30000 ], "SteadyStateMs": 30000 }, "ReadCoalescing": { "Enabled": true, "MaxParties": 32 } }, // Opt-in response cache — OFF by default per tag. A tag opts in via its CacheTtlMs // (or a PLC's DefaultCacheTtlMs); these are service-wide safety knobs only. // See docs/Architecture/ResponseCache.md. "Cache": { "AllowLongTtl": false, "MaxEntriesPerPlc": 1000, "EvictionIntervalMs": 5000 } }, // Structured logging — console (captured by systemd-journald) + daily rolling file // under /var/log/mbproxy. Error+ events also go to local syslog under systemd (wired // in code, not here). See docs/Operations/Troubleshooting.md. "Serilog": { "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], "MinimumLevel": { "Default": "Information", "Override": { "Microsoft": "Warning", "System": "Warning" } }, "WriteTo": [ { "Name": "Console", "Args": { "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}" } }, { "Name": "File", "Args": { "path": "/var/log/mbproxy/mbproxy-.log", "rollingInterval": "Day", "retainedFileCountLimit": 30, "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}" } } ] } }