### Enable and Start Redis Server Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/ubuntu.mdx Ensures the Redis server is enabled to start on boot and is started immediately. This is crucial for applications that rely on Redis for caching or session management. ```bash systemctl enable --now redis-server ``` -------------------------------- ### Start Local Development Server Source: https://github.com/ctrlpanel-gg/docs/blob/main/README.md Starts a local development server for live preview of changes. No restart needed for most modifications. ```console yarn start ``` -------------------------------- ### Install Dependencies Source: https://github.com/ctrlpanel-gg/docs/blob/main/README.md Installs project dependencies using Yarn. ```console yarn install ``` -------------------------------- ### Lock Installer Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/migration.mdx Create an empty 'install.lock' file in the CtrlPanel root directory to disable the installer after migration. ```bash touch /var/www/ctrlpanel/install.lock ``` -------------------------------- ### Enable and Start Ctrlpanel Queue Worker Service Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/queue-listeners.mdx Enables the Ctrlpanel queue worker service to start automatically on boot and starts it immediately. ```bash sudo systemctl enable --now ctrlpanel.service ``` -------------------------------- ### Add MariaDB Repository (Debian 12) Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/debian.mdx Adds the MariaDB repository setup script to your system for installing MariaDB on Debian 12. ```bash # Add MariaDB repository (Debian 12 only) curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | bash ``` -------------------------------- ### Install Basic Dependencies (Debian 12) Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/debian.mdx Installs essential packages required for the Pterodactyl Panel installation on Debian 12. ```bash # Install basic dependencies to continue (Debian 12) apt -y install software-properties-common curl apt-transport-https ca-certificates gnupg lsb-release ``` -------------------------------- ### Install Basic Dependencies (Debian 13) Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/debian.mdx Installs essential packages required for the Pterodactyl Panel installation on Debian 13. ```bash # If you're using Debian 13 apt -y install curl apt-transport-https ca-certificates gnupg lsb-release ``` -------------------------------- ### Install Composer Packages Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/composer-packages.mdx Run this command to install all composer packages. It sets COMPOSER_ALLOW_SUPERUSER to 1, disables development packages, and optimizes the autoloader. ```bash COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --optimize-autoloader ``` -------------------------------- ### Install Composer Globally Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/composer-install.mdx Installs Composer globally on your system using a curl command to download and execute the installer script. This command places the composer executable in /usr/local/bin for system-wide access. ```bash curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer ``` -------------------------------- ### Install Certbot and Nginx Plugin Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-nginx-ssl.mdx Installs Certbot and the Nginx plugin required for SSL certificate management. ```bash apt update -y apt install certbot -y apt install python3-certbot-nginx -y ``` -------------------------------- ### Delete Installer Directory Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/delete-installer.mdx Run this command to remove the installer directory from the web server. This is a security measure to prevent abuse. ```bash rm -rf /var/www/ctrlpanel/public/installer ``` -------------------------------- ### Install Ubuntu Dependencies Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/ubuntu.mdx Installs essential packages for Pterodactyl Panel on Ubuntu, including PHP, MariaDB, Nginx, and Redis. Ensure to consult your OS package manager for specific package names. ```bash apt -y install software-properties-common apt-transport-https ca-certificates gnupg LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php apt update -y apt install -y php8.3 php8.3-common php8.3-cli php8.3-gd php8.3-mysql php8.3-mbstring php8.3-bcmath php8.3-xml php8.3-fpm php8.3-curl php8.3-zip php8.3-intl php8.3-redis mariadb-server nginx git redis-server ``` -------------------------------- ### List all products Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/list-all-products.api.mdx Retrieves a list of all products available in the system. This GET request can be used to fetch product data. ```APIDOC ## GET /api/products ### Description Retrieves a list of all products available in the system. ### Method GET ### Endpoint /api/products ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of products to return. - **offset** (integer) - Optional - The number of products to skip before starting to collect the result set. ### Response #### Success Response (200) - **products** (array) - A list of product objects. - **id** (string) - The unique identifier for the product. - **name** (string) - The name of the product. - **description** (string) - A brief description of the product. - **price** (number) - The price of the product. - **currency** (string) - The currency of the product price. - **inStock** (boolean) - Indicates if the product is currently in stock. #### Response Example ```json { "products": [ { "id": "prod_123", "name": "Example Product", "description": "This is a sample product.", "price": 19.99, "currency": "USD", "inStock": true } ] } ``` ``` -------------------------------- ### Update Repositories and Install Dependencies Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/debian.mdx Updates the package list and installs Pterodactyl Panel dependencies including PHP, MariaDB, Nginx, and Redis. ```bash # Update repositories list apt update -y # Install Dependencies apt install -y php8.3 php8.3-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip,intl,redis} mariadb-server nginx git redis-server ``` -------------------------------- ### Get product details Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/get-product-details.api.mdx Retrieves the details of a specific product by its ID. This is a GET request to the /api/products/{id} endpoint. ```APIDOC ## GET /api/products/{id} ### Description Retrieves the details of a specific product by its ID. ### Method GET ### Endpoint /api/products/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the product. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the product. - **name** (string) - The name of the product. - **description** (string) - A description of the product. - **price** (number) - The price of the product. - **category** (string) - The category the product belongs to. - **stock_quantity** (integer) - The number of items currently in stock. - **created_at** (string) - The timestamp when the product was created. - **updated_at** (string) - The timestamp when the product was last updated. ``` -------------------------------- ### List all roles Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/list-all-roles.api.mdx This GET request retrieves all roles available in the system. It does not require any parameters. ```APIDOC ## GET /api/roles ### Description Retrieves a list of all available roles within the system. ### Method GET ### Endpoint /api/roles ### Parameters ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **roles** (array) - A list of role objects, where each object contains details about a specific role. #### Response Example ```json { "roles": [ { "id": "admin", "name": "Administrator", "description": "Full access to the system." }, { "id": "user", "name": "Standard User", "description": "Default user access." } ] } ``` ``` -------------------------------- ### Add Redis APT Repository (Debian 12) Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/debian.mdx Adds the official Redis APT repository for installing Redis server on Debian 12. ```bash # Add Redis official APT repository (Debian 12 only) curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list ``` -------------------------------- ### Stop CtrlPanel Services Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/uninstall.mdx Before uninstalling, stop CtrlPanel and its services. Navigate to the installation directory first. ```bash cd /var/www/ctrlpanel sudo php artisan down sudo systemctl stop ctrlpanel ``` -------------------------------- ### Get server details Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/get-server-details.api.mdx Fetches the details of a specific server using its unique identifier. ```APIDOC ## GET /api/servers/{id} ### Description Fetches the details of a specific server using its unique identifier. ### Method GET ### Endpoint /api/servers/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the server. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the server. - **name** (string) - The name of the server. - **status** (string) - The current status of the server (e.g., 'online', 'offline'). - **ip_address** (string) - The IP address of the server. - **created_at** (string) - The timestamp when the server was created. - **updated_at** (string) - The timestamp when the server was last updated. ``` -------------------------------- ### Enable Maintenance Mode Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/development/upgrade.mdx Enables maintenance mode for the CtrlPanel application before starting the update process. ```bash cd /var/www/ctrlpanel php artisan down ``` -------------------------------- ### Create Directory and Navigate Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/download-files.mdx Creates the directory for CtrlPanel and navigates into it. This is the first step before downloading files. ```bash mkdir -p /var/www/ctrlpanel && cd /var/www/ctrlpanel ``` -------------------------------- ### Enable Nginx Configuration and Restart Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-nginx-no-ssl.mdx Enable the Nginx configuration by creating a symbolic link and then test the configuration for errors before restarting the Nginx service. ```bash # You do not need to symlink this file if you are using CentOS. ln -s /etc/nginx/sites-available/ctrlpanel.conf /etc/nginx/sites-enabled/ctrlpanel.conf # Check for nginx errors nginx -t # You need to restart nginx regardless of OS. only do this you haven't received any errors systemctl restart nginx ``` -------------------------------- ### Create New CtrlPanel Database and Grant Permissions Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/_parts/backup/existing-db.mdx Create a new database named 'ctrlpanel' and grant all privileges to the 'ctrlpaneluser' for local access. This is a necessary step before restoring a backup. ```bash # If you use MySQL server mysql -u root -p # if you use MariaDB server mariadb -u root -p CREATE DATABASE ctrlpanel; GRANT ALL PRIVILEGES ON ctrlpanel.* TO 'ctrlpaneluser'@'127.0.0.1'; FLUSH PRIVILEGES; exit ``` -------------------------------- ### Create Database User and Grant Privileges (MySQL/MariaDB) Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/database-setup.mdx Use these SQL commands to create a new user, a database, and grant all necessary privileges to that user for the database. Remember to replace 'USE_YOUR_OWN_PASSWORD' with a strong password. ```sql # Enter to MySQL shell mysql -u root -p # or if you use MariaDB do mariadb -u root -p # Enter the following SQL commands CREATE USER 'ctrlpaneluser'@'127.0.0.1' IDENTIFIED BY 'USE_YOUR_OWN_PASSWORD'; CREATE DATABASE ctrlpanel; GRANT ALL PRIVILEGES ON ctrlpanel.* TO 'ctrlpaneluser'@'127.0.0.1'; FLUSH PRIVILEGES; EXIT; ``` -------------------------------- ### Enable Apache Configuration and Modules Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-apache-ssl.mdx Enables the new site configuration, rewrites, and SSL module, then restarts Apache. This step is not required for RHEL-based systems. ```bash # You do not need to run any of these commands on RHEL, Rocky Linux, or AlmaLinux ln -s /etc/apache2/sites-available/ctrlpanel.conf /etc/apache2/sites-enabled/ctrlpanel.conf a2enmod rewrite a2enmod ssl systemctl restart apache2 ``` -------------------------------- ### Get voucher details Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/get-voucher-details.api.mdx Fetches the details of a specific voucher by its ID. This is a GET request to the /api/vouchers/{id} endpoint. ```APIDOC ## GET /api/vouchers/{id} ### Description Retrieves the details of a specific voucher using its unique identifier. ### Method GET ### Endpoint /api/vouchers/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the voucher. #### Query Parameters - **include_expired** (boolean) - Optional - Whether to include expired vouchers in the results. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the voucher. - **code** (string) - The voucher code. - **discount_type** (string) - The type of discount (e.g., "percentage", "fixed_amount"). - **discount_value** (number) - The value of the discount. - **expiration_date** (string) - The date when the voucher expires (ISO 8601 format). - **is_active** (boolean) - Indicates if the voucher is currently active. - **created_at** (string) - The date and time when the voucher was created (ISO 8601 format). - **updated_at** (string) - The date and time when the voucher was last updated (ISO 8601 format). #### Response Example ```json { "id": "voucher_123", "code": "SUMMER20", "discount_type": "percentage", "discount_value": 20, "expiration_date": "2024-12-31T23:59:59Z", "is_active": true, "created_at": "2023-01-01T10:00:00Z", "updated_at": "2023-01-01T10:00:00Z" } ``` ``` -------------------------------- ### Enable Ctrlpanel Site and Rewrite Module Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-apache-no-ssl.mdx Enables the Ctrlpanel site configuration and the Apache rewrite module. This step is not required for RHEL-based systems. ```bash # You do not need to run any of these commands on RHEL, Rocky Linux, or AlmaLinux ln -s /etc/apache2/sites-available/ctrlpanel.conf /etc/apache2/sites-enabled/ctrlpanel.conf a2enmod rewrite systemctl restart apache2 ``` -------------------------------- ### Create Storage Symlink Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/storage-symlink.mdx Run this Artisan command to create the symbolic link between storage/app/public and public/storage. This is required for serving uploaded files. ```bash php artisan storage:link ``` -------------------------------- ### Create Manual Database Backup Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/backup.mdx Use mysqldump or mariadb-dump to create a SQL backup file of your database. This command saves the backup to the specified path. ```bash # If you use MySQL server mysqldump -u root -p ctrlpanel > /var/www/ctrlpanel/backup.sql # If you use MariaDB server mariadb-dump -u root -p ctrlpanel > /var/www/ctrlpanel/backup.sql ``` -------------------------------- ### Open Nginx Configuration File Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-nginx-no-ssl.mdx Open the Nginx configuration file for Ctrlpanel using the nano editor. This file will contain the server block configuration. ```bash nano /etc/nginx/sites-available/ctrlpanel.conf ``` -------------------------------- ### Create Backup Directory Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/backup.mdx Prepare the directory where automated backups will be stored. This command ensures the target directory exists. ```bash # Create backup directory mkdir -p /var/www/ctrlpanel/backups ``` -------------------------------- ### Create User Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/create-user.api.mdx Creates a new user with the provided details. ```APIDOC ## POST /api/users ### Description Creates a new user with the provided details. ### Method POST ### Endpoint /api/users ### Parameters #### Request Body - **username** (string) - Required - The desired username for the new user. - **email** (string) - Required - The email address for the new user. - **password** (string) - Required - The password for the new user. ### Request Example { "username": "johndoe", "email": "john.doe@example.com", "password": "securepassword123" } ### Response #### Success Response (201) - **id** (string) - The unique identifier for the newly created user. - **username** (string) - The username of the created user. - **email** (string) - The email of the created user. #### Response Example { "id": "user-12345", "username": "johndoe", "email": "john.doe@example.com" } ``` -------------------------------- ### Remove CtrlPanel Files Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/uninstall.mdx Remove the entire CtrlPanel installation directory. ```bash sudo rm -rf /var/www/ctrlpanel ``` -------------------------------- ### Get Role Details Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/get-role-details.api.mdx Retrieves the details of a specific role by its ID. ```APIDOC ## GET /api/roles/{id} ### Description Retrieves the details of a specific role using its unique identifier. ### Method GET ### Endpoint /api/roles/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the role. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the role. - **name** (string) - The name of the role. - **description** (string) - A description of the role. - **permissions** (array) - A list of permissions associated with the role. ``` -------------------------------- ### Get notification details Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/get-notification-details.api.mdx Fetches the details of a specific notification for a user. ```APIDOC ## GET /api/notifications/{user_id}/{notification_id} ### Description Fetches the details of a specific notification for a user. ### Method GET ### Endpoint /api/notifications/{user_id}/{notification_id} ### Parameters #### Path Parameters - **user_id** (string) - Required - The ID of the user. - **notification_id** (string) - Required - The ID of the notification. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the notification. - **user_id** (string) - The ID of the user associated with the notification. - **title** (string) - The title of the notification. - **message** (string) - The main content of the notification. - **created_at** (string) - The timestamp when the notification was created. - **read_at** (string) - The timestamp when the notification was read by the user (null if not read). - **type** (string) - The type of the notification (e.g., 'info', 'warning', 'error'). - **metadata** (object) - Additional metadata associated with the notification. ``` -------------------------------- ### Get user details Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/get-user-details.api.mdx Retrieves the details of a specific user using their ID. ```APIDOC ## GET /api/users/{id} ### Description Retrieves the details of a specific user using their ID. ### Method GET ### Endpoint /api/users/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the user. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the user. - **username** (string) - The username of the user. - **email** (string) - The email address of the user. - **createdAt** (string) - The date and time when the user was created. - **updatedAt** (string) - The date and time when the user was last updated. ``` -------------------------------- ### Open Ctrlpanel Apache Configuration Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-apache-no-ssl.mdx Opens the Apache configuration file for Ctrlpanel in the nano editor. This file needs to be created or modified with your domain details. ```bash nano /etc/apache2/sites-available/ctrlpanel.conf ``` -------------------------------- ### Create a New Theme Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/themes.mdx Run this command in your terminal to generate the basic structure for a new theme. The script will prompt you for necessary details. ```bash php artisan make:theme ``` -------------------------------- ### Switch to Main Branch and Pull Latest Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/development/back-to-release.mdx Use these Git commands to switch to the main branch and pull the latest stable code. This is the first step when rolling back from a development version. ```bash git checkout main git pull ``` -------------------------------- ### Add PHP Repository Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/debian.mdx Adds the Sury PHP PPA to your system to access specific PHP versions and extensions. ```bash # Add additional repositories for PHP wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list ``` -------------------------------- ### Restore MySQL Database Backup Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/_parts/backup/fresh-db.mdx Use this command to restore a MySQL database from a backup file. Ensure the backup file is in the `/var/www/ctrlpanel/` directory and named `backup.sql`. ```bash mysql -u root -p ctrlpanel < /var/www/ctrlpanel/backup.sql ``` -------------------------------- ### Restore MariaDB Database Backup Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/_parts/backup/fresh-db.mdx Use this command to restore a MariaDB database from a backup file. Ensure the backup file is in the `/var/www/ctrlpanel/` directory and named `backup.sql`. ```bash mariadb -u root -p ctrlpanel < /var/www/ctrlpanel/backup.sql ``` -------------------------------- ### Apache Virtual Host Configuration with SSL Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-apache-ssl.mdx This configuration sets up both HTTP to HTTPS redirection and the main SSL-enabled virtual host for Ctrlpanel. Remember to replace YOUR.DOMAIN.HERE with your actual domain name. ```apache # Replace YOUR.DOMAIN.HERE with your domain. ServerName YOUR.DOMAIN.HERE RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] # Replace YOUR.DOMAIN.HERE with your domain. ServerName YOUR.DOMAIN.HERE DocumentRoot "/var/www/ctrlpanel/public" AllowEncodedSlashes On php_value upload_max_filesize 100M php_value post_max_size 100M Require all granted AllowOverride all SSLEngine on SSLCertificateFile /etc/letsencrypt/live/YOUR.DOMAIN.HERE/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/YOUR.DOMAIN.HERE/privkey.pem ``` -------------------------------- ### Create Product Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/create-product.api.mdx This endpoint allows for the creation of a new product. It requires specific details about the product to be submitted in the request body. ```APIDOC ## POST /api/products ### Description This endpoint allows for the creation of a new product. It requires specific details about the product to be submitted in the request body. ### Method POST ### Endpoint /api/products ### Parameters #### Request Body - **name** (string) - Required - The name of the product. - **description** (string) - Optional - A detailed description of the product. - **price** (number) - Required - The price of the product. - **sku** (string) - Required - The Stock Keeping Unit for the product. - **category_id** (string) - Required - The ID of the category the product belongs to. ### Request Example ```json { "name": "Example Product", "description": "This is an example product description.", "price": 19.99, "sku": "EXMPL-001", "category_id": "cat-123" } ``` ### Response #### Success Response (201) - **id** (string) - The unique identifier for the newly created product. - **name** (string) - The name of the product. - **description** (string) - The description of the product. - **price** (number) - The price of the product. - **sku** (string) - The SKU of the product. - **category_id** (string) - The category ID of the product. - **created_at** (string) - The timestamp when the product was created. #### Response Example ```json { "id": "prod-abcde12345", "name": "Example Product", "description": "This is an example product description.", "price": 19.99, "sku": "EXMPL-001", "category_id": "cat-123", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Create Server Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/create-server.api.mdx The POST /api/servers endpoint is used to create a new server. It accepts a JSON payload with server configuration details. ```APIDOC ## POST /api/servers ### Description Creates a new server with the provided configuration. ### Method POST ### Endpoint /api/servers ### Parameters #### Request Body - **name** (string) - Required - The name of the server. - **region** (string) - Required - The region where the server will be created. - **plan** (string) - Required - The plan for the server. - **os** (string) - Required - The operating system for the server. - **disk_size** (integer) - Optional - The size of the disk in GB. ### Request Example ```json { "name": "my-server", "region": "us-east-1", "plan": "basic", "os": "ubuntu-20.04", "disk_size": 50 } ``` ### Response #### Success Response (201) - **id** (string) - The unique identifier of the created server. - **name** (string) - The name of the created server. - **status** (string) - The current status of the server (e.g., "creating", "running"). #### Response Example ```json { "id": "srv-12345abcde", "name": "my-server", "status": "creating" } ``` ``` -------------------------------- ### Migrate Database for Older Backups Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/_parts/backup/existing-db.mdx If you have a backup from an older version of CtrlPanel, migrate the database to the latest version using the artisan migrate command. This should be run from the CtrlPanel directory. ```bash cd /var/www/ctrlpanel sudo php artisan migrate --seed --force ``` -------------------------------- ### Rendering a List of Documentation Cards Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/notifications.tag.mdx This snippet renders a list of documentation cards based on the items in the current sidebar category. It's commonly used for organizing and displaying related documentation. ```mdx ``` -------------------------------- ### Set Default File Permissions Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/ubuntu.mdx Sets ownership to 'www-data' and permissions for storage and cache directories. This is a standard configuration for web server access. ```bash chown -R www-data:www-data /var/www/ctrlpanel/ chmod -R 755 storage/* bootstrap/cache/ ``` -------------------------------- ### Drop CtrlPanel Database and User (MariaDB) Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/uninstall.mdx Connect to MariaDB, drop the CtrlPanel database and user, and flush privileges. ```sql mariadb -u root -p DROP DATABASE ctrlpanel; DROP USER 'ctrlpaneluser'@'127.0.0.1'; FLUSH PRIVILEGES; exit ``` -------------------------------- ### Drop CtrlPanel Database and User (MySQL) Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/uninstall.mdx Connect to MySQL, drop the CtrlPanel database and user, and flush privileges. ```sql mysql -u root -p DROP DATABASE ctrlpanel; DROP USER 'ctrlpaneluser'@'127.0.0.1'; FLUSH PRIVILEGES; exit ``` -------------------------------- ### List all servers Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/list-all-servers.api.mdx This operation retrieves a list of all servers. It does not require any parameters and returns a list of server objects. ```APIDOC ## GET /api/servers ### Description Retrieves a list of all available servers. ### Method GET ### Endpoint /api/servers ### Parameters #### Query Parameters - **limit** (integer) - Optional - The maximum number of servers to return. - **offset** (integer) - Optional - The number of servers to skip before starting to collect the result set. ### Response #### Success Response (200) - **servers** (array) - A list of server objects. - **id** (string) - The unique identifier for the server. - **name** (string) - The name of the server. - **status** (string) - The current status of the server (e.g., 'online', 'offline'). - **ip_address** (string) - The IP address of the server. #### Response Example { "servers": [ { "id": "srv-12345", "name": "web-server-01", "status": "online", "ip_address": "192.168.1.100" }, { "id": "srv-67890", "name": "db-server-01", "status": "offline", "ip_address": "192.168.1.101" } ] } ``` -------------------------------- ### Generate SSL Certificates Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-nginx-ssl.mdx Generates SSL certificates for your domain using Certbot. Replace YOUR.DOMAIN.HERE with your actual domain name. ```bash certbot certonly --nginx -d YOUR.DOMAIN.HERE ``` -------------------------------- ### Edit .env file Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/backup.mdx Access and modify the .env file using nano. This is necessary for backing up or restoring the application key. ```bash nano /var/www/ctrlpanel/.env ``` -------------------------------- ### List all users Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/list-all-users.api.mdx Retrieves a list of all users in the system. ```APIDOC ## GET /api/users ### Description Retrieves a list of all users in the system. ### Method GET ### Endpoint /api/users ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. - **limit** (integer) - Optional - The number of users to return per page. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **users** (array) - A list of user objects. - **id** (integer) - The unique identifier for the user. - **username** (string) - The username of the user. - **email** (string) - The email address of the user. - **created_at** (string) - The timestamp when the user was created. - **updated_at** (string) - The timestamp when the user was last updated. #### Response Example ```json { "example": "{\n \"users\": [\n {\n \"id\": 1,\n \"username\": \"john_doe\",\n \"email\": \"john.doe@example.com\",\n \"created_at\": \"2023-10-27T10:00:00Z\",\n \"updated_at\": \"2023-10-27T10:00:00Z\"\n },\n {\n \"id\": 2,\n \"username\": \"jane_doe\",\n \"email\": \"jane.doe@example.com\",\n \"created_at\": \"2023-10-27T10:05:00Z\",\n \"updated_at\": \"2023-10-27T10:05:00Z\"\n }\n ]\n}" } ``` ``` -------------------------------- ### Restore CtrlPanel Database Backup Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/_parts/backup/existing-db.mdx Restore the CtrlPanel database from a backup file using the mysql or mariadb client. Ensure the backup file path is correct. ```bash # If you use MySQL mysql -u root -p ctrlpanel < /var/www/ctrlpanel/backup.sql # If you use MariaDB mariadb -u root -p ctrlpanel < /var/www/ctrlpanel/backup.sql ``` -------------------------------- ### Automate Daily Database Backups with Cronjob Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/backup.mdx Schedule daily database backups using a cronjob. This command runs at midnight and saves a timestamped SQL backup file. ```bash # If you use MySQL server 0 0 * * * mysqldump -u ctrlpanelbackupuser --password= --single-transaction --quick --lock-tables=false ctrlpanel > /var/www/ctrlpanel/backups-$(date +\%F).sql # if you use MariaDB server 0 0 * * * mariadb-dump -u ctrlpanelbackupuser --password= --single-transaction --quick --lock-tables=false ctrlpanel > /var/www/ctrlpanel/backups-$(date +\%F).sql ``` -------------------------------- ### Update Database Schema and Seed Data Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/development/upgrade.mdx Runs database migrations and seeds to update the database schema and populate it with necessary data. Requires force flag for production environments. ```bash php artisan migrate --seed --force ``` -------------------------------- ### Create Database Backup User Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/backup.mdx Create a dedicated read-only user for database backups. This user requires LOCK TABLES and SELECT privileges on the panel database. ```bash # If you use MySQL server mysql -u root -p # If you use MariaDB server mariadb -u root -p ``` ```sql CREATE USER 'ctrlpanelbackupuser'@'127.0.0.1' IDENTIFIED BY 'USE_YOUR_OWN_PASSWORD'; GRANT LOCK TABLES, SELECT ON ctrlpanel.* TO 'ctrlpanelbackupuser'@'127.0.0.1'; FLUSH PRIVILEGES; exit ``` -------------------------------- ### Uninstall PHP Dependencies Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/uninstall.mdx Remove specific PHP extensions like intl and redis. Ensure you check your PHP version before running. ```bash sudo apt remove php8.3-{intl,redis} ``` -------------------------------- ### Pull New Files and Set Permissions Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/development/upgrade.mdx Stashes current changes, pulls the latest files from the development branch, and sets the correct file permissions for the application directory. ```bash git stash git pull chmod -R 755 /var/www/ctrlpanel ``` -------------------------------- ### Create Voucher Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/create-voucher.api.mdx Creates a new voucher using the provided details. This endpoint supports POST requests to the /api/vouchers path. ```APIDOC ## POST /api/vouchers ### Description Creates a new voucher. ### Method POST ### Endpoint /api/vouchers ### Parameters #### Request Body - **name** (string) - Required - The name of the voucher. - **code** (string) - Required - The unique code for the voucher. - **discount_type** (string) - Required - The type of discount (e.g., PERCENTAGE, FIXED_AMOUNT). - **discount_value** (number) - Required - The value of the discount. - **valid_from** (string) - Optional - The start date for voucher validity (ISO 8601 format). - **valid_until** (string) - Optional - The end date for voucher validity (ISO 8601 format). - **usage_limit** (number) - Optional - The maximum number of times the voucher can be used. - **is_active** (boolean) - Optional - Whether the voucher is currently active. ### Request Example { "name": "SUMMER20", "code": "SUMMER20OFF", "discount_type": "PERCENTAGE", "discount_value": 20, "valid_from": "2024-01-01T00:00:00Z", "valid_until": "2024-12-31T23:59:59Z", "usage_limit": 100, "is_active": true } ### Response #### Success Response (201) - **id** (string) - The unique identifier of the created voucher. - **name** (string) - The name of the voucher. - **code** (string) - The unique code for the voucher. - **discount_type** (string) - The type of discount. - **discount_value** (number) - The value of the discount. - **valid_from** (string) - The start date for voucher validity. - **valid_until** (string) - The end date for voucher validity. - **usage_limit** (number) - The maximum number of times the voucher can be used. - **current_usage** (number) - The current number of times the voucher has been used. - **is_active** (boolean) - Whether the voucher is currently active. - **created_at** (string) - The timestamp when the voucher was created. - **updated_at** (string) - The timestamp when the voucher was last updated. #### Response Example { "id": "voucher-12345", "name": "SUMMER20", "code": "SUMMER20OFF", "discount_type": "PERCENTAGE", "discount_value": 20, "valid_from": "2024-01-01T00:00:00Z", "valid_until": "2024-12-31T23:59:59Z", "usage_limit": 100, "current_usage": 0, "is_active": true, "created_at": "2024-07-26T10:00:00Z", "updated_at": "2024-07-26T10:00:00Z" } ``` -------------------------------- ### Switch to Development Branch Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/development/upgrade.mdx Changes the current Git branch to 'development' to prepare for pulling the latest code. ```bash git checkout development ``` -------------------------------- ### Clone Latest CtrlPanel Version Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/download-files.mdx Clones the latest version of the CtrlPanel repository into the current directory. ```bash git clone https://github.com/Ctrlpanel-gg/panel.git ./ ``` -------------------------------- ### Nginx Server Block Configuration Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-nginx-no-ssl.mdx Paste this server block configuration into your Nginx site file. Remember to replace 'YOUR.DOMAIN.HERE' with your actual domain name. ```nginx server { # Replace YOUR.DOMAIN.HERE with your domain. listen 80; server_name YOUR.DOMAIN.HERE; root /var/www/ctrlpanel/public; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/ctrlpanel.app-error.log error; # Allow larger upload sizes client_max_body_size 100m; client_body_timeout 120s; sendfile off; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+); fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTP_PROXY ""; fastcgi_intercept_errors off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; } location ~ /\.ht { deny all; } } ``` -------------------------------- ### Ctrlpanel Apache VirtualHost Configuration Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/webserver/deb-apache-no-ssl.mdx This is the VirtualHost configuration for Apache. Remember to replace 'YOUR.DOMAIN.HERE' with your actual domain name. ```apache # Replace YOUR.DOMAIN.HERE with your domain. ServerName YOUR.DOMAIN.HERE DocumentRoot "/var/www/ctrlpanel/public" AllowEncodedSlashes On php_value upload_max_filesize 100M php_value post_max_size 100M AllowOverride all Require all granted ``` -------------------------------- ### List all vouchers Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/list-all-vouchers.api.mdx Fetches a list of all vouchers. Supports filtering by status and pagination. ```APIDOC ## GET /api/vouchers ### Description Retrieves a list of all vouchers. This endpoint supports filtering by voucher status and pagination. ### Method GET ### Endpoint /api/vouchers ### Parameters #### Query Parameters - **status** (string) - Optional - Filters vouchers by their status (e.g., 'active', 'expired'). - **page** (integer) - Optional - Specifies the page number for pagination. Defaults to 1. - **limit** (integer) - Optional - Specifies the number of vouchers to return per page. Defaults to 20. ### Response #### Success Response (200) - **data** (array) - An array of voucher objects. - **id** (string) - The unique identifier for the voucher. - **code** (string) - The voucher code. - **discount_type** (string) - The type of discount (e.g., 'percentage', 'fixed'). - **discount_value** (number) - The value of the discount. - **expiry_date** (string) - The expiration date of the voucher in ISO format. - **status** (string) - The current status of the voucher (e.g., 'active', 'expired', 'used'). - **pagination** (object) - Pagination details. - **currentPage** (integer) - The current page number. - **totalPages** (integer) - The total number of pages available. - **totalItems** (integer) - The total number of items across all pages. #### Response Example ```json { "data": [ { "id": "voucher_123", "code": "SUMMER20", "discount_type": "percentage", "discount_value": 20, "expiry_date": "2024-12-31T23:59:59Z", "status": "active" } ], "pagination": { "currentPage": 1, "totalPages": 10, "totalItems": 200 } } ``` ``` -------------------------------- ### Set Advanced File Permissions Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/os/ubuntu.mdx Applies more granular permissions for increased security. Use this if you have specific security requirements and understand the implications. ```bash chown -R www-data:www-data /var/www/ctrlpanel/ find /var/www/ctrlpanel/ -type d -exec chmod 755 {} \; find /var/www/ctrlpanel/ -type f -exec chmod 644 {} \; ``` -------------------------------- ### Importing DocCardList and useCurrentSidebarCategory Source: https://github.com/ctrlpanel-gg/docs/blob/main/api-docs/notifications.tag.mdx These imports are necessary for rendering documentation cards and utilizing sidebar category information within MDX files. ```mdx import DocCardList from '@theme/DocCardList'; import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; ``` -------------------------------- ### Set File Ownership for Web Server Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/development/upgrade.mdx Sets the ownership of the CtrlPanel directory to the appropriate user and group for the web server (e.g., www-data, nginx, apache). ```bash # If using NGINX or Apache (not on CentOS): chown -R www-data:www-data /var/www/ctrlpanel/ # If using NGINX on CentOS: chown -R nginx:nginx /var/www/ctrlpanel/ # If using Apache on CentOS chown -R apache:apache /var/www/ctrlpanel/ ``` -------------------------------- ### Remove Apache Configuration Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/guides/uninstall.mdx Disable the CtrlPanel Apache site configuration and remove its configuration file, then reload Apache. ```bash sudo a2dissite ctrlpanel.conf sudo rm /etc/apache2/sites-available/ctrlpanel.conf sudo systemctl reload apache2 ``` -------------------------------- ### Open Crontab for Editing Source: https://github.com/ctrlpanel-gg/docs/blob/main/versioned_docs/version-1.2.x/getting-started/_parts/install/steps/queue-listeners.mdx Opens the crontab file for editing to schedule tasks. Choose your preferred file editor if prompted. ```bash crontab -e ```