diff --git a/README.md b/README.md index 820e327..1eb025c 100644 --- a/README.md +++ b/README.md @@ -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:** бот запускается автоматически diff --git a/install.sh b/install.sh index 9612426..887ca83 100755 --- a/install.sh +++ b/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 | bash -s -- --port 9090" +echo "" echo " ⚠️ Смените пароль в настройках панели!" echo "================================================" diff --git a/server/main.py b/server/main.py index 7acea04..b9d3da2 100644 --- a/server/main.py +++ b/server/main.py @@ -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) diff --git a/server/services/telegram_bot.py b/server/services/telegram_bot.py index bbae4ed..2df2971 100644 --- a/server/services/telegram_bot.py +++ b/server/services/telegram_bot.py @@ -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) diff --git a/server/static/js/app.js b/server/static/js/app.js index 88e30ee..4f5a539 100644 --- a/server/static/js/app.js +++ b/server/static/js/app.js @@ -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:'; diff --git a/server/templates/dashboard.html b/server/templates/dashboard.html index f9de599..2fadbed 100644 --- a/server/templates/dashboard.html +++ b/server/templates/dashboard.html @@ -5,7 +5,7 @@ VPS Monitoring - + @@ -165,7 +165,8 @@ - + + diff --git a/systemd/vps-monitoring.service b/systemd/vps-monitoring.service index 26af255..0663727 100644 --- a/systemd/vps-monitoring.service +++ b/systemd/vps-monitoring.service @@ -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