#!/bin/bash set -e clear echo "====================================" echo " Potatorodactyl Installer" echo "====================================" echo "" ######################################## # REQUIRE ROOT ######################################## if [ "$EUID" -ne 0 ]; then echo "Please run as root" exit fi ######################################## # MENU ######################################## echo "1) Install Panel" echo "2) Install Wings" echo "3) Install Both" echo "" read -p "Select option (1-3): " OPTION echo "" ######################################## # ASK USER INFO ######################################## read -p "Panel domain: " DOMAIN read -p "Database name: " DB_NAME read -p "Database user: " DB_USER read -sp "Database password: " DB_PASS echo "" read -p "Admin email: " ADMIN_EMAIL read -sp "Admin password: " ADMIN_PASS echo "" ######################################## # UPDATE SYSTEM ######################################## echo "Updating system..." apt update -y ######################################## # INSTALL BASE DEPENDENCIES ######################################## echo "Installing dependencies..." apt install -y \ curl \ git \ ca-certificates \ gnupg \ mariadb-server \ nginx \ uuid-runtime ######################################## # INSTALL NODE 20 (SAFE) ######################################## echo "Fixing Node environment..." apt remove -y nodejs npm || true apt autoremove -y apt clean rm -f /etc/apt/sources.list.d/nodesource.list echo "Installing Node.js 20..." curl -fsSL https://deb.nodesource.com/setup_20.x | bash - apt install -y nodejs echo "Node version:" node -v echo "NPM version:" npm -v ######################################## # START SERVICES ######################################## systemctl enable mariadb systemctl start mariadb systemctl enable nginx systemctl start nginx ######################################## # CREATE STORAGE (PTERODACTYL STYLE) ######################################## echo "Creating storage directory..." mkdir -p /var/lib/potatorodactyl/volumes mkdir -p /var/log/potatorodactyl chmod -R 755 /var/lib/potatorodactyl ######################################## # CREATE DATABASE ######################################## echo "Creating database..." mysql -e "CREATE DATABASE IF NOT EXISTS $DB_NAME;" mysql -e " CREATE USER IF NOT EXISTS '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS'; " mysql -e " GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost'; " mysql -e "FLUSH PRIVILEGES;" ######################################## # CREATE TABLES ######################################## echo "Creating tables..." mysql $DB_NAME < .env APP_URL=http://$DOMAIN DB_HOST=localhost DB_NAME=$DB_NAME DB_USER=$DB_USER DB_PASSWORD=$DB_PASS PORT=3000 EOF cat < /etc/systemd/system/potatorodactyl-panel.service [Unit] Description=Potatorodactyl Panel After=network.target [Service] Type=simple User=root WorkingDirectory=$REPO_DIR/panel ExecStart=/usr/bin/node src/app.js Restart=always RestartSec=3 [Install] WantedBy=multi-user.target EOF systemctl daemon-reload systemctl enable potatorodactyl-panel systemctl restart potatorodactyl-panel echo "Panel installed" } ######################################## # INSTALL WINGS ######################################## install_wings() { echo "Installing wings..." cd "$REPO_DIR/wings" npm install cat < /etc/systemd/system/potatorodactyl-wings.service [Unit] Description=Potatorodactyl Wings After=network.target [Service] Type=simple User=root WorkingDirectory=$REPO_DIR/wings ExecStart=/usr/bin/node src/app.js Restart=always RestartSec=3 [Install] WantedBy=multi-user.target EOF systemctl daemon-reload systemctl enable potatorodactyl-wings systemctl restart potatorodactyl-wings echo "Wings installed" } ######################################## # RUN OPTION ######################################## case $OPTION in 1) install_panel ;; 2) install_wings ;; 3) install_panel install_wings ;; *) echo "Invalid option" exit ;; esac ######################################## # DONE ######################################## echo "" echo "====================================" echo " Installation completed!" echo "====================================" echo "" echo "Panel URL:" echo "http://$DOMAIN" echo "" echo "Storage path:" echo "/var/lib/potatorodactyl/volumes"