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:
Андрей Бобырев
2026-05-20 12:38:01 +03:00
parent dbe2faf7dc
commit fab7ed7912
7 changed files with 50 additions and 13 deletions

View File

@@ -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 "================================================"