From 430e2c27f2ca28406bf82cb787bd83a5c44ce0b8 Mon Sep 17 00:00:00 2001 From: Bas van den Berg <74251551+bvdberg01@users.noreply.github.com> Date: Tue, 4 Mar 2025 11:52:03 +0100 Subject: [PATCH] Pterodactyl Panel (#2801) * New Script: Pterodactyl Panel * Add sources and replace tag * Update pterodactyl-panel-install.sh * Update pterodactyl-panel-install.sh * Update pterodactyl-panel-install.sh --- ct/pterodactyl-panel.sh | 74 ++++++++++++++ install/pterodactyl-panel-install.sh | 144 +++++++++++++++++++++++++++ json/pterodactyl-panel.json | 39 ++++++++ 3 files changed, 257 insertions(+) create mode 100644 ct/pterodactyl-panel.sh create mode 100644 install/pterodactyl-panel-install.sh create mode 100644 json/pterodactyl-panel.json diff --git a/ct/pterodactyl-panel.sh b/ct/pterodactyl-panel.sh new file mode 100644 index 000000000..b637f083d --- /dev/null +++ b/ct/pterodactyl-panel.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: bvdberg01 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/pterodactyl/panel + +APP="Pterodactyl-Panel" +var_tags="gaming" +var_cpu="2" +var_ram="1024" +var_disk="4" +var_os="debian" +var_version="12" +var_unprivileged="1" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/pterodactyl-panel ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/pterodactyl/panel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping Service" + cd /opt/pterodactyl-panel + $STD php artisan down + msg_ok "Stopped Service" + + msg_info "Updating ${APP} to v${RELEASE}" + cp -r /opt/pterodactyl-panel/.env /opt/ + rm -rf * .* + wget -q "https://github.com/pterodactyl/panel/releases/download/v${RELEASE}/panel.tar.gz" + tar -xzf "panel.tar.gz" + mv /opt/.env /opt/pterodactyl-panel/ + $STD composer install --no-dev --optimize-autoloader --no-interaction + $STD php artisan view:clear + $STD php artisan config:clear + $STD php artisan migrate --seed --force --no-interaction + chown -R www-data:www-data /opt/pterodactyl-panel/* + chmod -R 755 /opt/pterodactyl-panel/storage /opt/pterodactyl-panel/bootstrap/cache/ + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting Service" + $STD php artisan queue:restart + $STD php artisan up + msg_ok "Started Service" + + msg_info "Cleaning up" + rm -rf "/opt/pterodactyl-panel/panel.tar.gz" + msg_ok "Cleaned" + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}" diff --git a/install/pterodactyl-panel-install.sh b/install/pterodactyl-panel-install.sh new file mode 100644 index 000000000..b0f6f7253 --- /dev/null +++ b/install/pterodactyl-panel-install.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: bvdberg01 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/pterodactyl/panel + +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + lsb-release \ + redis \ + mariadb-server \ + mariadb-client \ + apache2 \ + composer +msg_ok "Installed Dependencies" + +msg_info "Adding PHP8.3 Repository" +$STD curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb +$STD dpkg -i /tmp/debsuryorg-archive-keyring.deb +$STD sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' +$STD apt-get update +msg_ok "Added PHP8.3 Repository" + +msg_info "Installing PHP" +$STD apt-get remove -y php8.2* +$STD apt-get install -y \ + php8.3 \ + php8.3-{gd,mysql,mbstring,bcmath,xml,curl,zip,intl,fpm} \ + libapache2-mod-php8.3 +msg_ok "Installed PHP" + +msg_info "Setting up MariaDB" +DB_NAME=panel +DB_USER=pterodactyl +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD mysql -u root -e "CREATE DATABASE $DB_NAME;" +$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');" +$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" +{ + echo "pterodactyl Panel-Credentials" + echo "pterodactyl Panel Database User: $DB_USER" + echo "pterodactyl Panel Database Password: $DB_PASS" + echo "pterodactyl Panel Database Name: $DB_NAME" +} >> ~/pterodactyl-panel.creds +msg_ok "Set up MariaDB" + +read -p "Provide an email address for admin login, this should be a valid email address: " ADMIN_EMAIL +read -p "Enter your First Name: " NAME_FIRST +read -p "Enter your Last Name: " NAME_LAST + +msg_info "Installing pterodactyl Panel" +RELEASE=$(curl -s https://api.github.com/repos/pterodactyl/panel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +mkdir /opt/pterodactyl-panel +cd /opt/pterodactyl-panel +wget -q "https://github.com/pterodactyl/panel/releases/download/v${RELEASE}/panel.tar.gz" +tar -xzf "panel.tar.gz" +cp .env.example .env +IP=$(hostname -I | awk '{print $1}') +ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD composer install --no-dev --optimize-autoloader --no-interaction +$STD php artisan key:generate --force +$STD php artisan p:environment:setup --no-interaction --author $ADMIN_EMAIL --url "http://$IP" +$STD php artisan p:environment:database --no-interaction --database $DB_NAME --username $DB_USER --password $DB_PASS +$STD php artisan migrate --seed --force --no-interaction +$STD php artisan p:user:make --no-interaction --admin=1 --email "$ADMIN_EMAIL" --password "$ADMIN_PASS" --name-first "$NAME_FIRST" --name-last "$NAME_LAST" --username "admin" +echo "* * * * * php /opt/pterodactyl-panel/artisan schedule:run >> /dev/null 2>&1" | crontab -u www-data - +chown -R www-data:www-data /opt/pterodactyl-panel/* +chmod -R 755 /opt/pterodactyl-panel/storage/* /opt/pterodactyl-panel/bootstrap/cache/ +{ + echo "" + echo "pterodactyl Admin Username: admin" + echo "pterodactyl Admin Email: $ADMIN_EMAIL" + echo "pterodactyl Admin Password: $ADMIN_PASS" +} >> ~/pterodactyl-panel.creds + +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed pterodactyl Panel" + +msg_info "Creating Service" +cat </etc/systemd/system/pteroq.service +[Unit] +Description=Pterodactyl Queue Worker +After=redis-server.service + +[Service] +User=www-data +Group=www-data +Restart=always +ExecStart=/usr/bin/php /opt/pterodactyl-panel/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 +StartLimitInterval=180 +StartLimitBurst=30 +RestartSec=5s + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now pteroq +cat </etc/apache2/sites-available/pterodactyl.conf + + ServerName pterodactyl + DocumentRoot /opt/pterodactyl-panel/public + + AllowEncodedSlashes On + + php_value upload_max_filesize 100M + php_value post_max_size 100M + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + + ErrorLog /var/log/apache2/pterodactyl_error.log + CustomLog /var/log/apache2/pterodactyl_access.log combined + +EOF +$STD a2ensite pterodactyl +$STD a2enmod rewrite +$STD a2dissite 000-default.conf +$STD systemctl reload apache2 +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf "/opt/pterodactyl-panel/panel.tar.gz" +rm -rf "/tmp/debsuryorg-archive-keyring.deb" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/json/pterodactyl-panel.json b/json/pterodactyl-panel.json new file mode 100644 index 000000000..39a0e6036 --- /dev/null +++ b/json/pterodactyl-panel.json @@ -0,0 +1,39 @@ +{ + "name": "Pterodactyl Panel", + "slug": "pterodactyl-panel", + "categories": [ + 24 + ], + "date_created": "2025-03-03", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://pterodactyl.io/panel/1.0/getting_started.html", + "website": "https://pterodactyl.io", + "logo": "https://pterodactyl.io/logos/pterry.svg", + "description": "Pterodactyl Panel is a web-based control panel for managing game and application servers. It provides an intuitive interface to start, stop, configure, and monitor servers easily. It works alongside Pterodactyl Wings, a lightweight daemon that handles server deployments and resource management.", + "install_methods": [ + { + "type": "default", + "script": "ct/pterodactyl-panel.sh", + "resources": { + "cpu": 2, + "ram": 1024, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Show login and database credentials: `cat ~/pterodactyl-panel.creds`", + "type": "info" + } + ] +}