Overview

This article explains the steps to build Drupal 10 in a Docker environment and install the WDB module for linguistic databases.

Prerequisites

  • Docker Desktop is installed
  • Git is installed

Steps

1. Building the Docker Environment

First, create a docker-compose.yml file:

services:
  mariadb:
    image: mariadb:latest
    restart: always
    volumes:
      - mariadb:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: drupal
      MYSQL_DATABASE: drupal
      MYSQL_USER: drupal
      MYSQL_PASSWORD: drupal

  drupal:
    image: drupal:10.2.7-php8.2-apache-bullseye
    volumes:
      - ./drupal/files:/opt/drupal/web/sites/default/files
      - ./drupal/modules:/opt/drupal/web/modules
      - ./drupal/themes:/opt/drupal/web/themes
      - ./drupal/private:/opt/drupal/private
    depends_on:
      - mariadb
    ports:
      - 8080:80
    restart: always

volumes:
  mariadb: {}

Next, create the necessary directories and start the containers:

mkdir -p drupal/files drupal/modules/custom drupal/themes drupal/private
docker compose up -d

2. Initial Drupal Configuration

Access http://localhost:8080 in your browser and proceed through the installation wizard.

Database connection settings:

  • Database type: MySQL/MariaDB
  • Database name: drupal
  • Database username: drupal
  • Database password: drupal
  • Host: mariadb
  • Port: 3306 (default)

3. Installing WDB Module Dependencies

The WDB module has the following dependencies:

  • jQuery UI
  • jQuery UI Dialog
  • Views (Drupal core module)

Install the jQuery UI modules using Composer:

docker exec docker-drupal-drupal-1 composer require 'drupal/jquery_ui:^1.6' 'drupal/jquery_ui_dialog:^2.0'

4. Downloading the WDB Module

Clone the WDB module from GitHub:

cd drupal/modules/custom
git clone https://github.com/wakitosh/wdb_module.git

5. Configuring the Private File System

The WDB module uses the private file system for its linguistic data import functionality.

Add the setting to settings.php:

docker exec docker-drupal-drupal-1 bash -c "echo \"\\\$settings['file_private_path'] = '../private';\" >> /opt/drupal/web/sites/default/settings.php"

Set directory permissions:

docker exec docker-drupal-drupal-1 bash -c "chmod 755 /opt/drupal/private && chown www-data:www-data /opt/drupal/private"

6. Enabling the Modules

  1. Access the admin page (http://localhost:8080/admin/modules)
  2. Enable the following modules:
    • jQuery UI
    • Views (within core modules)
    • WDB Core Functionality

Directory Structure

Final directory structure:

docker-drupal/
├── docker-compose.yml
└── drupal/
    ├── files/
    ├── modules/
    │   └── custom/
    │       └── wdb_module/
    ├── themes/
    └── private/

Troubleshooting

Port Conflict Error

If an existing container is using port 8080:

docker ps -a | grep 8080
docker stop [container-name]
docker rm [container-name]

Private File System Not Recognized

Check the settings in the admin panel: Configuration > Media > File system (/admin/config/media/file-system)

Summary

With these steps, you can set up Drupal 10 and the WDB module in a Docker environment. The WDB module provides database functionality for linguistic research, including features such as text annotation, vocabulary management, and an IIIF-compatible image viewer.