Skip to content

Commit 2855a73

Browse files
authored
Merge pull request #1303 from dof-dss/development
Dev to main for release
2 parents 91a3230 + 7ff6de0 commit 2855a73

File tree

179 files changed

+2128
-2459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+2128
-2459
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ddev-generated
2+
3+
export PATH=$PATH:$PLATFORM_APP_DIR/.global/bin
4+
5+
for item in .global/environment .environment; do
6+
if [ -f "${item}" ]; then
7+
. "${item}"
8+
fi
9+
done
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
# Variables to indicate key settings files or directories for Drupal.
4+
DRUPAL_ROOT=/var/www/html/web
5+
6+
# If we don't have a Drupal install, download it.
7+
if [ ! -d "/var/www/html/core" ]; then
8+
echo "Installing Drupal"
9+
export COMPOSER_PROCESS_TIMEOUT=600
10+
composer install
11+
fi
12+
13+
# Create Drupal public files directory and set IO permissions.
14+
if [ ! -d "/var/www/html/files" ]; then
15+
echo "Creating public Drupal files directory"
16+
mkdir -p /var/www/html/files
17+
chmod -R 0775 /var/www/html/files
18+
fi
19+
20+
# Create Drupal private file directory above web root.
21+
if [ ! -d "/var/www/html/private" ]; then
22+
echo "Creating private Drupal files directory"
23+
mkdir -p /var/www/html/private
24+
fi
25+
26+
if [ ! -d $DRUPAL_ROOT/sites/default/settings.local.php ]; then
27+
echo "Creating local Drupal settings and developent services files"
28+
cp -v /var/www/html/.ddev/homeadditions/config/drupal.settings.php $DRUPAL_ROOT/sites/default/settings.local.php
29+
cp -v /var/www/html/.ddev/homeadditions/config/drupal.services.yml $DRUPAL_ROOT/sites/local.development.services.yml
30+
fi
31+
32+
# Set Simple test variables and put PHPUnit config in place.
33+
if [ ! -f "${DRUPAL_ROOT}/core/phpunit.xml" ]; then
34+
echo "Adding localised PHPUnit config to Drupal webroot"
35+
cp $DRUPAL_ROOT/core/phpunit.xml.dist $DRUPAL_ROOT/core/phpunit.xml
36+
# Fix bootstrap path
37+
sed -i -e "s|bootstrap=\"tests/bootstrap.php\"|bootstrap=\"${DRUPAL_ROOT}/core/tests/bootstrap.php\"|g" $DRUPAL_ROOT/core/phpunit.xml
38+
# Inject database params for kernel tests.
39+
sed -i -e "s|name=\"SIMPLETEST_DB\" value=\"\"|name=\"SIMPLETEST_DB\" value=\"${DB_DRIVER}://${DB_USER}:${DB_PASS}@${DB_HOST}/${DB_NAME}\"|g" $DRUPAL_ROOT/core/phpunit.xml
40+
# Uncomment option to switch off Symfony deprecatons helper (we use drupal-check for this).
41+
sed -i -e "s|<!-- <env name=\"SYMFONY_DEPRECATIONS_HELPER\" value=\"disabled\"/> -->|<env name=\"SYMFONY_DEPRECATIONS_HELPER\" value=\"disabled\"/>|g" $DRUPAL_ROOT/core/phpunit.xml
42+
# Set the base URL for kernel tests.
43+
sed -i -e "s|name=\"SIMPLETEST_BASE_URL\" value=\"\"|name=\"SIMPLETEST_BASE_URL\" value=\"${DDEV_PRIMARY_URL}\"|g" $DRUPAL_ROOT/core/phpunit.xml
44+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
// @codingStandardsIgnoreFile
4+
$local_services_config = $app_root . '/sites/local.development.services.yml';
5+
if (file_exists($local_services_config)) {
6+
$settings['container_yamls'][] = $local_services_config;
7+
}
8+
9+
// Add migration source database details, if needed.
10+
// NB: uses the same db container to store the source db.
11+
// This can be useful for cross-db queries.
12+
$databases['default']['drupal7db'] = [
13+
'database' => getenv('MIGRATE_SOURCE_DB_NAME'),
14+
'username' => getenv('MIGRATE_SOURCE_DB_USER'),
15+
'password' => getenv('MIGRATE_SOURCE_DB_PASS'),
16+
'host' => getenv('MIGRATE_SOURCE_DB_HOST'),
17+
'port' => getenv('MIGRATE_SOURCE_DB_PORT'),
18+
'driver' => getenv('MIGRATE_SOURCE_DB_DRIVER'),
19+
];
20+
21+
// Prevent SqlBase from moaning.
22+
$databases['migrate']['default'] = $databases['default']['drupal7db'];
23+
24+
// Set config split environment.
25+
$config['config_split.config_split.local']['status'] = TRUE;
26+
$config['config_split.config_split.development']['status'] = FALSE;
27+
$config['config_split.config_split.production']['status'] = FALSE;

.ddev/commands/web/drupal-check

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
## Description: Run drupal-check locally to detect deprecated code and ensure future compliance.
4+
## Usage: drupal-check
5+
## Aliases: drck
6+
## Example: "ddev <drupal-check|drck> web/modules/custom"
7+
8+
/var/www/html/vendor/bin/drupal-check --memory-limit=256M $1

.ddev/commands/web/phpcs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
## Description: Execute local PHPCS static analysis checks.
4+
## Usage: phpcs
5+
## Example: "ddev phpcs"
6+
7+
/var/www/html/phpcs.sh "/var/www/html" "/var/www/html/web/modules/origins /var/www/html/web/modules/custom /var/www/html/web/themes/custom"

.ddev/commands/web/phpunit

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
## Description: Run phpunit to execute local tests.
4+
## Usage: phpunit
5+
## Example: "ddev phpunit"
6+
7+
php /app/vendor/bin/phpunit -c /app/phpunit.xml

.ddev/config.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# DDEV project level config. See https://ddev.readthedocs.io/en/stable/users/configuration/config/
2+
# for full set of options that can be used.
3+
composer_version: "2"
4+
database:
5+
type: mariadb
6+
version: "10.11"
7+
docroot: web
8+
fail_on_hook_fail: true
9+
hooks:
10+
pre-start:
11+
# Ensure env var file is deployed; needs to be filled in manually for sensitive values.
12+
- exec-host: "if [ ! -f .ddev/.env ]; then cp -v .env.sample .ddev/.env && echo PLEASE FILL IN SENSITIVE ENV VAR VALUES IN .ddev/.env THEN RUN ddev restart && exit 1; fi"
13+
post-start:
14+
- composer: install
15+
- exec: ".ddev/homeadditions/appserver_build.sh"
16+
post-import-db:
17+
# Use --skip-hooks flag to skip these commands, eg: when importing the migration db for the first time.
18+
# Ensure the local config split profile is detected and active.
19+
- exec: "drush cr"
20+
# Import any local config split profile overrides.
21+
- exec: "drush cim -y"
22+
name: nidirect
23+
nodejs_version: 20
24+
php_version: "8.2"
25+
timezone: Europe/London
26+
type: drupal
27+
webimage_extra_packages: ["libjpeg-dev", "make", "python3", "g++", "dh-autoreconf"]
28+
xdebug_enabled: false

.ddev/docker-compose.redis.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ddev-generated
2+
services:
3+
redis:
4+
container_name: ddev-${DDEV_SITENAME}-redis
5+
image: redis:6-bullseye
6+
# These labels ensure this service is discoverable by ddev.
7+
labels:
8+
com.ddev.site-name: ${DDEV_SITENAME}
9+
com.ddev.approot: $DDEV_APPROOT
10+
volumes:
11+
- ".:/mnt/ddev_config"
12+
- "ddev-global-cache:/mnt/ddev-global-cache"
13+
- "./redis:/usr/local/etc/redis"
14+
- "redis:/data"
15+
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
16+
17+
volumes:
18+
redis:

.ddev/docker-compose.solr.yaml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# DDEV Apache Solr recipe file.
2+
#ddev-generated
3+
#
4+
#
5+
# To use this in your own project:
6+
# 1. Copy this file to your project's ".ddev" directory.
7+
# 2. Create the folder path ".ddev/solr/conf".
8+
# 3. Copy the Solr configuration files for the appropriate plugin/module to
9+
# ".ddev/solr/conf". For example, using Drupal 8's Search API Solr module,
10+
# you'll get the config files as a file config.zip from
11+
# /admin/config/search/search-api/server/solr and unzip it into .ddev/solr/conf
12+
# so that a file exists with the path ".ddev/solr/conf/solrconfig.xml".
13+
#
14+
# To access Solr after it is installed:
15+
# - The Solr admin interface will be accessible at:
16+
# http://<projectname>.ddev.site:8983/solr/
17+
# For example, if the project is named "myproject" the hostname will be:
18+
# http://myproject.ddev.site:8983/solr/
19+
# - To access the Solr container from the web container use:
20+
# http://solr:8983/solr/
21+
# - A Solr core is automatically created with the name "dev" unless you
22+
# change that usage throughout. It can be
23+
# accessed at the URL: http://solr:8983/solr/dev (inside web container)
24+
# or at http://myproject.ddev.site:8983/solr/dev (on the host)
25+
26+
services:
27+
solr:
28+
# Name of container using standard ddev convention
29+
container_name: ddev-${DDEV_SITENAME}-solr
30+
# The solr docker image is at https://hub.docker.com/_/solr/
31+
# and code at https://github.com/docker-solr/docker-solr
32+
# README: https://github.com/docker-solr/docker-solr/blob/master/README.md
33+
# It's almost impossible to work with it if you don't read the docs there
34+
image: solr:8
35+
restart: "no"
36+
# Solr is served from this port inside the container.
37+
expose:
38+
- 8983
39+
# These labels ensure this service is discoverable by ddev.
40+
labels:
41+
com.ddev.site-name: ${DDEV_SITENAME}
42+
com.ddev.approot: $DDEV_APPROOT
43+
environment:
44+
# This defines the host name the service should be accessible from. This
45+
# will be sitename.ddev.site.
46+
- VIRTUAL_HOST=$DDEV_HOSTNAME
47+
# HTTP_EXPOSE exposes http traffic from the container port 8983
48+
# to the host port 8983 vid ddev-router reverse proxy.
49+
- HTTP_EXPOSE=8983:8983
50+
volumes:
51+
# solr core *data* is stored on the 'solr' docker volume
52+
# This mount is optional; without it your search index disappears
53+
# each time the ddev project is stopped and started.
54+
- solr:/var/solr
55+
56+
# This mounts the conf in .ddev/solr into the container where
57+
# the solr-precreate command in the entrypoint uses it as a one-time
58+
# configuration to copy config into the newly-created core. It is not
59+
# used if the core has previously been created.
60+
- ./solr:/solr-conf
61+
62+
- ".:/mnt/ddev_config"
63+
64+
# solr-configupdate.sh copies fresh configuration files into the
65+
# solr container on each
66+
# startup, so if you change the config in .ddev/solr/conf
67+
# it will be refreshed on `ddev start`. It must be executable,
68+
# `chmod +x solr
69+
- "./solr/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d"
70+
71+
# The odd need to use $$SOLR_CORENAME here is explained in
72+
# https://stackoverflow.com/a/48189916/215713
73+
entrypoint: 'bash -c "VERBOSE=yes docker-entrypoint.sh solr-precreate $${SOLR_CORENAME:-dev} /solr-conf"'
74+
75+
external_links:
76+
- "ddev-router:${DDEV_SITENAME}.${DDEV_TLD}"
77+
healthcheck:
78+
test: ["CMD-SHELL", "curl --fail -s localhost:8983/solr/"]
79+
80+
volumes:
81+
# solr is a persistent Docker volume for solr data
82+
solr:
83+
name: "ddev-${DDEV_SITENAME}_solr"

.ddev/php/local-php.ini

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[PHP]
2+
3+
; Globals
4+
error_reporting = E_ALL & ~E_DEPRECATED
5+
post_max_size = 200M
6+
memory_limit = 128M
7+
upload_max_filesize = 100M

.ddev/providers/nidirect.yaml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# NICS provider configuration.
2+
#
3+
# To use this provider you will need to add a personal Platform.sh token to your environment vars (.env)
4+
# The Key should be 'PLATFORMSH_CLI_TOKEN' and the token can be generated from 'My Profile' -> 'API Tokens'.
5+
#
6+
# Usage: ddev pull nidirect
7+
# This will take a snapshot of your current database and import both the Drupal and Migration databases.
8+
# Files will not be imported as the file system for Departmental is around 100GB.
9+
#
10+
11+
auth_command:
12+
command: |
13+
set -eu -o pipefail
14+
if [ -z "${PLATFORMSH_CLI_TOKEN:-}" ]; then echo "Please make sure you have set PLATFORMSH_CLI_TOKEN." && exit 1; fi
15+
if [ -z "${PLATFORM_PROJECT:-}" ]; then echo "Please make sure you have set PLATFORM_PROJECT." && exit 1; fi
16+
if [ -z "${PLATFORM_ENVIRONMENT:-}" ]; then echo "Please make sure you have set PLATFORM_ENVIRONMENT." && exit 1; fi
17+
18+
db_pull_command:
19+
command: |
20+
# set -x # You can enable bash debugging output by uncommenting.
21+
set -eu -o pipefail
22+
export PLATFORMSH_CLI_NO_INTERACTION=1
23+
ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible.
24+
25+
platform db:dump --yes ${PLATFORM_APP:+"--app=${PLATFORM_APP}"} --relationship=database --gzip --file=/var/www/html/.ddev/.downloads/db.sql.gz --project="${PLATFORM_PROJECT:-setme}" --environment="${PLATFORM_ENVIRONMENT:-setme}"
26+
echo "Downloaded db dump for database"
27+
28+
db_import_command:
29+
command: |
30+
set -eu -o pipefail
31+
# set -x # You can enable bash debugging output by uncommenting.
32+
ddev snapshot # Comment out to disable snapshots on import.
33+
gzip -dc .ddev/.downloads/db.sql.gz | ddev mysql db
34+
ddev drush cim -y
35+
ddev drush cr
36+
service: host
37+
38+
files_pull_command:
39+
command: |
40+
echo "Files will not be pulled due to filesize."
41+
42+
files_import_command:
43+
command: |
44+
echo "Files will not be imported due to filesize."

.ddev/redis/redis.conf

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Redis configuration.
2+
# #ddev-generated
3+
# Example configuration files for reference:
4+
# http://download.redis.io/redis-stable/redis.conf
5+
# http://download.redis.io/redis-stable/sentinel.conf
6+
7+
maxmemory 2048mb
8+
maxmemory-policy allkeys-lfu
9+
10+
# If you want to enable Redis persistence,
11+
# remove ddev-generated from this file,
12+
# and comment the two lines below:
13+
appendonly no
14+
save ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
// #ddev-generated
3+
use Drupal\Core\Installer\InstallerKernel;
4+
5+
if (!InstallerKernel::installationAttempted() && extension_loaded('redis') && class_exists('Drupal\redis\ClientFactory')) {
6+
// Set Redis as the default backend for any cache bin not otherwise specified.
7+
$settings['cache']['default'] = 'cache.backend.redis';
8+
$settings['redis.connection']['host'] = 'redis';
9+
$settings['redis.connection']['port'] = 6379;
10+
11+
// Apply changes to the container configuration to better leverage Redis.
12+
// This includes using Redis for the lock and flood control systems, as well
13+
// as the cache tag checksum. Alternatively, copy the contents of that file
14+
// to your project-specific services.yml file, modify as appropriate, and
15+
// remove this line.
16+
$settings['container_yamls'][] = 'modules/contrib/redis/example.services.yml';
17+
18+
// Allow the services to work before the Redis module itself is enabled.
19+
$settings['container_yamls'][] = 'modules/contrib/redis/redis.services.yml';
20+
21+
// Manually add the classloader path, this is required for the container cache bin definition below
22+
// and allows to use it without the redis module being enabled.
23+
$class_loader->addPsr4('Drupal\\redis\\', 'modules/contrib/redis/src');
24+
25+
// Use redis for container cache.
26+
// The container cache is used to load the container definition itself, and
27+
// thus any configuration stored in the container itself is not available
28+
// yet. These lines force the container cache to use Redis rather than the
29+
// default SQL cache.
30+
$settings['bootstrap_container_definition'] = [
31+
'parameters' => [],
32+
'services' => [
33+
'redis.factory' => [
34+
'class' => 'Drupal\redis\ClientFactory',
35+
],
36+
'cache.backend.redis' => [
37+
'class' => 'Drupal\redis\Cache\CacheBackendFactory',
38+
'arguments' => ['@redis.factory', '@cache_tags_provider.container', '@serialization.phpserialize'],
39+
],
40+
'cache.container' => [
41+
'class' => '\Drupal\redis\Cache\PhpRedis',
42+
'factory' => ['@cache.backend.redis', 'get'],
43+
'arguments' => ['container'],
44+
],
45+
'cache_tags_provider.container' => [
46+
'class' => 'Drupal\redis\Cache\RedisCacheTagsChecksum',
47+
'arguments' => ['@redis.factory'],
48+
],
49+
'serialization.phpserialize' => [
50+
'class' => 'Drupal\Component\Serialization\PhpSerialize',
51+
],
52+
],
53+
];
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
#ddev-generated
3+
set -e
4+
5+
if [[ $DDEV_PROJECT_TYPE != drupal* ]] || [[ $DDEV_PROJECT_TYPE =~ ^drupal(6|7)$ ]] ;
6+
then
7+
exit 0
8+
fi
9+
10+
if ( ddev debug configyaml 2>/dev/null | grep 'disable_settings_management:\s*true' >/dev/null 2>&1 ) ; then
11+
exit 0
12+
fi
13+
14+
cp redis/scripts/settings.ddev.redis.php $DDEV_APPROOT/$DDEV_DOCROOT/sites/default/
15+
16+
SETTINGS_FILE_NAME="${DDEV_APPROOT}/${DDEV_DOCROOT}/sites/default/settings.php"
17+
echo "Settings file name: ${SETTINGS_FILE_NAME}"
18+
grep -qF 'settings.ddev.redis.php' $SETTINGS_FILE_NAME || echo "
19+
// Include settings required for Redis cache.
20+
if ((file_exists(__DIR__ . '/settings.ddev.redis.php') && getenv('IS_DDEV_PROJECT') == 'true')) {
21+
include __DIR__ . '/settings.ddev.redis.php';
22+
}" >> $SETTINGS_FILE_NAME

.ddev/solr/Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ddev-generated
2+
FROM solr:9.6
3+
4+
# Fix HTTPS redirect to HTTP which breaks URL for Solr Admin UI.
5+
# The reason for this problem is that Solr uses Jetty as a webserver.
6+
# Jetty has X-Forwarded- headers disabled by default, enable them here:
7+
USER root
8+
RUN sed -i '/<!-- Uncomment to enable handling of X-Forwarded- style headers/,/-->/c\<Call name="addCustomizer"><Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg></Call>' /opt/solr/server/etc/jetty.xml
9+
USER solr
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)