Skip to content

joonfi/L2r

Drupal Local Full-Stack (One‑Shot)

This bundle is generated by a single script: setup-drupal-local.sh. It creates a complete local/dev Drupal 10 platform using Docker Compose.

Local/dev focus: HTTP only (no Let’s Encrypt). Admin UIs are bound to 127.0.0.1.


What you get (capabilities)

Core application path

  • Traefik (HTTP reverse proxy) → routes hostnames to Nginx.
  • Nginx → serves Drupal files and forwards PHP requests to Drupal 10 FPM.
  • Drupal 10 (FPM) → auto-installed via Drush.

Data & caching

  • ProxySQL in front of MariaDB (safe default routes to primary).
  • MariaDB primary + replica with GTID replication bootstrapped automatically.
  • Redis with AUTH and mandatory Drupal integration:
    • PhpRedis extension is installed in the Drupal image.
    • Drupal Redis module is installed via Composer.
    • Drupal is configured to use Redis as the default cache backend.
    • The installer verifies Redis connectivity with AUTH + PING.

Observability

  • Prometheus scrapes:
    • node_exporter (host metrics)
    • cAdvisor (container metrics)
  • Grafana for dashboards.
  • Loki for logs.

Backups

  • Daily logical backups (compressed SQL dumps) from the MariaDB primary.
  • Rotation keeps the last 7 dumps.

Developer ergonomics

  • Generated Makefile with:
    • make open
    • make health
    • make tail SERVICE=...
    • lifecycle targets (up, down, restart, scale, etc.)

System prerequisites (Fedora 42)

Required

  • Docker Engine
  • Docker Compose v2 plugin (docker compose ...)
  • OpenSSL

Recommended

  • GNU Make (make)

Practical sizing

  • RAM: 8 GB recommended (6 GB minimum)
  • CPU: 4 cores recommended
  • Disk: 20–30 GB free

Quick start

  1. Make the script executable:
chmod +x setup-drupal-local.sh
  1. Recommended run (silent port check + hosts entry):
./setup-drupal-local.sh --check-ports --add-hosts drupal.local
  1. Watch the installer:
cd drupal-platform
make installer-logs
  1. Validate and open:
make health
make open

Script options

--check-ports (silent on success)

Checks that required ports are free before deploying. Prints nothing if all ports are available.

--add-hosts

Adds an /etc/hosts entry if missing:

127.0.0.1 <domain>

--ports SPEC

Override host ports. Supported formats:

  1. CSV order: web,traefik,grafana,prometheus,loki
./setup-drupal-local.sh --ports 8081,8082,3300,9091,3101 drupal.local
  1. key=val pairs:
./setup-drupal-local.sh --ports web=8081,traefik=8082,grafana=3300,prometheus=9091,loki=3101 drupal.local

Default endpoints

Defaults (no port overrides):

  • Drupal: http://localhost (or http://drupal.local)
  • Traefik dashboard: http://127.0.0.1:8080
  • Grafana: http://127.0.0.1:3000
  • Prometheus: http://127.0.0.1:9090
  • Loki: http://127.0.0.1:3100

Drupal auto-install details

Drupal is installed using Drush site:install with:

  • --db-url, --site-name, --account-name, --account-pass, etc.

Admin credentials (current defaults)

  • Username: drupallocaladmin
  • Password: drupallocaladminpass
  • Site name: drupal.local

Redis integration (mandatory)

Deployment fails if Redis integration cannot be enforced:

  1. PhpRedis extension must be available.
  2. drupal/redis must install successfully (Composer retry/backoff).
  3. Redis module must enable successfully (Drush).
  4. Drupal settings must include Redis cache backend configuration.
  5. AUTH + PING check must pass.

Generated Makefile (common commands)

From inside drupal-platform/:

make help
make up
make health
make open
make tail SERVICE=drupal
make drush CMD="status"
make scale DRUPAL_SCALE=3
make nuke

Why keep our original one‑shot stack (what it’s best at)

This project intentionally goes beyond “just a Drupal dev environment”. It is designed as a local, production‑style platform simulator that you can spin up repeatedly with one command.

Best-in-class strengths of our stack:

  1. End-to-end platform realism (single-host)

    • Explicit routing path: Traefik → Nginx → Drupal (PHP-FPM).
    • Explicit data path: Drupal → ProxySQL → MariaDB primary/replica.
  2. ProxySQL + replication are first-class (not bolt-ons)

    • ProxySQL is included by default.
    • MariaDB primary + replica and an automatic replication bootstrap are included.
  3. Redis is mandatory and validated

    • Enforced Drupal → Redis caching, not just “Redis is running”.
  4. Monitoring is included and wired

    • Prometheus + Grafana + Loki + node_exporter + cAdvisor are included by default.
  5. One-shot automation + dev ergonomics

    • Auto-install via Drush.
    • Composer retry/backoff + persistent Composer cache.
    • Options: --check-ports, --add-hosts, --ports.
    • Makefile helpers.

In short: keep this stack when you want a repeatable platform lab that is close to “real infra” and not just an app sandbox.


Where Docker4Drupal (Wodby) is best

Docker4Drupal is a mature, Compose-first Drupal stack with a large menu of Drupal services. Choose it if you want a well-known Drupal-specific stack maintained as a project and you prefer editing Compose/.env directly.


Where DDEV is best

DDEV is the Drupal community’s recommended local dev workflow and is optimized for fast onboarding. Choose it when you want minimal friction for a mixed team and prefer CLI-driven workflows.


Recommended usage pattern (best of both worlds)

  • Default team dev: DDEV
  • Platform lab / performance / infra validation: this one-shot stack
  • Compose-native Drupal stack preference: Docker4Drupal

Super Prompt (drupal-one-shot-prompt)

This repository includes a super prompt file named drupal-one-shot-prompt, placed next to setup-drupal-local.sh. Use it with your preferred LLM to regenerate the entire project structure and one‑shot stack from scratch. It describes required files, Compose topology, installer behavior, flags, and acceptance criteria.

Where: L2r/drupal-one-shot-prompt or at the root of the repo

Tip: Paste the super prompt into an AI assistant and ask it to generate the full repo on a clean machine; then run:

chmod +x setup-drupal-local.sh
./setup-drupal-local.sh --check-ports --add-hosts drupal.local

Releases

No releases published

Packages

 
 
 

Contributors

Languages