lakedrops / docker4drupal
Composer Plugin to prepare local Drupal development environment for Docker.
Package info
gitlab.lakedrops.com/composer/plugin/docker4drupal
Type:composer-plugin
pkg:composer/lakedrops/docker4drupal
Requires
- php: >=8.1
- composer-plugin-api: ^2
- ext-json: *
- drupal/core: ^10 || ^11 || ^12
- henrywhitaker3/healthchecks-io: ^1.0
- lakedrops/ahoy: ^1.9||dev-develop
- lakedrops/composer-json-utils: ^2.5.5||dev-develop
- lakedrops/docker-traefik: ^3.3||dev-develop
Requires (Dev)
- composer/composer: ^2
- lakedrops/drupal-environment: ^3.2||dev-develop
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v3.10.120
- v3.10.119
- v3.10.118
- v3.10.117
- v3.10.116
- v3.10.115
- v3.10.114
- v3.10.113
- v3.10.112
- v3.10.111
- v3.10.110
- v3.10.109
- v3.10.108
- v3.10.107
- v3.10.106
- v3.10.105
- v3.10.104
- v3.10.103
- v3.10.102
- v3.10.101
- v3.10.100
- v3.10.99
- v3.10.98
- v3.10.97
- v3.10.96
- v3.10.95
- v3.10.94
- v3.10.93
- v3.10.92
- v3.10.91
- v3.10.90
- v3.10.89
- v3.10.88
- v3.10.87
- v3.10.86
- v3.10.85
- v3.10.84
- v3.10.83
- v3.10.82
- v3.10.81
- v3.10.80
- v3.10.79
- v3.10.78
- v3.10.77
- v3.10.76
- v3.10.75
- v3.10.74
- v3.10.73
- v3.10.72
- v3.10.71
- v3.10.70
- v3.10.69
- v3.10.68
- v3.10.67
- v3.10.66
- v3.10.65
- v3.10.64
- v3.10.63
- v3.10.62
- v3.10.61
- v3.10.60
- v3.10.59
- v3.10.58
- v3.10.57
- v3.10.56
- v3.10.55
- v3.10.54
- v3.10.53
- v3.10.52
- v3.10.51
- v3.10.50
- v3.10.49
- v3.10.48
- v3.10.47
- v3.10.46
- v3.10.45
- v3.10.44
- v3.10.43
- v3.10.42
- v3.10.41
- v3.10.40
- v3.10.39
- v3.10.38
- v3.10.37
- v3.10.36
- v3.10.35
- v3.10.34
- v3.10.33
- v3.10.32
- v3.10.31
- v3.10.30
- v3.10.29
- v3.10.28
- v3.10.27
- v3.10.26
- v3.10.25
- v3.10.24
- v3.10.23
- v3.10.22
- v3.10.21
- v3.10.20
- v3.10.19
- v3.10.18
- v3.10.17
- v3.10.16
- v3.10.15
- v3.10.14
- v3.10.13
- v3.10.12
- v3.10.11
- v3.10.10
- v3.10.9
- v3.10.8
- v3.10.7
- v3.10.6
- v3.10.5
- v3.10.4
- v3.10.3
- v3.10.2
- v3.10.1
- v3.10.0
- v3.9.19
- v3.9.18
- v3.9.17
- v3.9.16
- v3.9.15
- v3.9.14
- v3.9.13
- v3.9.12
- v3.9.11
- v3.9.10
- v3.9.9
- v3.9.8
- v3.9.7
- v3.9.6
- v3.9.5
- v3.9.4
- v3.9.3
- v3.9.2
- v3.9.1
- v3.9.0
- v3.8.12
- v3.8.11
- v3.8.10
- v3.8.9
- v3.8.8
- v3.8.7
- v3.8.6
- v3.8.5
- v3.8.4
- v3.8.3
- v3.8.2
- v3.8.1
- v3.8.0
- v3.7.60
- v3.7.59
- v3.7.58
- v3.7.57
- v3.7.56
- v3.7.55
- v3.7.54
- v3.7.53
- v3.7.52
- v3.7.51
- v3.7.50
- v3.7.49
- v3.7.48
- v3.7.47
- v3.7.46
- v3.7.45
- v3.7.44
- v3.7.43
- v3.7.42
- v3.7.41
- v3.7.40
- v3.7.39
- v3.7.38
- v3.7.37
- v3.7.36
- v3.7.35
- v3.7.34
- v3.7.33
- v3.7.32
- v3.7.31
- v3.7.30
- v3.7.29
- v3.7.28
- v3.7.27
- v3.7.26
- v3.7.25
- v3.7.24
- v3.7.23
- v3.7.22
- v3.7.21
- v3.7.20
- v3.7.19
- v3.7.18
- v3.7.17
- v3.7.16
- v3.7.15
- v3.7.14
- v3.7.13
- v3.7.12
- v3.7.11
- v3.7.10
- v3.7.9
- v3.7.8
- v3.7.7
- v3.7.6
- v3.7.5
- v3.7.4
- v3.7.3
- v3.7.2
- v3.7.1
- v3.7.0
- v3.6.7
- v3.6.6
- v3.6.5
- v3.6.4
- v3.6.3
- v3.6.2
- v3.6.1
- v3.6.0
- v3.5.7
- v3.5.6
- v3.5.5
- v3.5.4
- v3.5.3
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.1
- v3.4.0
- v3.3.11
- v3.3.10
- v3.3.9
- v3.3.8
- v3.3.7
- v3.3.6
- v3.3.5
- v3.3.4
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.5
- v3.2.4
- v3.2.3
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.6
- v3.1.5
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.17.0
- v1.16.2
- v1.16.1
- v1.16.0
- v1.15.1
- v1.15.0
- v1.14.0
- v1.13.2
- v1.13.1
- v1.13.0
- v1.12.2
- v1.12.1
- v1.12.0
- v1.11.7
- v1.11.6
- v1.11.5
- v1.11.4
- v1.11.3
- v1.11.2
- v1.11.1
- v1.11.0
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.9
- v1.9.8
- v1.9.7
- v1.9.6
- v1.9.5
- v1.9.4
- v1.9.3
- v1.9.2
- v1.9.1
- v1.9.0
- v1.8.8
- v1.8.7
- v1.8.6
- v1.8.5
- v1.8.4
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.0
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.1
- 1.0.0
- v0.9.0
- v0.8.7
- v0.8.6
- v0.8.5
- v0.8.4
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.3
- v0.7.2
- v0.7.1
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.1
- v0.3.0
- v0.2.8
- v0.2.7
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-fix/167-mariadb-healthcheck-tcp
- dev-develop
- dev-feature/152-solr-routed
- dev-fix/105-revert-playwright-main-merge
- dev-fix/declare-drupal-core-dependency
- dev-95-apache-tika
- dev-issue-94/qdrant
- dev-issue-60/pre-configure-solr
- dev-issue-60/pre-configure-wodby-solr
- dev-nginx/custom-preset
- dev-issue-60/solr-mount-volume
- dev-issue-60/solr
- dev-issue-59
This package is auto-updated.
Last update: 2026-12-03 09:06:53 UTC
README
Composer plugin that renders Docker Compose services for Drupal projects.
Public and private service domains
DOCKER4DRUPAL_TRAEFIK_PRIVATE_DOMAIN affects CI builds only, including
Build Prod Site NG (LAKEDROPS_BUILD_NG=yes). When set, auxiliary services
use <service>-<project>.<private domain>. The Drupal web server retains its
configured project domain. Local development and L3D sandboxes ignore the private
domain variable.
Invoice Ninja always stays public in Build Prod Site NG, including staging
stacks built by that job. Its router and APP_URL both use
invoice-<public project domain>, preserving the URL from before v3.10.98.
For example, invoice-main-example.example.com does not change
when a runner adds a private domain. Other auxiliary services remain private.
The public project domain comes from the existing project configuration; this
change does not construct a different public hostname or add a second router.
Non-production pipeline previews still use the private domain for Invoice Ninja, including their container host mappings. They are test environments, not the customer-facing production application.
This is an explicit, non-configurable exception: servicedomain holds the shared
auxiliary domain, while the computed invoicedomain holds Invoice Ninja's domain.
A configurable per-service exposure switch would let a project accidentally
violate the requirement that customer-facing Invoice Ninja stays public.
OpenTelemetry endpoint address
DOCKER4DRUPAL_OPENTELEMETRY_ADDRESS is the IPv4 address that the php
container uses for the host of OPENTELEMETRY_ENDPOINT, the OTLP endpoint
that lakedrops/drupal-environment configures for the drupal/opentelemetry
module. It is meant for a log server that admits NetBird peers only while its
name still resolves to a public address, for example
DOCKER4DRUPAL_OPENTELEMETRY_ADDRESS=100.64.104.21 with
OPENTELEMETRY_ENDPOINT=https://logs.lakedrops.com/api/default. php then
gets the entry logs.lakedrops.com:100.64.104.21 in its extra_hosts, in the
same list as the names of LOCAL_IP and the private domain.
The mapping applies to pipeline builds, Build Prod Site NG, and local
development, where L3D exports the variables of ~/.env and the project's
.env. L3D sandboxes ignore it. Without the variable, or without a host in
OPENTELEMETRY_ENDPOINT, nothing changes. An address that is not IPv4 is
ignored with a warning.
The log server's own host. There, a request from a container to one of
the host's addresses arrives at Traefik from the gateway of traefik-public,
which Traefik refuses for NetBird-only names. A pipeline build recognizes this
host when the variable equals the runner's
DOCKER4DRUPAL_TRAEFIK_NETBIRD_ADDRESS: php joins traefik-public and maps
the endpoint's host to Traefik's address there, never to the gateway. As with
the private domain, gw_priority: 1 on the project's default network of php
and the web server keeps service names such as php resolving to the own
project once a php of another project joins traefik-public. This needs
Docker 28 and Compose 2.33 or later. The web servers of stacks rendered
without it on the same host, by older releases of this plugin or without these
variables, have no such priority.
Build Prod Site NG always uses the address as given. DeployNG writes the
gateway of traefik-public, not Traefik's address, for
TRAEFIK-IP-PLACEHOLDER, so live and staging stacks on the log server's own
host cannot reach a NetBird-only endpoint there. Such stacks are not
supported.
Trusted proxies
DOCKER4DRUPAL_TRUSTED_PROXIES lists the proxies in front of Traefik that
Drupal trusts, as comma-separated IPv4 and IPv6 addresses and CIDR ranges, for
example the ranges of Cloudflare:
DOCKER4DRUPAL_TRUSTED_PROXIES=173.245.48.0/20,2400:cb00::/32. Behind such a
proxy, a request reaches Drupal with X-Forwarded-For: <visitor>, <edge>.
Symfony takes the rightmost address that it does not trust as the client; with
only Traefik trusted, that is the edge, and flood control, dblog, Ban and every
other per-IP limit act on the proxy instead of the visitor.
settings.docker.php appends the entries to reverse_proxy_addresses after
Traefik's address. In Build Prod Site NG, that address remains
TRAEFIK-IP-PLACEHOLDER, the first entry, which DeployNG replaces:
$settings['reverse_proxy_addresses'] = ["TRAEFIK-IP-PLACEHOLDER", "173.245.48.0/20", "2400:cb00::/32"];
Like the private domain, the variable affects CI builds only, including Build
Prod Site NG. Local development and L3D sandboxes ignore it. Without the
variable, settings.docker.php trusts Traefik alone, as before. An entry that
is neither an address nor a CIDR range is skipped with a warning.
Trust only proxies that cannot be bypassed: anyone who connects from a trusted
address can set the client address. That holds when Traefik admits only these
sources and replaces the X-Forwarded-For header of every other one.
Invoice Ninja database
in-db runs MariaDB 12.3 LTS (supported until June 2029) and keeps its data in
in/mariadb. Versions up to 3.10.100 used MySQL 5.7 with data in in/db.
Invoice Ninja 5.13 needs window functions and REGEXP_REPLACE, and Laravel's
database queue uses SKIP LOCKED only on MySQL 8.0.1 or later and MariaDB 10.6
or later; without it, queue workers deadlock on the jobs table.
Its healthcheck pings the server over TCP with the root password from the
container's environment, not with the image's healthcheck.sh. In pipeline
workspaces with default ACLs, the image's .my-healthcheck.cnf becomes
world-writable, so the client ignores it and healthcheck.sh fails with
Access denied. TCP also keeps the temporary server of the initialization,
which runs without networking, from counting as healthy.
The new release does not read in/db. An existing project starts with an
empty Invoice Ninja database until its data is migrated; in/db stays
untouched as the rollback copy. To migrate, replacing <root password> with
the MYSQL_ROOT_PASSWORD of in-db:
With the old stack running, stop
in-app(docker compose stop in-app), then dump the database:docker compose exec -T in-db mysqldump -u root -p'<root password>' \ --single-transaction --routines --triggers --hex-blob \ --default-character-set=utf8mb4 ninja > ninja.sqlUpdate the plugin and regenerate
docker-compose.yml.Start only the database, wait until
docker compose ps in-dbreports it healthy, then import the dump:docker compose up -d in-db docker compose exec -T in-db mariadb -u root -p'<root password>' ninja < ninja.sqlStart the remaining services with
docker compose up -d;in-appruns its migrations on startup.- Verify Invoice Ninja, then remove
in/db.
Deployments that start all services at once, such as Build Prod Site NG,
give no chance to import between steps 3 and 4. Pre-seed in/mariadb before
deploying instead: run a temporary container with the same image, environment,
command, and data mount as in-db, import the dump there, and stop it cleanly.
Production jobs install the newest release, so migrate each Invoice Ninja production stack in the same window as the deployment that picks up this release.
Jobs that no worker takes pile up unnoticed. Invoice Ninja queues its jobs
in the jobs table of ninja. From the project directory, list per queue the
jobs that have waited or been reserved for more than an hour, and how many of
them are reserved:
docker compose exec -T in-db sh -c 'MYSQL_PWD="$MYSQL_ROOT_PASSWORD" mariadb -u root -N -e "select queue, count(*), sum(reserved_at is not null) from jobs where coalesce(reserved_at, available_at) < unix_timestamp() - 3600 group by queue" ninja'
It returns no rows. Reserved rows are stuck: on MySQL 5.7, a worker's delete
after a finished job often deadlocked and left the row reserved, so their jobs
have run. Rows that are not reserved wait on a queue that no worker takes: the
workers of the image run queue:work without --queue and take only
default. Invoice Ninja 5.12.18 (upstream 7af38fc) put every
Laravel\Scout\Jobs\MakeSearchable job on queue scout; since upstream
1cef467 it queues them only when SCOUT_DRIVER is set, which in-app does
not do, so projects that ran a release in between hold such rows. With Scout's
null driver they do nothing when run. Back up the rows of such a queue, then
delete them, here for scout:
docker compose exec -T in-db sh -c 'MYSQL_PWD="$MYSQL_ROOT_PASSWORD" mariadb-dump -u root --no-create-info --where="queue='\''scout'\''" ninja jobs' > jobs-scout.sql
docker compose exec -T in-db sh -c 'MYSQL_PWD="$MYSQL_ROOT_PASSWORD" mariadb -u root -e "delete from jobs where queue = '\''scout'\''" ninja'
AI agent settings
The plugin writes no AI agent settings by default. When enabled, it writes
.claude/mcp.json, .ai/template.md, and .ai/prepare.md, and adds
/.claude/ to .gitignore; ahoy d4d aiprepare then shows how to prepare
AGENTS.md with them. Enable it for a project in .lakedrops.yml:
docker4drupal:
ai:
enable: 1
The same key in .lakedrops.user.yml enables it for one developer only.
Alternatively, set DOCKER4DRUPAL_AI=1 in the project's .env, where the
plugin records the default DOCKER4DRUPAL_AI=0 on its first run. Then run
ahoy d4d update.
Projects that already have these files keep them: without the setting, the
plugin only stops writing them. Remove them, and the /.claude/ entry in
.gitignore, manually if they are no longer wanted.
Mail relay
The mailrelay service is a Postfix null client (boky/postfix v5.2.1) that
queues the mail of a site. Without it, Drupal sends each mail synchronously to
the provider's SMTP server with a single attempt, so a stalled provider hangs
the request and loses the mail. With the relay, Drupal hands the mail over on
the internal network within milliseconds. Postfix queues it, retries the first
time after about 5 minutes, and gives up and bounces it after 5 days.
On by default, Mailpit wins. The relay is enabled by default. With
mailpit.enable, the plugin disables it before it checks any relay value, so
a stage with Mailpit never delivers mail for real and needs no relay config:
local development, pipeline previews, and every stage of Build Prod Site NG
but main. Every stage without Mailpit uses the relay unless it is disabled.
Config keys of the docker4drupal component, below mailrelay:
| Key | Default | Environment variable | Purpose |
|---|---|---|---|
enable | 1 | MAILRELAY_ENABLE | Renders the relay on stages without Mailpit; 0 disables. |
host | '' | MAILRELAY_HOST | The provider's SMTP host; required. |
port | 465 | MAILRELAY_PORT | The provider's SMTP port; 465 uses implicit TLS, see TLS. |
username | '' | MAILRELAY_USERNAME | The provider's username; empty sends without credentials. |
password | '' | MAILRELAY_PASSWORD | The provider's password; required with a username. |
senderdomains | '' | MAILRELAY_SENDER_DOMAINS | Space-separated sender domains; required. |
hostname | '' | MAILRELAY_HOSTNAME | The relay's Postfix hostname; empty derives it. |
concurrency | 2 | MAILRELAY_CONCURRENCY | Maximum parallel connections to the provider. |
The environment variables set the defaults, and .lakedrops.yml and its
stage_overwrites override them. The plugin never prompts for them. Like
other variables, it records the defaults in the project's .env on its first
run, except the credentials, see below, and MAILRELAY_SENDER_DOMAINS: the
.env writer does not quote the spaces between several domains, and the next
read of the file would fail. Keep the credentials in CI/CD variables, locally
in ~/.env.
Required values. An enabled relay without host or senderdomains stops
the plugin with an error that names the missing variables: without a provider
host, Postfix would deliver to the MX of each recipient, and the image does not
start without sender domains. A username without a password, or a password
without a username, stops it as well, and so does a credential with a line
break or invalid UTF-8, which the credentials file cannot hold. The messages
never show a value.
Migration. Every stage without Mailpit, such as main in Build Prod Site
NG, now gets the relay. Set MAILRELAY_HOST, MAILRELAY_SENDER_DOMAINS and,
if the provider needs them, MAILRELAY_USERNAME and MAILRELAY_PASSWORD as
CI/CD variables, or disable the relay with MAILRELAY_ENABLE=0 or in
.lakedrops.yml:
stage_overwrites:
main:
docker4drupal:
mailrelay:
enable: 0
Earlier versions recorded MAILRELAY_USERNAME and MAILRELAY_PASSWORD in
the project's .env and wrote the credentials into docker-compose.yml. The
plugin removes these two lines from .env and leaves every other line as it
is; if it cannot rewrite .env, it stops. If they held values, it warns: set
them as environment variables from then on, otherwise the next run renders the
relay without credentials. It also removes a docker-compose.yml.orig that
holds credentials. Credentials in
.lakedrops.yml still apply, but that file is committed and inside the
project: move them to the variables and remove them there.
Credentials. Only the relay gets them. On every run, the plugin writes
.docker-init/mailrelay/credentials.env below the project root, with mode
0600 in a directory with mode 0700, also after it sets its recursive ACLs,
and adds /.docker-init/mailrelay/ to .gitignore. The relay reads the file
as an env_file with format: raw, which Compose passes on byte for byte,
without interpolation or quotes; this needs Docker Compose 2.30.0 or later on
the host that runs docker compose up. The file stays in the project, in
.docker-init/, which Build Prod Site NG ships with docker-compose.yml, so
it reaches wherever the stack runs. Every service that mounts the whole
project, php, the web server, and nodejs and node with an empty
node.path, gets an empty tmpfs over .docker-init/mailrelay instead: PHP and
these services never see the file, but still see the rest of .docker-init.
Neither docker-compose.yml, settings.docker.php nor the project's .env
holds a credential. Without credentials, on a stage with Mailpit, or with the
relay disabled, the plugin removes .docker-init/mailrelay. This separates the
containers only: users of the host with access to the project directory, and
anyone who controls Docker, can read the file.
With the relay enabled, the plugin renders:
- The
mailrelayservice on the project's default network only, without a Traefik router, withrestart: unless-stoppedon live sites. Its queue is themailrelay/directory below the project root, in Build Prod Site NG/drupal/<project id>/<branch>/mailrelay, and survives recreated containers. The plugin adds/mailrelay/to.gitignore. With credentials, the service reads them from the credentials file. .docker-init/mailrelay-sasl.sh, mounted read-only into the relay's/docker-init.d/, which the image runs at the end of its startup, before Postfix starts. See Rotation below.- In
php, adepends_onentry formailrelayandPHP_SENDMAIL_PATH=/usr/sbin/sendmail -t -i -S mailrelay:587. The condition isservice_started, notservice_healthy: a misconfigured relay must never keepphp, and with it the site, from starting. Postfix needs about 12 seconds to start, so mail sent in the first seconds after the stack starts fails. - In
settings.docker.php, themailer_dsnofsystem.mail, thesmtp.settings, and thesmtptransport ofsymfony_mailer_liteplus its default transport, all pointing atmailrelay:587without credentials. The site's mail system stays as configured.
Rotation. The image keeps /etc/postfix in a volume that a recreated
container reuses. When the credentials change, it tries to remove the relay
host's old entry from sasl_passwd with the bracketed [host]:port as a
regular expression, which never matches, and appends the new entry; Postfix
uses the first one, so the old password stays in use. mailrelay-sasl.sh
therefore replaces every entry of the relay host, or of SASL_RELAYHOST if
set, by literal comparison, keeps all other entries, and rebuilds the map on
every start, with the credentials byte for byte. Without credentials, it
removes the relay host's entries, so Postfix sends without authentication.
It never prints a credential. The queue in mailrelay/ stays untouched. A
new password therefore takes effect when the relay container is recreated or
restarted.
TLS. The relay sends to [host]:port; the brackets skip the MX lookup.
TLS to the provider is required. On port 465, the default, the relay speaks
TLS from the start (POSTFIX_smtp_tls_wrappermode=yes); on any other port,
such as 587, it requires STARTTLS (POSTFIX_smtp_tls_wrappermode=no). The
value is always set, because the image keeps /etc/postfix across
containers and never removes a setting whose variable is gone. The relay
offers no STARTTLS to Drupal: Symfony's ESMTP transport would upgrade the
connection and then fail verify_peer against the image's self-signed
certificate. Unencrypted mail only crosses the project's internal network.
Trusted clients. The relay sets POSTFIX_mynetworks=0.0.0.0/0,[::]/0 and
accepts mail from every client that reaches it: it joins only the project's
default network and publishes no port, so that network is the trust boundary.
The image's default list trusts only the RFC 1918 ranges and rejects php on
Docker hosts whose address pools lie outside them, such as 169.254.0.0/16.
ALLOWED_SENDER_DOMAINS still limits the senders.
Hostname. The relay sets POSTFIX_myhostname to mailrelay.hostname
(MAILRELAY_HOSTNAME), or, if that is empty, to the project's publicdomain,
or, without one, to its projectdomain. Postfix uses this name in EHLO, in
its Received: header, and as the sender of MAILER-DAEMON bounces. Without
it, the image would use the container ID, which is no fully qualified domain
name and changes with every deploy. The image keeps mydestination empty, so
a domain in the hostname never makes Postfix deliver mail for it locally.
Concurrency. The relay sets POSTFIX_smtp_destination_concurrency_limit
to mailrelay.concurrency (MAILRELAY_CONCURRENCY), 2 by default. Postfix's
own default, 5 at first and up to 20, opens several parallel connections to
the one smarthost during a burst. Shared hosting providers cap the connections
per client and refuse the extra ones with 421 too many connections, which
defers that mail by one retry interval of about 5 minutes. Two connections
still deliver a burst within seconds, because Postfix reuses open connections.
Raise the value if the provider allows more connections.
Further Postfix settings, such as POSTFIX_minimal_backoff_time or
ANONYMIZE_EMAILS, go into the docker-compose.yml key of .lakedrops.yml
below services: mailrelay: environment:. Add new keys only: the merge turns
an existing key into a list.
Consequences. Drupal no longer sees delivery failures. Watch
docker compose logs mailrelay for status=deferred and status=bounced.
Permanent rejections bounce to the envelope sender. The logs contain recipient
addresses. docker compose exec mailrelay mailq lists the queue, and
docker compose exec mailrelay postqueue -f flushes it.
Mailpit's data. The plugin generates mailpit/mailpitout.yml in every
project, and Mailpit keeps its database of caught mail in mailpit/ after it
is disabled, so the plugin adds /mailpit/ to .gitignore whether Mailpit is
enabled or not.
Site URL
The php service gets DRUPAL_URI, the site's URL, in local development,
pipelines and on live sites alike. Drupal core's CLI, vendor/bin/dr, has no
config file: it takes the URL from --url, then from DRUPAL_URI, and falls
back to http://localhost. Cron jobs run in php and inherit the variable.
With a publicdomain, the value is https://<publicdomain>: Traefik
redirects the project domain there, always over https. Otherwise it is
<projectprotocol>://<projectdomain><projectport>, the URL that drush.yml
gives Drush as options.uri, for example http://example.docker.localhost:8000
in local development without SSL. Build Prod Site NG sets https and no port.
PHP assertions
On live sites, the php service gets PHP_ZEND_ASSERTIONS=-1, which the
wodby image writes into php.ini as zend.assertions. With -1, PHP compiles
no assertion code, as Drupal core recommends for production. Other stages do
not set the variable and keep the image default 1, so assertions catch bugs
in local development and pipelines. PHP accepts -1 only in php.ini, not at
runtime: a live php container has to be recreated to pick up the change.
Headless end-to-end runs
The plugin generates two scripts in every project, also in pipelines: they
are not committed (.gitignore) and exist whether the Cypress or Playwright
service is enabled or not. Both start a container on the project's network
<projectname>_default, so the site's stack must be running, and both are
called from the project root. When a container of the same name still exists,
they attach to it instead of starting a new one.
tests/cypress-runruns the Cypress suite intests/cypresswith Firefox.tests/playwright-runruns the Playwright suite intests/playwright(installed by Composer) headless, with the imageregistry.lakedrops.com/docker/playwright:<playwright.version>. The base URL ishttp://<webserver.type>, the site's webserver service; Mailpit ishttp://mailpit:8025. The browser isplaywright.browserfrom.lakedrops.yml(defaultchromium); the environment variablePLAYWRIGHT_BROWSERoverrides it for one run. Only the tests belowtests/playwrightrun, not the ones the image ships. Arguments go tonpx playwright test: a file filter narrows the suite, other options pass through, for exampletests/playwright-run loginortests/playwright-run --grep @smoke. The results land intests/playwright:playwright-report/(HTML),test-results/(traces, screenshots) andjunit.xml. The exit code is the one of the test run. Withouttests/playwright, the script stops with a message before it calls Docker:docker runwould create the missing directory owned by root, and the run would fail without pointing at the missing suite.
tests/playwright-run
PLAYWRIGHT_BROWSER=firefox tests/playwright-run login
Backup error alerts
With alerta configured, the borgmatic sidecar reports a failed run to the
alerta proxy service: its on_error hook sends one JSON document over UDP
to alerta:<alerta.proxy_port> (default 20002), with the host name, the
config file, the repository and, in rawData, the last 4000 characters of
the error output. Python's json.dumps builds the document, so quotes,
parentheses and line breaks in the error text arrive intact.
The hook needs borgmatic 1.8.7 or later in backup.version. Since 1.8.7,
borgmatic shell-quotes the values it puts into hook commands, and the hook
relies on that. The default 1.8 resolves to 1.8.14. With an older version,
an error text with spaces or quotes breaks the hook, and Alerta gets no
report.
Tests
Install dependencies without activating Composer plugins in this plugin's own checkout, then run the integration test:
composer install --no-interaction --no-scripts --no-plugins
composer --no-plugins test
composer --no-plugins validate --no-check-publish
for file in src/*.php tests/*.php; do php -l "$file" || exit; done
On an L3D host, run these commands through l3d .. The test uses the real
configuration class and Twig template, parses the generated YAML, and checks
production with and without a private domain, production staging, pipeline
previews, local development, and sandboxes. It checks the Invoice Ninja router
and APP_URL together, other auxiliary routes, and pipeline host mappings.
In the same contexts, it checks that in-db runs MariaDB with a healthcheck
that pings over TCP without healthcheck.sh, keeps its data in in/mariadb,
never in/db, and that in-app waits for a healthy in-db.
For DOCKER4DRUPAL_OPENTELEMETRY_ADDRESS, it checks the entry and the
networks of php in each of these contexts, on the log server's own host and
on another one, and that the file stays the same without the variable,
without a host in the endpoint, or with an address that is not IPv4.
For DOCKER4DRUPAL_TRUSTED_PROXIES, it checks reverse_proxy_addresses in
settings.docker.php for Build Prod Site NG, with the placeholder first,
pipeline builds, local development, and sandboxes, that invalid entries are
skipped with a warning, and that the file stays the same without the variable.
For the mail relay, it checks the service, the derivation of its hostname,
its destination concurrency by default and when configured, its settings
overrides, that Mailpit takes precedence, and that a disabled relay changes
nothing. With the defaults that configDefault() reads from the environment,
it checks that the relay is on without Mailpit and takes every MAILRELAY_*
variable, that Mailpit wins even without any relay config, that
MAILRELAY_ENABLE=0 and mailrelay.enable: 0 disable it, and that missing
required values, half credentials, line breaks and invalid UTF-8 stop the
plugin with messages that hide the values. It checks that
docker-compose.yml, settings.docker.php and .env hold no credential,
that .env does not record two space-separated sender domains and still takes
the variables after them, that only the relay gets the credentials file, that
every service mounting the whole project masks it, and that the file is exact,
private, ignored by git, rewritten on each run, kept private after recursive
ACLs, and removed without credentials. Where Docker Compose is available,
docker compose config resolves the rendered file and proves the values
arrive byte for byte; otherwise the test prints a SKIP line. Where ACLs are
supported, the ACL check runs, otherwise it prints a SKIP line too. It
checks that the migration removes only the credentials from .env, warns
without showing them, stops when it cannot rewrite .env (not as root, which
writes anyway; then it prints a SKIP line), and removes a
docker-compose.yml.orig with credentials, and that git ignores mailpit/
with Mailpit disabled. For mailrelay-sasl.sh, it checks its generation and
mount, and runs it with a stub postmap against a map with stale and
duplicate entries of the relay host and an unrelated entry: it checks the
replacement, the unrelated entry, a rotation, a repeated run, the
SASL_RELAYHOST override, the mode of the map, the absence of credentials in
its output, and the removal without credentials.
For the backup, it checks that borgmatic dumps the database with
--single-transaction: mysqldump's default --lock-tables would block the
site's writes for the whole dump, once per repository. Without alerta, it
checks that there is no on_error hook. With alerta, it takes the hook,
puts the values into it the way borgmatic 1.8.7 and later does, and runs it
with a stub nc: the stub must receive one JSON document with every field,
an error text with parentheses, quotes, shell code and line breaks unchanged,
and only the end of a long error text. Without python3, it prints a SKIP
line.
For DRUPAL_URI, it checks the URL of a project domain over https, with a
port, and with a publicdomain.
For PHP assertions, it checks that live stages set PHP_ZEND_ASSERTIONS to
-1 in php and that other stages do not set it.
For tests/playwright-run, it checks that the script is generated like
tests/cypress-run, its base URL, browser, image, network and mount, and its
Bash syntax. With stubs for docker and php, it runs the script: without
tests/playwright, the script exits with a message, calls no docker and
creates no directory; with it, the script calls docker run with the mount.
The Service domain regression job runs these checks, Drupal/DrupalPractice
coding standards, and PHPStan (using phpstan.neon) in develop and
feature/* branch pipelines. Its lint tools are installed separately so
they do not alter the plugin's dependencies. The tool installation sets
COMPOSER_BIN_DIR explicitly to .qa/vendor/bin: shared Composer artifacts
export a different bin directory, which must not redirect these isolated tools
into vendor/bin.
The shared validate stage runs in branch pipelines for develop and
feature/*. Merge requests get no pipeline of their own, so a merge request
reflects the pipeline of its source branch. Use a
feature/<issue>-<description> branch and require both its full validate
stage and Service domain regression job before merging; branches outside
feature/* run neither check.
Release flow
Feature and fix merge requests target develop. The shared CI configuration
runs Publish Release on develop unless SKIP_PUBLISH_RELEASE=1; that job
clones develop and invokes the shared merge command for the release merge.
The resulting Merging develop into main merge request is separate from the
feature/fix MR.
The main pipeline's Tag Release job recognizes a commit beginning
Merge branch 'develop' into 'main' (also release into main, or a commit
containing [tag release]). It runs gen-semver and creates the generated tag
on main. [MAJOR_VERSION], [MINOR_VERSION], [PATCH_VERSION], and
[REVISION_VERSION] select an explicit increment; skip-tag suppresses tagging.
The tag pipeline's Build Package Tag job publishes the tag to GitLab's Composer
registry. Do not merge the fix or the release MR, or trigger tagging, until the
change has been reviewed.
After a reviewed release, rebuild the production Compose file and deploy it to restore the public Invoice Ninja route. Production jobs install the newest release; pipeline builds follow each project's lock file. Reverting the change would restore the private production route and break the public Invoice Ninja URL when the private domain is set.