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
sudoprivileges 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 volumenginx_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:
-
The installer script is downloaded from
https://installer.cloudpanel.io/ce/v2/install.shto/root/cloudpanel-install.sh. -
The script is modified to enforce the use of
MYSQL_8.0as the database engine. -
The script is modified to allow package downgrades during the upgrade process using the
--allow-downgradesflag. -
The installation is executed by running
/root/cloudpanel-install.sh. -
Upon successful completion, the directory
/etc/cloudpanelis 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_secretsmounted to/etc/letsencrypt -
/data/nginx/user_conf.dmounted to/etc/nginx/user_conf.d -
Environment:
-
CERTBOT_EMAILis set to[email protected] -
Additional environment variables are loaded from
/data/nginx/nginx-certbot.env
The container is started using the command:
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-certbotimage. -
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
nginxsystem service is started and enabled to run on boot usingsystemctl. -
Command to ensure it is running:
-
Docker Compose Services:
-
To start the Nginx/Certbot container stack:
-
To stop the stack:
-
Database Service:
-
The MySQL service is managed by the CloudPanel installation and runs as a system service.