Skip to content

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 sudo privileges 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.in zone.

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

  1. Docker Installation: Ensure Docker is installed on the Ubuntu host.

  2. Network Creation: A dedicated Docker bridge network named drupal-net is created to facilitate communication between containers.

  3. Database Initialization: The MariaDB container is started with the following parameters:

    • Container Name: drupal_db

    • Image: mariadb:latest

    • Restart Policy: always

  4. Drupal Initialization: The Drupal container is started with the following parameters:

    • Container Name: drupal

    • Image: drupal:latest

    • Restart Policy: always

    • Port Mapping: Host port 8080 maps to container port 80.

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.d inside the container (/etc/nginx/user_conf.d).

  • SSL Secrets Volume: External volume nginx_secrets is mounted to /etc/letsencrypt for 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, Group root, Mode 0755.

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

    • Purpose: Defines the Nginx-Certbot service and volumes.

    • Permissions: Owner root, Group root, Mode 0644.

  • 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/nginx directory:

    docker compose up -d
    

  • Container Management: Individual containers (drupal and drupal_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.

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