Skip to content

Deployment Overview of CloudPanel on Server

Prerequisites and Basic Requirements

The server must meet the following criteria before initiating the deployment:

  • Operating System: Ubuntu (Debian-based)

  • Privileges: Root access or sudo privileges are required

  • Domain: A valid domain name pointing to the server IP address

  • Ports: The following ports must be available and not occupied by other services:

  • Port 80 (HTTP)

  • Port 443 (HTTPS)

  • Port 3306 (MySQL)

The installation process automatically stops and disables conflicting services such as mysql, mariadb, nginx, and apache2 to ensure these ports are free.

File and Directory Structure

The deployment establishes the following directory structure and file locations:

  • CloudPanel Configuration: /etc/cloudpanel

  • Nginx User Configuration: /data/nginx/user_conf.d/

  • Nginx Secrets Volume: /etc/letsencrypt (mounted from Docker volume nginx_secrets)

  • Docker Compose File: /root/nginx/compose.yml

  • Nginx Environment File: /data/nginx/nginx-certbot.env

  • Installer Script: /root/cloudpanel-install.sh

Application Installation Process

The CloudPanel application is installed using a dedicated installer script. The process involves the following steps:

  1. The installer script is downloaded from https://installer.cloudpanel.io/ce/v2/install.sh to /root/cloudpanel-install.sh.

  2. The script is modified to enforce the use of MYSQL_8.0 as the database engine.

  3. The script is modified to allow package downgrades during the upgrade process using the --allow-downgrades flag.

  4. The installation is executed by running /root/cloudpanel-install.sh.

  5. Upon successful completion, the directory /etc/cloudpanel is created, indicating the installation is complete.

Docker Containers and Their Deployment

A Docker container is deployed to handle Nginx and SSL certificate management using Certbot. The deployment utilizes docker compose with the following configuration:

  • Compose File Location: /root/nginx/compose.yml

  • Service Name: nginx

  • Image: jonasal/nginx-certbot:latest

  • Restart Policy: unless-stopped

  • Network Mode: host

  • Volumes:

  • nginx_secrets mounted to /etc/letsencrypt

  • /data/nginx/user_conf.d mounted to /etc/nginx/user_conf.d

  • Environment:

  • CERTBOT_EMAIL is set to [email protected]

  • Additional environment variables are loaded from /data/nginx/nginx-certbot.env

The container is started using the command:

docker compose up -d
This command is executed from the /root/nginx directory.

Proxy Servers

The Nginx container acts as a reverse proxy and handles SSL certificate generation via Certbot.

  • SSL Management: Automated via the jonasal/nginx-certbot image.

  • Configuration Location: Custom Nginx configurations are stored in /data/nginx/user_conf.d/.

  • Location Block Modification: The default location block for the application is configured to handle requests at the root path (location /) instead of a specific sub-path. This is achieved by modifying the configuration file located at /data/nginx/user_conf.d/{{ prefix }}{{ server_id }}.hostkey.in.conf.

Starting, Stopping, and Updating

Service management for the core components is handled as follows:

  • Nginx Service:

  • The nginx system service is started and enabled to run on boot using systemctl.

  • Command to ensure it is running:

    systemctl start nginx
    systemctl enable nginx
    

  • Docker Compose Services:

  • To start the Nginx/Certbot container stack:

    cd /root/nginx
    docker compose up -d
    

  • To stop the stack:

    cd /root/nginx
    docker compose down
    

  • Database Service:

  • The MySQL service is managed by the CloudPanel installation and runs as a system service.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×