PowerSentry Deploy — Control Panel (UI Daemon)
Overview
Deploys the PowerSentry control panel on a server (e.g., dk1). The control panel includes:
- WebSocket Server (
:8765): Receives real-time metrics from worker agents - HTTP Server (
:8080): Serves the web dashboard and REST API - Central Database (SQLite): Stores all worker data
- Web UI (Vue 3 + Tailwind + DaisyUI): Real-time dashboard
Prerequisites
- SSH access to the target server (e.g., dk1@92.113.145.178)
- SSH key for the target server
- Python 3 on the target
- WebSocket port
:8765and HTTP port:8080must be open/forwarded
.env Configuration
# proxmox-power-monitor/.env
DK1_HOST=<control-panel-ip> # Public IP or hostname of the control panel server
DK1_USER=<ssh-username> # SSH username (e.g., dk1 for dk1 VM)
Deployment Steps
1. Run deploy-control-panel script
cd proxmox-power-monitor
./deploy-control-panel.sh <control-panel-host>
# Example: ./deploy-control-panel.sh 92.113.145.178
The script will:
- Load
.envif present - Check connectivity to the target
- Verify Python 3 availability
- Install
websocketsPython package - Create remote directories
- Copy
control-panel/server/server.pyto the target - Copy
control-panel/ui/index.htmlto the target - Create a systemd user service (
powersency-control-panel) - Reload systemd and enable the service
2. SSH into the control panel server
ssh <user>@<control-panel-host>
3. Start the control panel
systemctl --user start powersency-control-panel
systemctl --user status powersency-control-panel
4. Access the web UI
Open http://<control-panel-host>:8080 in a browser.
Service Management
# Check status
systemctl --user status powersency-control-panel
# View logs
journalctl -u powersency-control-panel -f
# Restart
systemctl --user restart powersency-control-panel
# Stop
systemctl --user stop powersency-control-panel
Connecting Workers
Once the control panel is running, workers can connect by specifying the WebSocket URL:
# On each worker (Proxmox host, jump host, etc.)
python3 cli.py install --control-panel=ws://<control-panel-host>:8765/worker
python3 cli.py start
Troubleshooting
Web UI not accessible:
# Check HTTP server is listening
netstat -tlnp | grep 8080
# Check service logs
journalctl -u powersency-control-panel -f
Workers not connecting:
# Check WebSocket server is listening
netstat -tlnp | grep 8765
# Test WebSocket connection
wscat -c ws://<control-panel>:8765/worker
# Check firewall
iptables -L
Ports not accessible:
- Ensure ports
8080and8765are open in any firewall - For cloud VMs, check security group/network ACL rules
- Use SSH port forwarding for testing:
ssh -L 8080:localhost:8080 <user>@<host>