Skip to content

[WIP] #444 Add wunderio/ddev-drupal #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ddev/addon-metadata/adminer/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: adminer
repository: ddev/ddev-adminer
version: v1.1.0
install_date: "2025-03-12T09:43:10+02:00"
version: v1.1.4
install_date: "2025-05-04T08:53:02+03:00"
project_files:
- docker-compose.adminer.yaml
- docker-compose.adminer_norouter.yaml
Expand Down
5 changes: 3 additions & 2 deletions .ddev/addon-metadata/varnish/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: varnish
repository: ddev/ddev-varnish
version: v0.2.3
install_date: "2024-08-13T15:59:06+03:00"
version: v0.2.6
install_date: "2025-05-04T09:14:13+03:00"
project_files:
- docker-compose.varnish.yaml
- varnish
Expand All @@ -10,6 +10,7 @@ global_files: []
removal_actions:
- |
#ddev-nodisplay
#ddev-description:Remove docker-compose.varnish_extras.yaml file
if [ -f docker-compose.varnish_extras.yaml ]; then
if grep -q '#ddev-generated' docker-compose.varnish_extras.yaml; then
rm -f docker-compose.varnish_extras.yaml
Expand Down
8 changes: 8 additions & 0 deletions .ddev/commands/host/wunderio-core-syncdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

## Description: Synchronise local database with production.
## Usage: syncdb
## Example: "ddev syncdb"


.ddev/wunderio/core/_run-scripts.sh tooling-syncdb.sh "$@"
2 changes: 1 addition & 1 deletion .ddev/commands/varnish/varnishadm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Control a running Varnish instance
Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/varnish/varnishd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Varnish-cli
Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/varnish/varnishhist
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Display Varnish request histogram
Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/varnish/varnishlog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Display Varnish logs
Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/varnish/varnishncsa
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Display Varnish logs in Apache / NCSA combined log format
Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/varnish/varnishstat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Display Varnish Cache statistics
Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/varnish/varnishtest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Test program for Varnish
Expand Down
2 changes: 1 addition & 1 deletion .ddev/commands/varnish/varnishtop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Display Varnish log entry ranking
Expand Down
7 changes: 0 additions & 7 deletions .ddev/commands/web/grumphp-command.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .ddev/commands/web/phpunit-command.sh

This file was deleted.

7 changes: 7 additions & 0 deletions .ddev/commands/web/wunderio-core-grumphp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

## Description: Runs GrumPHP commands.
## Usage: grumphp
## Example: "ddev grumphp"

/var/www/html/.ddev/wunderio/core/_run-scripts.sh tooling-grumphp.sh "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/wunderio-core-phpunit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

## Description: Runs PHPUnit commands.
## Usage: phpunit
## Example: "ddev phpunit"

/var/www/html/.ddev/wunderio/core/_run-scripts.sh tooling-phpunit.sh "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/wunderio-core-pmu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

## Description: Runs drush pmu commands but also creates dummy module folder if it does not exist.
## Usage: pmu
## Example: "ddev pmu module1 module2 ..."

/var/www/html/.ddev/wunderio/core/_run-scripts.sh tooling-pmu.sh "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/wunderio-core-regenerate-phpunit-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

## Description: Regenerates fresh PHPUnit configuration.
## Usage: regenerate-phpunit-config
## Example: "ddev regenerate-phpunit-config"

/var/www/html/.ddev/wunderio/core/_run-scripts.sh tooling-regenerate-phpunit-config.sh
7 changes: 7 additions & 0 deletions .ddev/commands/web/wunderio-core-yq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

## Description: Runs yq commands (yq is a lightweight and portable command-line YAML processor).
## Usage: yq
## Example: "ddev yq"

yq "$@"
29 changes: 29 additions & 0 deletions .ddev/config.wunderio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
hooks:
post-import-db:
- exec: "/var/www/html/.ddev/wunderio/core/_run-scripts.sh hooks-db-post-import.sh"
post-restore-snapshot:
- exec: "/var/www/html/.ddev/wunderio/core/_run-scripts.sh hooks-db-post-import.sh"
post-start:
# Build hook workaround to run composer install on first start.
# @todo We could potentially make this more like lando build hook by creating tmp files.
- exec: "[ ! -d \"/var/www/html/vendor\" ] && /var/www/html/.ddev/wunderio/core/_run-scripts.sh hooks-web-post-start-once.sh || true"
# Script to run on every start on the host.
- exec-host: ".ddev/wunderio/core/_run-scripts.sh hooks-host-post-start.sh"
# Script to run on every start.
- exec: "/var/www/html/.ddev/wunderio/core/_run-scripts.sh hooks-web-post-start.sh"
# Wunderio/ddev-drupal update check.
- exec: "UPDATE_SCRIPT=\"/var/www/html/vendor/wunderio/ddev-drupal/scripts/update_check.sh\"; [ -f \"$UPDATE_SCRIPT\" ] && $UPDATE_SCRIPT || true"
web_environment:
# Both this project and wunderio/lando-drupal use the same file
# at drush/sites/local.site.yml. To make sure that the local alias
# is working, we need to set the same environment variables here.
- LANDO_WEBROOT=$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT
# When Mutagen is enabled (which it is by default in DDEV v1.19+),
# these directories are bind-mounted directly rather than synced via Mutagen
# This improves performance for large file directories by bypassing Mutagen's
# syncing.
# The paths are relative to the project root.
upload_dirs:
# Configure database_dumps directory to be bind-mounted directly
# instead of being synced via Mutagen for better performance
- ../database_dumps
18 changes: 0 additions & 18 deletions .ddev/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,7 @@ web_environment:
- DB_HOST=db
- DRUSH_OPTIONS_URI=https://drupal-project.ddev.site
- ENVIRONMENT_NAME=ddev
- EXEC_GRUMPHP_COMMAND=ddev php
- HASH_SALT=notsosecurehash
- ELASTICSEARCH_HOST=elasticsearch
- VARNISH_ADMIN_HOST=varnish
- VARNISH_ADMIN_PORT=80
- SMTP_ADDRESS=localhost:1025

corepack_enable: false
hooks:
post-start:
- exec: "composer install"
- exec: "npm ci"
- exec-host: |
# Run the Elasticsearch plugin setup script
ddev exec -s elasticsearch /mnt/ddev_config/elasticsearch/elasticsearch-setup.sh

# Check for the restart marker file
if [ -f .ddev/elasticsearch/restart_needed ]; then
echo "Elasticsearch plugins installed. Restarting elasticsearch container..."
docker restart ddev-${DDEV_SITENAME}-elasticsearch
rm .ddev/elasticsearch/restart_needed
fi
10 changes: 6 additions & 4 deletions .ddev/docker-compose.adminer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ services:
- "ddev-global-cache:/mnt/ddev-global-cache"
depends_on:
- db
command: ["php", "-S", "[::]:8080", "-t", "/var/www/html", "ddev-adminer.php"]
configs:
- source: adminer-index.php
target: /var/www/html/index.php
- source: ddev-adminer.php
target: /var/www/html/ddev-adminer.php
mode: "0444"

configs:
adminer-index.php:
ddev-adminer.php:
content: |
<?php
if (!count($$_GET)) {
Expand All @@ -44,5 +46,5 @@ configs:
'password' => $$_ENV['ADMINER_DEFAULT_PASSWORD'],
];
}
include './adminer.php';
include './index.php';
?>
2 changes: 1 addition & 1 deletion .ddev/docker-compose.adminer_norouter.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ddev-generated
# If omit_containers[ddev-router] then this file will be replaced
# with another with a `ports` statement to directly expose port 8080 to 9100
# with another with a 'ports' statement to directly expose port 8080 to 9100
services: {}
10 changes: 5 additions & 5 deletions .ddev/docker-compose.varnish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
services:
varnish:
container_name: ddev-${DDEV_SITENAME}-varnish
image: varnish:6.0
image: ${VARNISH_DOCKER_IMAGE:-varnish:6.0}
# These labels ensure this service is discoverable by ddev.
labels:
com.ddev.site-name: ${DDEV_SITENAME}
Expand All @@ -15,17 +15,17 @@ services:
- VIRTUAL_HOST=$DDEV_HOSTNAME
# This defines the ports the service should be accessible from at
# sitename.ddev.site.
- HTTPS_EXPOSE=443:80,8026:8025
- HTTP_EXPOSE=80:80,8025:8025
- HTTPS_EXPOSE=${DDEV_ROUTER_HTTPS_PORT}:80,${DDEV_MAILPIT_HTTPS_PORT}:8025
- HTTP_EXPOSE=${DDEV_ROUTER_HTTP_PORT}:80,${DDEV_MAILPIT_PORT}:8025
volumes:
# This exposes a mount to the host system `.ddev/varnish` directory where
# your default.vcl should be.
- "./varnish:/etc/varnish"
- ".:/mnt/ddev_config"
depends_on:
- web
# Add mailhog support
# Add mailpit support
expose:
- "8025"
entrypoint:
/usr/local/bin/docker-varnish-entrypoint -a 0.0.0.0:8025
/usr/local/bin/docker-varnish-entrypoint -a 0.0.0.0:8025
4 changes: 2 additions & 2 deletions .ddev/docker-compose.varnish_extras.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ddev-generated
# This is the second half of the trick that puts varnish "in front of" the web
# container, just by switching the names.
# container, by switching all hostnames with "novarnish" subdomain prefix.
services:
web:
environment:
- VIRTUAL_HOST=novarnish.drupal-project.ddev.site
- VIRTUAL_HOST=novarnish.${DDEV_PROJECT}.${DDEV_TLD}
82 changes: 3 additions & 79 deletions .ddev/varnish/default.vcl
Original file line number Diff line number Diff line change
@@ -1,89 +1,20 @@
# Simple default VCL.
#ddev-generated
# For a more advanced example see https://github.com/mattiasgeniar/varnish-6.0-configuration-templates

vcl 4.1;
import std;

# Define an ACL for trusted purge clients
acl purge {
"127.0.0.1";
"::1";
"web";
}

backend default {
.host = "web";
.port = "80";
}

# @see: https://github.com/wunderio/charts/blob/master/drupal/templates/varnish-configmap-vcl.yaml
# The routine when we deliver the HTTP request to the user
# Last chance to modify headers that are sent to the client.
sub vcl_deliver {
# Called before a cached object is delivered to the client.

# Add debug header to see if it's a HIT/MISS and the number of hits, disable when not needed.
if (obj.hits > 0) {
set resp.http.X-W-Cache = "HIT";
set resp.http.X-W-Cache-Hits = obj.hits;
} else {
set resp.http.X-W-Cache = "MISS";
}
}

sub vcl_recv {
if (std.port(server.ip) == 8025) {
return (synth(750));
}

# Handle PURGE requests for Drupal's varnish_purger module
if (req.method == "PURGE") {
# Allow PURGE requests from trusted clients only
if (!client.ip ~ purge) {
return (synth(403, "Access denied."));
}

# Purge by Cache-Tags header
if (req.http.Cache-Tags) {
ban("obj.http.Cache-Tags ~ " + req.http.Cache-Tags);
return (synth(200, "Purge executed."));
}

# For URL-based purging
return (hash);
}

# Handle BAN requests for Drupal's cache tags
if (req.method == "BAN") {
# Allow BAN requests from trusted clients only
if (!client.ip ~ purge) {
return (synth(403, "Access denied."));
}

# Ban by Cache-Tags header (sent by Drupal's varnish_purger module)
if (req.http.Cache-Tags) {
ban("obj.http.Cache-Tags ~ " + req.http.Cache-Tags);
return (synth(200, "Ban added."));
}

return (synth(403, "Invalid ban request"));
}
}

sub vcl_hit {
if (req.method == "PURGE") {
# We found the object in cache, now invalidate it
set req.http.X-Purge-URL = req.url;
set req.http.X-Purge-Host = req.http.host;
return (synth(200, "Purged " + req.url));
}
}

sub vcl_miss {
if (req.method == "PURGE") {
# Object not in cache, but we still respond with a success
set req.http.X-Purge-URL = req.url;
set req.http.X-Purge-Host = req.http.host;
return (synth(200, "Purged " + req.url + " (not in cache)"));
}
}

sub vcl_synth {
Expand All @@ -94,10 +25,3 @@ sub vcl_synth {
return (deliver);
}
}

# Store the Cache-Tags header from backend responses
sub vcl_backend_response {
if (beresp.http.Cache-Tags) {
set beresp.http.Cache-Tags = beresp.http.Cache-Tags;
}
}
8 changes: 8 additions & 0 deletions .ddev/wunderio/core/__.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# NOT USED, __ prefix means it's under evaluation if to be removed.
# Inject additional environment variables into every Lando service
# @see: https://docs.lando.dev/config/env.html#environment-files
DB_NAME_DRUPAL=drupal10
DB_USER_DRUPAL=drupal10
DB_PASS_DRUPAL=drupal10
DB_HOST_DRUPAL=database
DRUSH_OPTIONS_URI=https://drupal-project.lndo.site
15 changes: 15 additions & 0 deletions .ddev/wunderio/core/__varnish.vcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# NOT USED, __ prefix means it's under evaluation if to be removed.
# @see: https://github.com/wunderio/charts/blob/master/drupal/templates/varnish-configmap-vcl.yaml
# The routine when we deliver the HTTP request to the user
# Last chance to modify headers that are sent to the client
sub vcl_deliver {
# Called before a cached object is delivered to the client.

# Add debug header to see if it's a HIT/MISS and the number of hits, disable when not needed.
if (obj.hits > 0) {
set resp.http.X-W-Cache = "HIT";
set resp.http.X-W-Cache-Hits = obj.hits;
} else {
set resp.http.X-W-Cache = "MISS";
}
}
Loading