This commit is contained in:
Mateusz Gruszczyński
2025-10-17 14:26:17 +02:00
parent 9a21739eb9
commit 38e5fc6e49
5 changed files with 664 additions and 489 deletions

140
README.md
View File

@@ -1,20 +1,42 @@
# 1) katalog + venv
sudo mkdir -p /opt/pve-ha-web
sudo chown -R $USER:$USER /opt/pve-ha-web
# PVE HA Web Panel — Deployment Guide
This guide explains how to deploy **PVE HA Web Panel** on a Proxmox host or any Debian/Ubuntu-like system.
---
## 1) Create directory
```bash
mkdir -p /opt/pve-ha-web
cd /opt/pve-ha-web
```
# 2) pliki aplikacji (app.py, templates/, static/, requirements.txt) — skopiuj tu
# …gdy już je masz w katalogu…
## 2) Get the application
# 3) virtualenv + deps
Clone the repository (includes `app.py`, `templates/`, `static/`, `requirements.txt`).
```bash
git clone https://gitea.linuxiarz.pl/gru/pve-ha-web.git .
```
> **Note:** The trailing `.` clones directly into `/opt/pve-ha-web` instead of a nested subfolder.
## 3) Python virtualenv & dependencies
```bash
python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
deactivate
```
# 4) systemd unit
sudo tee /etc/systemd/system/pve-ha-web.service >/dev/null <<'UNIT'
## 4) systemd unit
Create a service unit file for Gunicorn:
```bash
tee /etc/systemd/system/pve-ha-web.service >/dev/null <<'UNIT'
[Unit]
Description=PVE HA Web Panel
After=network.target
@@ -23,7 +45,7 @@ After=network.target
Type=simple
WorkingDirectory=/opt/pve-ha-web
Environment="PYTHONUNBUFFERED=1"
ExecStart=/opt/pve-ha-web/venv/bin/gunicorn -w 2 -b 0.0.0.0:8000 app:app
ExecStart=/opt/pve-ha-web/venv/bin/gunicorn -w 2 -b 0.0.0.0:8007 app:app
Restart=on-failure
RestartSec=3
User=root
@@ -32,11 +54,101 @@ Group=root
[Install]
WantedBy=multi-user.target
UNIT
```
# 5) start + autostart
sudo systemctl daemon-reload
sudo systemctl enable --now pve-ha-web
> **Port:** The app listens on `8007` by default. Adjust as needed.
# 6) sprawdzenie
## 5) Enable & start
```bash
systemctl daemon-reload
systemctl enable --now pve-ha-web
```
## 6) Verify
```bash
systemctl status pve-ha-web
ss -ltnp | grep :8000
ss -ltnp | grep :8007
```
Open the app in the browser: `http://<server-ip>:8007`
---
## Optional: Reverse proxy (Nginx)
If you want to expose it under standard HTTPS with a domain:
```nginx
server {
listen 80;
server_name ha.example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name ha.example.com;
# TLS certs (replace with your paths / cert manager)
ssl_certificate /etc/letsencrypt/live/ha.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ha.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8007;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
Reload Nginx: `sudo systemctl reload nginx`
---
## Management
### Logs
```bash
journalctl -u pve-ha-web -e -f
```
### Restart / stop
```bash
sudo systemctl restart pve-ha-web
sudo systemctl stop pve-ha-web
```
### Update to latest version
```bash
cd /opt/pve-ha-web
git pull --rebase
source venv/bin/activate
pip install -r requirements.txt
deactivate
sudo systemctl restart pve-ha-web
```
---
## Uninstall
```bash
sudo systemctl disable --now pve-ha-web
sudo rm -f /etc/systemd/system/pve-ha-web.service
sudo systemctl daemon-reload
sudo rm -rf /opt/pve-ha-web
```
---
## Project
- Author: **linuxiarz.pl**
- Source: <https://gitea.linuxiarz.pl/gru/pve-ha-web>