Deployment Overview of Drupal on Server¶
Prerequisites and Basic Requirements¶
To successfully deploy the Drupal application, the following system requirements must be met:
-
Operating System: Ubuntu Linux distribution.
-
Privileges: Root access or
sudoprivileges are required for Docker management and system configuration. -
Docker Engine: The Docker runtime must be installed and operational on the host.
-
Network Configuration: The server must allow traffic on specific external and internal ports.
-
Domain Configuration: The server operates within the
hostkey.inzone.
Application Access Point¶
The final panel and application are accessible via the following Fully Qualified Domain Name (FQDN) format on the hostkey.in domain:
-
FQDN Pattern:
drupal<Server ID>.hostkey.in -
Port:
443(HTTPS)
Replace <Server ID> with the specific identifier assigned to your instance.
Application Installation Process¶
The application is deployed using Docker containers. The installation involves initializing a Docker network and launching two primary services: a database container and the Drupal web application container.
Deployment Steps¶
-
Docker Installation: Ensure Docker is installed on the Ubuntu host.
-
Network Creation: A dedicated Docker bridge network named
drupal-netis created to facilitate communication between containers. -
Database Initialization: The MariaDB container is started with the following parameters:
-
Container Name:
drupal_db -
Image:
mariadb:latest -
Restart Policy:
always
-
-
Drupal Initialization: The Drupal container is started with the following parameters:
-
Container Name:
drupal -
Image:
drupal:latest -
Restart Policy:
always -
Port Mapping: Host port
8080maps to container port80.
-
Databases¶
The application uses a MariaDB database for data storage, running within an isolated Docker container.
-
Database Type: MariaDB
-
Connection Method: Internal Docker network communication.
-
Container Name:
drupal_db -
Database Name:
drupal -
User:
root -
Port:
3306(internal) -
Storage Location: Data is stored in the container's internal volume managed by the Docker engine.
The Drupal container connects to the database using the hostname drupal_db within the drupal-net network.
Docker Containers and Their Deployment¶
The deployment utilizes two distinct containers orchestrated via Docker commands.
Container Specifications¶
| Parameter | Drupal Container | MariaDB Container |
|---|---|---|
| Name | drupal | drupal_db |
| Image | drupal:latest | mariadb:latest |
| Network | drupal-net | drupal-net |
| Restart Policy | always | always |
| Host Port | 8080 | None exposed directly |
Environment Variables¶
The Drupal container is configured with the following environment variables to establish the database connection:
-
DRUPAL_DB_HOST:drupal_db -
DRUPAL_DB_NAME:drupal -
DRUPAL_DB_USER:root -
DRUPAL_DB_PASSWORD: Configured via system password integration. -
DRUPAL_DB_PORT:3306
Proxy Servers¶
Traffic is managed by a proxy server responsible for SSL termination and routing. This is implemented using a Docker Compose stack located at /root/nginx.
Proxy Configuration¶
-
Image:
jonasal/nginx-certbot:latest -
Restart Policy:
unless-stopped -
Network Mode:
host -
Email for Certbot:
[email protected] -
Configuration Volume: User configurations are mounted at
/data/nginx/user_conf.dinside the container (/etc/nginx/user_conf.d). -
SSL Secrets Volume: External volume
nginx_secretsis mounted to/etc/letsencryptfor Let's Encrypt certificate storage. -
Env File: Configuration loads from
/data/nginx/nginx-certbot.env.
The proxy handles the external port 443 (HTTPS) and forwards traffic to the internal Drupal service.
File and Directory Structure¶
The deployment creates specific directories on the host filesystem to manage configurations and data:
-
Root Nginx Directory:
/root/nginx-
Purpose: Stores the Docker Compose definition for the proxy service.
-
Permissions: Owner
root, Grouproot, Mode0755.
-
-
Compose File:
/root/nginx/compose.yml-
Purpose: Defines the Nginx-Certbot service and volumes.
-
Permissions: Owner
root, Grouproot, Mode0644.
-
-
User Configuration Directory:
/data/nginx/user_conf.d- Purpose: Stores custom Nginx configuration files for the application domain.
Available Ports for Connection¶
The following ports are utilized in the deployment architecture:
-
External Port:
443(HTTPS) - Used for secure access via the FQDN. -
Internal Port:
8080(HTTP) - Exposed by the Drupal container on the host for internal proxy communication. -
Database Port:
3306(MySQL/MariaDB) - Used internally within the Docker network for communication between the Drupal and Database containers.
Starting, Stopping, and Updating¶
Service management is performed using Docker commands.
-
Start Proxy Service: Execute the following command from the
/root/nginxdirectory: -
Container Management: Individual containers (
drupalanddrupal_db) can be managed using standard Docker CLI commands:-
To stop a container:
docker stop <container_name> -
To start a container:
docker start <container_name> -
To restart a container:
docker restart <container_name> -
To update the image: Pull the new image and recreate the container.
-
All containers are configured with the restart_policy: always (or unless-stopped for the proxy), ensuring they automatically restart upon system reboot or service failure.