Skip to main content

Overview

This template provides a production‑ready Drupal instance as a Monk runnable. You can:
  • Run it directly to get a managed Drupal CMS with database
  • Inherit it in your own runnable to seamlessly add a powerful content management system to your stack
Drupal is one of the most powerful and flexible open-source content management systems. It powers millions of websites from small blogs to enterprise platforms, government sites, and e-commerce stores.

What this template manages

  • Drupal 9/10 container (PHP-FPM with Apache)
  • MySQL database container
  • Network services on ports 80/443
  • Persistent volumes for Drupal files, modules, themes, and database
  • Optional initialization of database credentials

Quick start (run directly)

  1. Load templates
monk load MANIFEST
  1. Run Drupal with database
monk run drupal/drupal
  1. Customize credentials (recommended via inheritance)
Running directly uses the defaults defined in this template’s variables. Secrets added with monk secrets add will not affect this runnable unless you inherit it and reference those secrets.
  • Preferred: inherit and replace variables with secret("...") as shown below.
  • Alternative: fork/clone and edit the variables in the manifest, then monk load MANIFEST and run.
Once started, access Drupal at http://localhost and complete the installation wizard.

Configuration

Key variables you can customize in this template:
variables:
  # Drupal
  drupal-image-tag: "latest"          # Drupal image tag (9, 10, latest)
  drupal-port: "80"                   # HTTP port
  drupal-https-port: "443"            # HTTPS port
  
  # Database
  mysql-password: "..."               # MySQL root password (env: MYSQL_ROOT_PASSWORD)
  mysql-database: "drupal"            # Database name to create (env: MYSQL_DATABASE)
  mysql-user: "drupal"                # Database user (env: MYSQL_USER)
  mysql-user-password: "..."          # Database user password (env: MYSQL_PASSWORD)
Data is persisted under ${monk-volume-path}/drupal and ${monk-volume-path}/mysql on the host. Inherit the Drupal runnable in your application and declare connections. Example:
namespace: myproject
cms:
  defines: runnable
  inherits: drupal/drupal
  variables:
    mysql-password:
      value: <- secret("mysql-root-password")
    mysql-user-password:
      value: <- secret("drupal-db-password")
    mysql-database:
      value: <- secret("drupal-database")
    mysql-user:
      value: <- secret("drupal-user")
api:
  defines: runnable
  containers:
    api:
      image: myorg/api
  connections:
    drupal:
      runnable: cms
      service: drupal
  variables:
    drupal-host:
      value: <- connection-hostname("drupal")
Then set the secrets once and run your app group:
monk secrets add -g mysql-root-password="STRONG_ROOT_PASSWORD"
monk secrets add -g drupal-db-password="STRONG_USER_PASSWORD"
monk secrets add -g drupal-database="drupal"
monk secrets add -g drupal-user="drupal"
monk run myproject/cms

Ports and connectivity

  • HTTP service: drupal on TCP port 80
  • HTTPS service: TCP port 443 (if configured with SSL)
  • Admin interface: http://\<host>/admin (after installation)
  • From other runnables in the same process group, use connection-hostname("\<connection-name>") to resolve the Drupal host.

Persistence and configuration

  • Drupal files: ${monk-volume-path}/drupal/sites:/var/www/html/sites
  • Modules: ${monk-volume-path}/drupal/modules:/var/www/html/modules
  • Themes: ${monk-volume-path}/drupal/themes:/var/www/html/themes
  • Database data: ${monk-volume-path}/mysql:/var/lib/mysql
  • You can add custom modules and themes by placing them in the respective volume paths.

Features

  • Powerful Content Management: Rich content editing with flexible content types
  • Extensible: 40,000+ modules and themes
  • Multilingual: Built-in translation system
  • Access Control: Robust user roles and permissions
  • API-First: RESTful web services, JSON:API, GraphQL
  • Scalable: From small sites to enterprise platforms
  • Security: Regular security updates, proven track record
  • SEO-Friendly: Built-in SEO features and best practices

Initial Setup

After launching:
  1. Navigate to http://localhost
  2. Select installation language
  3. Choose installation profile (Standard, Minimal, or Demo)
  4. Enter database credentials:
    • Database: drupal
    • Username: drupal
    • Password: \<your-mysql-user-password>
    • Host: mysql (or database service name)
  5. Configure site (name, email, admin account)
  6. Complete installation
Extend Drupal with modules:
  • Views: Create custom content lists and pages
  • Panels: Advanced page layouts
  • Webform: Build complex forms
  • Pathauto: Automatic URL aliases
  • Token: Dynamic content tokens
  • IMCE: File browser and uploader
  • Admin Toolbar: Enhanced admin menu

Content Types

Drupal’s content types allow you to:
  • Define custom fields (text, images, references, etc.)
  • Create structured content (articles, products, events)
  • Build complex relationships between content
  • Implement custom workflows

Use cases

Drupal excels at:
  • Corporate and government websites
  • E-commerce platforms (with Drupal Commerce)
  • Media and publishing sites
  • Community and social platforms
  • Educational portals
  • Multi-site platforms
  • Headless/API-driven applications
  • Combine with databases (PostgreSQL, MySQL) for content storage
  • Use with CDN for static asset delivery
  • Integrate with object storage (S3, Minio) for media files

Troubleshooting

  • If you changed mysql-password or mysql-user-password but the containers have existing data, authentication may fail. Either reset the data volumes or update the passwords inside the database to match.
  • Ensure the host volumes are writable by the container user.
  • For installation issues, verify database connection settings match the environment variables.
  • For file permission errors, check volume permissions on the host.
  • Check container logs:
monk logs -l 500 -f drupal/drupal
  • Access admin interface at http://localhost/admin (after installation)
  • Check Drupal logs: Reports → Recent log messages
  • Run Drupal console commands (requires Drush):
# Clear cache
drush cache:rebuild

# Update database
drush updatedb

# Export configuration
drush config:export
  • For performance issues, enable caching and CSS/JS aggregation in Drupal settings
  • Use Drush for CLI management and maintenance tasks