CtrlPanel offers an easy-to-use and free billing solution for all starting and experienced hosting providers that seamlessly integrates with the Pterodactyl panel.
Find a file
2021-06-23 12:22:08 +02:00
.github/ISSUE_TEMPLATE removed workflow tests 2021-06-12 14:55:57 +02:00
app Adding the correct currency_code to payments 2021-06-23 12:22:08 +02:00
bin General improvements to testing environment and removed clutter (#36) 2021-06-09 20:53:58 +02:00
bootstrap first init 2021-06-05 11:26:32 +02:00
config small cleanup 2021-06-12 12:58:04 +02:00
database Some love to payments 2021-06-23 11:28:57 +02:00
docker Fixed docker permissions 2021-06-07 20:33:12 +02:00
public Merge branch 'development' into useful_links_and_menu 2021-06-10 23:36:50 +02:00
resources Some love to payments 2021-06-23 11:28:57 +02:00
routes Some love to payments 2021-06-23 11:28:57 +02:00
storage first init 2021-06-05 11:26:32 +02:00
tests cleanup 2021-06-12 14:40:40 +02:00
.editorconfig first init 2021-06-05 11:26:32 +02:00
.env.example role to discord user 2021-06-12 17:29:08 +02:00
.gitattributes first init 2021-06-05 11:26:32 +02:00
.gitignore gitignore update 2021-06-15 11:22:31 +02:00
.styleci.yml first init 2021-06-05 11:26:32 +02:00
artisan first init 2021-06-05 11:26:32 +02:00
BUILDING.md small cleanup 2021-06-12 12:58:04 +02:00
composer first init 2021-06-05 11:26:32 +02:00
composer.json General improvements to testing environment and removed clutter (#36) 2021-06-09 20:53:58 +02:00
composer.lock 7.4 support 2021-06-06 23:27:09 +02:00
CONTRIBUTING.md Added contributing.md for people who want to contribute 2021-06-06 14:41:32 +02:00
LICENSE first init 2021-06-05 11:26:32 +02:00
package-lock.json first init 2021-06-05 11:26:32 +02:00
package.json first init 2021-06-05 11:26:32 +02:00
phpunit.xml API authorization and Testing WIP 2021-06-10 21:09:37 +02:00
README.md added better seeding for better update support 2021-06-07 17:30:19 +02:00
server.php first init 2021-06-05 11:26:32 +02:00
test.json first init 2021-06-05 11:26:32 +02:00
webpack.mix.js first init 2021-06-05 11:26:32 +02:00

ControlPanel's Dashboard

ControlPanel's Dashboard is a dashboard application designed to offer clients a management tool to manage their pterodactyl servers. This dashboard comes with a credit-based billing solution that credits users hourly for each server they have and suspends them if they run out of credits.

This dashboard is built with Laravel as it offers a very robust and secure development environment.

I copied a part of pterodactyls documentation for the installation because it uses the same dependencies and covers this area pretty good.

Dependencies

  • PHP 7.4 or 8.0 (recommended) with the following extensions: cli, openssl, gd, mysql, PDO, mbstring, tokenizer, bcmath, xml or dom, curl, zip, and fpm if you are planning to use NGINX.
  • MySQL 5.7.22 or higher (MySQL 8 recommended) or MariaDB 10.2 or higher.
  • Redis (redis-server)
  • A webserver (Apache, NGINX, Caddy, etc.)
  • curl
  • tar
  • unzip
  • git
  • composer v2

Example Dependency Installation

if you already have pterodactyl installed you can skip this step!

The commands below are simply an example of how you might install these dependencies. Please consult with your operating system's package manager to determine the correct packages to install.

# Add "add-apt-repository" command
apt -y install software-properties-common curl apt-transport-https ca-certificates gnupg

# Add additional repositories for PHP, Redis, and MariaDB
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:chris-lea/redis-server
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

# Update repositories list
apt update

# Add universe repository if you are on Ubuntu 18.04
apt-add-repository universe

# Install Dependencies
apt -y install php8.0 php8.0-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} mariadb-server nginx tar unzip git redis-server

Extra dependency used on this dashboard

you need to install this, use the appropriate php version (php -v)

sudo apt-get install php8.0-intl

Installing Composer

if you already have pterodactyl installed you can skip this step!

Composer is a dependency manager for PHP that allows us to ship everything you'll need code wise to operate the Panel. You'll need composer installed before continuing in this process.

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Download Files

The first step in this process is to create the folder where the panel will live and then move ourselves into that newly created folder. Below is an example of how to perform this operation.

mkdir -p /var/www/dashboard
cd /var/www/dashboard
git clone https://github.com/ControlPanel-gg/dashboard.git ./
chmod -R 755 storage/* bootstrap/cache/

Installation

Now that all of the files have been downloaded we need to configure some core aspects of the Panel.

You will need a database setup and a user with the correct permissions created for that database before continuing any further.

First we will copy over our default environment settings file, install core dependencies, and then generate a new application encryption key.

cp .env.example .env
composer install

# Only run the command below if you are installing this Panel
php artisan key:generate --force


# you should create a symbolic link from public/storage to storage/app/public
php artisan storage:link

Back up your encryption key (APP_KEY in the .env file). It is used as an encryption key for all data that needs to be stored securely (e.g. api keys). Store it somewhere safe - not just on your server. If you lose it all encrypted data is irrecoverable -- even if you have database backups.

Environment Configuration

Simply edit the .env to your needs

Please do not forget to enter the database creds in here, or the next step won't work Please do not forget to enter your pterodactyl api key in here, or the next steps won't work

nano .env

Database Setup

Now we need to setup all of the base data for the Panel in the database you created earlier. The command below may take some time to run depending on your machine. Please DO NOT exit the process until it is completed! This command will setup the database tables and then add all of the Nests & Eggs that power Pterodactyl.

php artisan migrate --seed --force

Add some example products

This step is optional, only run this once

php artisan db:seed --class=ExampleItemsSeeder --force

Add The First User

php artisan make:user

Set Permissions

The last step in the installation process is to set the correct permissions on the Panel files so that the webserver can use them correctly.

# If using NGINX or Apache (not on CentOS):
chown -R www-data:www-data /var/www/dashboard/*

# If using NGINX on CentOS:
chown -R nginx:nginx /var/www/dashboard/*

# If using Apache on CentOS
chown -R apache:apache /var/www/dashboard/*

Crontab Configuration

The first thing we need to do is create a new cronjob that runs every minute to process specific Dashboard tasks. like billing users hourly and suspending unpaid servers

* * * * * php /var/www/dashboard/artisan schedule:run >> /dev/null 2>&1

Nginx

You should paste the contents of the file below, replacing with your domain name being used in a file called dashboard.conf and place it in /etc/nginx/sites-available/, or — if on CentOS, /etc/nginx/conf.d/.

server {
        listen 80;
        root /var/www/dashboard/public;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name YOUR.DOMAIN.COM;

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
        }

        location ~ /\.ht {
                deny all;
        }
}

Enable configuration

The final step is to enable your NGINX configuration and restart it.

# You do not need to symlink this file if you are using CentOS.
sudo ln -s /etc/nginx/sites-available/dashboard.conf /etc/nginx/sites-enabled/dashboard.conf

# Check for nginx errors
sudo nginx -t

# You need to restart nginx regardless of OS. only do this you haven't received any errors
systemctl restart nginx