Deployment Overview of BrainyCP on Server¶
Prerequisites and Basic Requirements¶
Before deploying the application, ensure the server meets the following requirements:
-
Operating System: A Linux distribution compatible with Docker.
-
Privileges: Root access or a user with
sudoprivileges is required to manage Docker and system directories. -
Domain Zone: The deployment is configured for the
hostkey.indomain zone. -
Required Ports:
-
Port
8000: Internal communication for the BrainyCP application. -
Port
443: External secure (HTTPS) access for the web interface.
FQDN of the Final Panel¶
The fully qualified domain name (FQDN) for accessing the panel follows the specific naming convention defined by the configuration:
-
Format:
brainycp<Server ID>.hostkey.in:443 -
The
<Server ID>placeholder represents the unique identifier for the specific server instance. -
Traffic is routed via Nginx over HTTPS.
File and Directory Structure¶
The application and its supporting components utilize the following directory structure:
-
Application Installation:
/usr/local/brainycp -
Installer Script Location:
/root/install.sh -
Nginx Configuration Directory:
/root/nginx -
Nginx User Configuration:
/data/nginx/user_conf.d -
Let's Encrypt Secrets (Docker Volume): Mapped to
/etc/letsencryptinside the container.
Application Installation Process¶
The BrainyCP application is installed using a dedicated installer script provided by the developer:
-
The installer script is downloaded from
http://core.brainycp.com/install.sh. -
The script is saved to the location
/root/install.sh. -
Execution of the installer places the application binaries and initial configuration files into the
/usr/local/brainycpdirectory. -
The application is configured to listen on the internal port
8000.
Docker Containers and Their Deployment¶
A reverse proxy and SSL management solution is deployed using Docker Compose. The deployment consists of the following services:
-
Image:
jonasal/nginx-certbot:latest -
Restart Policy:
unless-stopped -
Network Mode:
host -
Environment Variables:
-
CERTBOT_EMAIL: Set to[email protected] -
Volumes:
-
nginx_secrets: An external volume mapping to/etc/letsencryptfor storing SSL certificates. -
Host path
/data/nginx/user_conf.dmounted to/etc/nginx/user_conf.dwithin the container.
The deployment configuration is defined in a docker-compose file located at /root/nginx/compose.yml.
Proxy Servers¶
The application is fronted by an Nginx proxy managed through Docker to handle SSL termination and routing:
-
Proxy Engine: Nginx running inside a Docker container.
-
SSL Management: Automated via the
nginx-certbotimage to handle Let's Encrypt certificates. -
Routing Configuration:
-
The proxy listens on external port
443. -
Traffic is forwarded to the application running locally on
127.0.0.1:8002(Note: The configuration script updates the proxy pass to this port, distinct from the internal application port8000mentioned in the base configuration, indicating a specific proxy-to-app mapping). -
Custom Domains: Configuration files for custom domains are stored in
/data/nginx/user_conf.dwith the naming patternbrainycp<Server ID>.hostkey.in.conf.
Permission Settings¶
The following permission settings are applied to critical directories and files:
| Path | Owner | Group | Mode | Description |
|---|---|---|---|---|
/root/nginx | root | root | 0755 | Directory for Nginx Docker Compose configuration. |
/root/nginx/compose.yml | root | root | 0644 | Docker Compose definition file. |
/usr/local/brainycp | root | root | Default | Application installation directory. |
Location of Configuration Files and Data¶
Key configuration files and data locations are as follows:
-
Docker Compose Definition:
/root/nginx/compose.yml -
Nginx Environment Variables:
/data/nginx/nginx-certbot.env -
Nginx Site Configuration:
/data/nginx/user_conf.d/brainycp<Server ID>.hostkey.in.conf -
Application Data: Stored within the application directory
/usr/local/brainycp.
Available Ports for Connection¶
The following ports are configured for the deployment:
-
Port 443: External access via HTTPS (Nginx Proxy).
-
Port 8000: Internal port used by the BrainyCP application.
-
Port 8002: Internal port used by the Nginx proxy to forward requests to the application backend (as configured in the proxy script).
Starting, Stopping, and Updating¶
The proxy service is managed using Docker Compose commands executed from the /root/nginx directory:
-
Start or Restart Services:
-
Stop Services:
-
Update Services: To update the proxy image or configuration, pull the latest image and restart the containers:
To update the BrainyCP application itself, the installer script at /root/install.sh should be executed again with appropriate flags provided by the vendor, or the application binaries in /usr/local/brainycp should be replaced manually.