Deployment Topology
Jope.SMB 運行於兩台主機:Plant IPC(Console + Historian,Windows)與 專用 Inference Host(plant LAN,運行 Python Inference Server)。 本頁涵蓋兩台主機的 prerequisites、installer、process management、network config、備份與升級路徑。
目標環境
Plant IPC(Console + Historian)
| 項目 | 需求 |
|---|---|
| OS | Windows 10 21H2+ 或 Windows 11 21H2+ |
| CPU | 4+ 核 @ 2.5 GHz(建議 6+ 核) |
| RAM | 16 GB |
| Disk | 500 GB SSD(historian 7 年保留約 100-200 GB / 年) |
| Network | 隔離 plant VLAN;無直接 internet 存取 |
Inference Host(獨立主機,預設)
| 項目 | 需求 |
|---|---|
| OS | Linux(推薦 — Ubuntu 22.04 LTS / Rocky 9)、Windows Server 2022 或 container host (Docker / Podman) |
| CPU | 8+ 核 @ 3.0 GHz |
| RAM | 32 GB(若 model > 500 MB 或使用 GPU buffering 則 64 GB) |
| GPU (選配) | NVIDIA 搭 CUDA 12+(若使用 GPU 加速推論) |
| Disk | 200 GB SSD |
| Network | Plant VLAN,TCP 連至 Plant IPC 的 ports 5555、5556 |
Runtime Prerequisites
Plant IPC(Windows)
| 元件 | 版本 | 用途 |
|---|---|---|
| .NET Desktop Runtime 8 | 8.0.x(最新 LTS patch) | 執行 Jope.SMB Console |
| TimescaleDB | 2.15+(PostgreSQL 15+) | Historian |
| Visual C++ Redistributable | 2015-2022 | Native 相依 |
Inference Host
| 元件 | 版本 | 用途 |
|---|---|---|
| Python | 3.11.x | 執行 Inference Server |
| Process manager | systemd(Linux,推薦)或 Docker / Podman | 以 daemon 執行 Inference,auto-restart |
| CUDA Toolkit (選配) | 12.x | GPU 加速推論 |
Installation Layout
Plant IPC(Windows)
C:\Jope\
├── SMB\ ← Console binaries
│ ├── Jope.SMB.WPF.exe
│ ├── config\
│ │ ├── app.json ← endpoints · theme · language
│ │ └── devices.json ← device COM port 分配
│ └── logs\
└── Historian\ ← TimescaleDB data dir(容量考量可放 D:\)
└── data\
Inference Host(Linux · 推薦)
/opt/jope-inference/
├── venv/ ← 獨立 Python 環境
├── main.py
├── models/ ← .joblib files + metadata
├── config/
│ └── server.toml ← endpoint binding · model paths
└── logs/
/etc/systemd/system/
└── jope-inference.service ← systemd unit
Inference Host(Docker · 替代方案)
jope-inference/
├── Dockerfile
├── docker-compose.yml ← 單一服務 compose
├── models/ ← mount 為 volume
└── config/ ← mount 為 volume
Process Management
Plant IPC · Service Registration
| Service Name | Process | Start Mode | Depends On |
|---|---|---|---|
postgresql-x64-15 | PostgreSQL + TimescaleDB(Windows Service) | Auto | — |
Console 不是 service — 在 logged-in operator session 下互動式執行。 這是設計上的刻意:electronic signature dialog 必須對使用者可見, session-tied UI 也是合規的期望。
Inference Host · daemon
- Linux(推薦):
systemctl enable --now jope-inference.service。Unit file 設Restart=always、User=jope、WorkingDirectory=/opt/jope-inference。 - Docker:
docker compose up -d— restart policyunless-stopped。
Daemon 對 plant LAN 開放 ZMQ :5555 與 HTTP :5556。
Network Configuration
| Endpoint | Port | 主機 | 備註 |
|---|---|---|---|
| Inference ZMQ | 5555 | Inference Host | TCP bind 至 plant LAN;於 Console app.json 可配置 |
| Inference REST | 5556 | Inference Host | HTTP/1.1;JSON |
| Historian | 5432 | Plant IPC(loopback 優先) | PostgreSQL 預設 |
| Raman gateway | 502 | Plant LAN | Modbus TCP |
| Operator Console | — | Plant IPC | 無 listening port;僅對外連線 |
Firewall Rules
Inference Host(Linux iptables / firewalld 或 Windows Firewall):
- Allow inbound
5555+5556僅限 Plant IPC 位址 - Block 所有 plant VLAN 其他 inbound
- Block 所有 outbound 至 internet(plant 為 air-gap)
Plant IPC(Windows Firewall):
- Allow outbound 至 Inference Host 的
5555+5556 - Block 所有 plant VLAN inbound
- Block 所有 outbound 至 internet
Deployment Layout
Plant LAN 上兩台主機:
Plant IPC (Windows) Inference Host (推薦 Linux)
├── Jope.SMB Console ├── Inference Server (daemon)
└── TimescaleDB (service) └── Model Registry (.joblib files)
│ ▲
└────── plant LAN ─────────────┘
ZMQ :5555 + REST :5556
- Plant IPC — Windows;互動執行 Console + Historian 為 service。掌管硬體 I/O。
- Inference Host — Linux + systemd(推薦)或 Docker / Podman。以 daemon 執行 Python Inference。獨立 CPU / RAM / 選配 GPU 資源。
為何分離:
- Plant IPC 可專注於即時硬體 polling + operator UI + 合規寫入,不受 Python GIL / 訓練 CPU 峰值干擾
- Inference Host 可獨立 sizing(更多 RAM 給較大 model、選配 GPU 做平行推論)
- 訓練 job(可能 saturate CPU 數分鐘)不影響 Console 反應
- Python ML 工具鏈於 Linux 原生運行;無需強制 Windows 相容
- 未來 model 演進時,Inference Host 較容易獨立 scale / 替換
Plant LAN 延遲 ~1-2 ms,遠在 predict p95 ≤ 20 ms 目標內。
Backup
| Scope | Frequency | Target | Retention | Encryption |
|---|---|---|---|---|
| Historian (full) | 每日 02:00 | NAS \\nas01\backup\jope-smb\ | 90 天滾動 + 每月 archive(1 年) | AES-256 at rest |
| Historian (WAL) | 持續 | 同上 | 隨 full backup | AES-256 |
Config(C:\Jope\SMB\config\) | 每週 | 同上 | 90 天 | AES-256 |
Models(C:\Jope\Inference\models\) | 變更時 | 同上 | 無限(檔小) | Signed packages |
Restore 需 雙簽核,見 Compliance Mapping · 4-Eyes。
Upgrade Path
每個元件都有版本化升級腳本:
- 宣告 maintenance window — Console 於 24 小時前顯示 banner
- 優雅停批次 — operator 完成當前 run,不強制中斷
- 完整備份 + WAL snapshot
- 停服務(Inference 先停,Console 次之 — Historian 保留以便查詢)
- 執行 upgrade installer
- 套用 DB migrations — TimescaleDB schema 變更版本化;
downscripts 存在 - 驗證 —
Jope.SMB.Core.Testssmoke tests;device connectivity checks - 重啟 services + Console
- Audit event:
SystemUpgraded,帶{old_version, new_version, operator, timestamp}
Rollback:從升級前備份還原;需雙簽核。
Monitoring
- Windows Event Log: 每個 service 寫入 structured JSON line
- Operator Console · Status Bar: Inference heartbeat、Historian 連線狀態、剩餘磁碟
- Historian self-query:
SELECT COUNT(*) FROM audit_events WHERE ts > now() - interval '24 h'— 應單調成長 - Optional — 廠房 SCADA 可 poll Inference Server 的
/health做全廠 dashboard
Installer 責任分工
| 項目 | 負責單位 |
|---|---|
| Installer 打包(Plant IPC MSI + Inference Host image / systemd unit) | Jope 工程團隊 |
| Plant OS provisioning | Plant IT |
| User 帳號建立(dev + service) | Plant IT |
| 首次開機驗證 | Jope 工程 + Plant QA |
| 持續 patching(Windows Update) | Plant IT,宣告 maintenance window |
| Jope.SMB 版本升級 | Jope 工程,Plant QA 雙簽核 |