mirror of
https://github.com/andrey271192/vps_monitoring.git
synced 2026-09-20 11:55:34 +00:00
fix: xterm.js CDN → jsdelivr, port 8000 → 7272, custom port in installer
- Switch xterm.js from cdnjs (404) to jsdelivr (working) - Add xterm-addon-fit for auto-resize terminal - Change default port from 8000 to 7272 everywhere - Install script: --port flag for custom port selection - sed-based port injection into systemd service at install time Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,11 @@
|
||||
curl -sSL https://raw.githubusercontent.com/andrey271192/vps_monitoring/main/install.sh | bash
|
||||
```
|
||||
|
||||
Кастомный порт:
|
||||
```bash
|
||||
curl -sSL https://raw.githubusercontent.com/andrey271192/vps_monitoring/main/install.sh | bash -s -- --port 9090
|
||||
```
|
||||
|
||||
### Требования
|
||||
- Ubuntu 20.04+ / Debian 11+
|
||||
- Python 3.10+
|
||||
@@ -25,7 +30,7 @@ curl -sSL https://raw.githubusercontent.com/andrey271192/vps_monitoring/main/ins
|
||||
|
||||
## После установки
|
||||
|
||||
- **Панель:** `http://YOUR_IP:8000`
|
||||
- **Панель:** `http://YOUR_IP:7272`
|
||||
- **Логин:** `admin` / `admin`
|
||||
- **Telegram:** бот запускается автоматически
|
||||
|
||||
|
||||
36
install.sh
36
install.sh
@@ -3,6 +3,7 @@ set -e
|
||||
|
||||
# VPS Monitoring — One-command installer
|
||||
# Usage: curl -sSL https://raw.githubusercontent.com/andrey271192/vps_monitoring/main/install.sh | bash
|
||||
# Custom port: curl -sSL ... | bash -s -- --port 9090
|
||||
|
||||
echo "================================================"
|
||||
echo " 🖥 VPS Monitoring — Установка"
|
||||
@@ -12,6 +13,23 @@ echo ""
|
||||
APP_DIR="/opt/vps-monitoring"
|
||||
REPO_URL="https://github.com/andrey271192/vps_monitoring.git"
|
||||
SERVICE_NAME="vps-monitoring"
|
||||
PORT=7272
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--port|-p)
|
||||
PORT="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "🔌 Порт: $PORT"
|
||||
echo ""
|
||||
|
||||
# Check root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
@@ -47,22 +65,23 @@ mkdir -p data
|
||||
# Setup environment variables
|
||||
if [ ! -f .env ]; then
|
||||
echo "⚙️ Создание конфигурации..."
|
||||
cat > .env << 'ENVEOF'
|
||||
cat > .env << ENVEOF
|
||||
TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN:-}
|
||||
TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID:-}
|
||||
PORT=${PORT}
|
||||
ENVEOF
|
||||
fi
|
||||
|
||||
# Install systemd service
|
||||
echo "🔧 Установка systemd сервиса..."
|
||||
cp systemd/vps-monitoring.service /etc/systemd/system/
|
||||
# Install systemd service with custom port
|
||||
echo "🔧 Установка systemd сервиса (порт $PORT)..."
|
||||
sed "s/--port 7272/--port $PORT/" systemd/vps-monitoring.service > /etc/systemd/system/vps-monitoring.service
|
||||
systemctl daemon-reload
|
||||
systemctl enable $SERVICE_NAME
|
||||
systemctl restart $SERVICE_NAME
|
||||
|
||||
# Firewall (allow 8000)
|
||||
# Firewall
|
||||
if command -v ufw &> /dev/null; then
|
||||
ufw allow 8000/tcp > /dev/null 2>&1 || true
|
||||
ufw allow ${PORT}/tcp > /dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# Get server IP
|
||||
@@ -73,7 +92,7 @@ echo "================================================"
|
||||
echo " ✅ Установка завершена!"
|
||||
echo "================================================"
|
||||
echo ""
|
||||
echo " 🌐 Панель: http://${SERVER_IP}:8000"
|
||||
echo " 🌐 Панель: http://${SERVER_IP}:${PORT}"
|
||||
echo " 👤 Логин: admin"
|
||||
echo " 🔑 Пароль: admin"
|
||||
echo ""
|
||||
@@ -85,5 +104,8 @@ echo " systemctl status $SERVICE_NAME"
|
||||
echo " systemctl restart $SERVICE_NAME"
|
||||
echo " journalctl -u $SERVICE_NAME -f"
|
||||
echo ""
|
||||
echo " 💡 Кастомный порт при установке:"
|
||||
echo " curl -sSL <URL> | bash -s -- --port 9090"
|
||||
echo ""
|
||||
echo " ⚠️ Смените пароль в настройках панели!"
|
||||
echo "================================================"
|
||||
|
||||
@@ -96,4 +96,4 @@ async def health():
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
uvicorn.run("server.main:app", host="0.0.0.0", port=8000, reload=True)
|
||||
uvicorn.run("server.main:app", host="0.0.0.0", port=7272, reload=True)
|
||||
|
||||
@@ -42,7 +42,7 @@ async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
]
|
||||
|
||||
keyboard.append([
|
||||
InlineKeyboardButton("🌐 Открыть панель", url=f"http://{_get_host()}:8000")
|
||||
InlineKeyboardButton("🌐 Открыть панель", url=f"http://{_get_host()}:7272")
|
||||
])
|
||||
|
||||
reply_markup = InlineKeyboardMarkup(keyboard)
|
||||
|
||||
@@ -234,6 +234,15 @@ function openSSH(id, name) {
|
||||
});
|
||||
|
||||
term.open(container);
|
||||
|
||||
// Fit addon
|
||||
if (typeof FitAddon !== 'undefined') {
|
||||
const fitAddon = new FitAddon.FitAddon();
|
||||
term.loadAddon(fitAddon);
|
||||
setTimeout(() => fitAddon.fit(), 100);
|
||||
window.addEventListener('resize', () => fitAddon.fit());
|
||||
}
|
||||
|
||||
currentTerminal = term;
|
||||
|
||||
const protocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>VPS Monitoring</title>
|
||||
<link rel="stylesheet" href="/static/css/style.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/xterm/5.3.0/xterm.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.min.css">
|
||||
<script src="/static/js/theme.js"></script>
|
||||
<script src="/static/js/i18n.js"></script>
|
||||
</head>
|
||||
@@ -165,7 +165,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/xterm/5.3.0/xterm.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.min.js"></script>
|
||||
<script src="/static/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -8,7 +8,7 @@ User=root
|
||||
WorkingDirectory=/opt/vps-monitoring
|
||||
Environment=TELEGRAM_BOT_TOKEN=8815672362:AAFGwxrWjSsjGuc9iBpX0aupKRoKkviS2NA
|
||||
Environment=TELEGRAM_CHAT_ID=371010834
|
||||
ExecStart=/opt/vps-monitoring/venv/bin/uvicorn server.main:app --host 0.0.0.0 --port 8000
|
||||
ExecStart=/opt/vps-monitoring/venv/bin/uvicorn server.main:app --host 0.0.0.0 --port 7272
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user