Добавить WEB UI (IPC)
parent
834af99699
commit
2da99a237e
|
|
@ -0,0 +1,355 @@
|
|||
## IOMATEX Edge Console (WebIPC) — Installation and Structure
|
||||
|
||||
### Overview
|
||||
|
||||
WebIPC Engineer Console is a local web interface for the IOMATEX Edge device.
|
||||
|
||||
It consists of three layers:
|
||||
|
||||
1. **Core Installer (WebIPC runtime)**
|
||||
2. **Backend Addon (API + MQTT contract)**
|
||||
3. **Frontend Addon (UI extension)**
|
||||
|
||||
Architecture:
|
||||
|
||||
```
|
||||
Browser UI
|
||||
│
|
||||
Frontend Addons
|
||||
│
|
||||
WebIPC Core (Node.js API)
|
||||
│
|
||||
Backend Addons
|
||||
│
|
||||
MQTT / System services / Edge runtime
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 1. Components
|
||||
|
||||
## 1. Core Installer
|
||||
|
||||
Installs the main WebIPC runtime.
|
||||
|
||||
Contains:
|
||||
|
||||
* Node.js server
|
||||
* HTTP API
|
||||
* systemd service
|
||||
* addon loader
|
||||
* base UI
|
||||
* service monitoring
|
||||
* MQTT helper functions
|
||||
|
||||
Installed files:
|
||||
|
||||
```
|
||||
/opt/iomatex-process1-webipc
|
||||
```
|
||||
|
||||
Important directories:
|
||||
|
||||
```
|
||||
/opt/iomatex-process1-webipc
|
||||
├── server.js
|
||||
├── package.json
|
||||
├── public/
|
||||
│ └── index.html
|
||||
├── addons/
|
||||
│ ├── backend/
|
||||
│ └── public/
|
||||
```
|
||||
|
||||
Systemd service:
|
||||
|
||||
```
|
||||
/etc/systemd/system/iomatex-webipc.service
|
||||
```
|
||||
|
||||
Default port:
|
||||
|
||||
```
|
||||
8099
|
||||
```
|
||||
|
||||
Web access:
|
||||
|
||||
```
|
||||
http://EDGE-IP:8099
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 2. Backend Addon (Itscreen)
|
||||
|
||||
Adds:
|
||||
|
||||
* Itscreen MQTT contract
|
||||
* registration API
|
||||
* server discovery
|
||||
* credentials storage
|
||||
|
||||
Location:
|
||||
|
||||
```
|
||||
/opt/iomatex-process1-webipc/addons/backend/itscreen.js
|
||||
```
|
||||
|
||||
Configuration file:
|
||||
|
||||
```
|
||||
/etc/iomatex/webipc-itscreen.json
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
{
|
||||
"server": "",
|
||||
"deviceId": "",
|
||||
"token": "",
|
||||
"username": "",
|
||||
"password": ""
|
||||
}
|
||||
```
|
||||
|
||||
API endpoints added:
|
||||
|
||||
```
|
||||
/api/itscreen/config
|
||||
/api/itscreen/login
|
||||
/api/itscreen/get_server
|
||||
/api/itscreen/register
|
||||
/api/itscreen/config/clear
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 3. Frontend Addon (Itscreen UI)
|
||||
|
||||
Extends the UI:
|
||||
|
||||
* Itscreen card in **Main**
|
||||
* Itscreen tab
|
||||
* registration form
|
||||
* refresh button
|
||||
* dynamic buttons (Register / Clear)
|
||||
|
||||
Location:
|
||||
|
||||
```
|
||||
/opt/iomatex-process1-webipc/public/addons/itscreen-ui.js
|
||||
```
|
||||
|
||||
Frontend addons are auto-loaded by WebIPC:
|
||||
|
||||
```
|
||||
/api/addons
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 4. Installation Order
|
||||
|
||||
Always install in this order.
|
||||
|
||||
### Step 1 — Core Installer
|
||||
|
||||
```
|
||||
sudo bash installer.sh
|
||||
```
|
||||
|
||||
Installs:
|
||||
|
||||
```
|
||||
WebIPC runtime
|
||||
systemd service
|
||||
base UI
|
||||
addon framework
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Step 2 — Backend Addon
|
||||
|
||||
```
|
||||
sudo bash stage_ui_addon_itscreen.sh
|
||||
```
|
||||
|
||||
Adds:
|
||||
|
||||
```
|
||||
MQTT contract
|
||||
API endpoints
|
||||
configuration storage
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Step 3 — Frontend Addon
|
||||
|
||||
```
|
||||
sudo bash itscreen_ui_addon.sh
|
||||
```
|
||||
|
||||
Adds:
|
||||
|
||||
```
|
||||
UI panels
|
||||
registration interface
|
||||
buttons
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 5. File Layout Summary
|
||||
|
||||
```
|
||||
/opt/iomatex-process1-webipc
|
||||
server.js
|
||||
package.json
|
||||
|
||||
addons/backend/
|
||||
itscreen.js
|
||||
|
||||
public/
|
||||
index.html
|
||||
|
||||
public/addons/
|
||||
itscreen-ui.js
|
||||
```
|
||||
|
||||
Configs:
|
||||
|
||||
```
|
||||
/etc/iomatex/webipc.json
|
||||
/etc/iomatex/webipc-itscreen.json
|
||||
```
|
||||
|
||||
Service:
|
||||
|
||||
```
|
||||
/etc/systemd/system/iomatex-webipc.service
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 6. Service Control
|
||||
|
||||
Check status:
|
||||
|
||||
```
|
||||
systemctl status iomatex-webipc.service
|
||||
```
|
||||
|
||||
Restart:
|
||||
|
||||
```
|
||||
sudo systemctl restart iomatex-webipc.service
|
||||
```
|
||||
|
||||
Stop:
|
||||
|
||||
```
|
||||
sudo systemctl stop iomatex-webipc.service
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 7. Full Removal (Clean Reset)
|
||||
|
||||
To completely remove WebIPC and addons:
|
||||
|
||||
```
|
||||
sudo systemctl stop iomatex-webipc.service 2>/dev/null
|
||||
sudo systemctl disable iomatex-webipc.service 2>/dev/null
|
||||
sudo rm -f /etc/systemd/system/iomatex-webipc.service
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
sudo rm -rf /opt/iomatex-process1-webipc*
|
||||
sudo rm -f /etc/iomatex/webipc.json
|
||||
sudo rm -f /etc/iomatex/webipc-itscreen.json
|
||||
```
|
||||
|
||||
This removes:
|
||||
|
||||
```
|
||||
WebIPC runtime
|
||||
backend addons
|
||||
frontend addons
|
||||
configs
|
||||
systemd service
|
||||
```
|
||||
|
||||
Other system files remain untouched:
|
||||
|
||||
```
|
||||
/etc/iomatex/ap.env
|
||||
/etc/iomatex/mqtt_bridge.env
|
||||
/etc/iomatex/wifi.env
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 8. Verification After Installation
|
||||
|
||||
Check service:
|
||||
|
||||
```
|
||||
systemctl status iomatex-webipc.service
|
||||
```
|
||||
|
||||
Check API:
|
||||
|
||||
```
|
||||
curl http://127.0.0.1:8099/api/health
|
||||
```
|
||||
|
||||
Check addons:
|
||||
|
||||
```
|
||||
curl http://127.0.0.1:8099/api/addons
|
||||
```
|
||||
|
||||
Open UI:
|
||||
|
||||
```
|
||||
http://EDGE-IP:8099
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 9. Backup Behavior
|
||||
|
||||
Each reinstall creates a backup:
|
||||
|
||||
```
|
||||
/opt/iomatex-process1-webipc.prev.<timestamp>
|
||||
```
|
||||
|
||||
These can be safely deleted.
|
||||
|
||||
Example cleanup:
|
||||
|
||||
```
|
||||
sudo rm -rf /opt/iomatex-process1-webipc.prev.*
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# 10. Responsibilities by Layer
|
||||
|
||||
| Layer | Responsibility |
|
||||
| -------------- | ------------------------------------- |
|
||||
| Core installer | runtime, API framework, UI framework |
|
||||
| Backend addon | MQTT contract and device registration |
|
||||
| Frontend addon | UI logic and visualization |
|
||||
|
||||
Rule:
|
||||
|
||||
```
|
||||
MQTT contract → backend addon
|
||||
UI behavior → frontend addon
|
||||
System runtime → core installer
|
||||
```
|
||||
Loading…
Reference in New Issue