Skip to content

Commit 526060d

Browse files
committed
Release 1.1.1
Merge branch 'main' into production
2 parents 0d10ab0 + fcbf8e4 commit 526060d

File tree

213 files changed

+11866
-247
lines changed

Some content is hidden

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

213 files changed

+11866
-247
lines changed

.ddev/config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ web_environment:
2424
- EXEC_GRUMPHP_COMMAND=ddev php
2525
- HASH_SALT=notsosecurehash
2626
- ELASTICSEARCH_HOST=elasticsearch
27+
- VARNISH_ADMIN_HOST=varnish
28+
- VARNISH_ADMIN_PORT=80
2729

2830
corepack_enable: false
2931
hooks:

.ddev/varnish/default.vcl

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
vcl 4.1;
33
import std;
44

5+
# Define an ACL for trusted purge clients
6+
acl purge {
7+
"127.0.0.1";
8+
"::1";
9+
"web";
10+
}
11+
512
backend default {
613
.host = "web";
714
.port = "80";
@@ -26,6 +33,57 @@ sub vcl_recv {
2633
if (std.port(server.ip) == 8025) {
2734
return (synth(750));
2835
}
36+
37+
# Handle PURGE requests for Drupal's varnish_purger module
38+
if (req.method == "PURGE") {
39+
# Allow PURGE requests from trusted clients only
40+
if (!client.ip ~ purge) {
41+
return (synth(403, "Access denied."));
42+
}
43+
44+
# Purge by Cache-Tags header
45+
if (req.http.Cache-Tags) {
46+
ban("obj.http.Cache-Tags ~ " + req.http.Cache-Tags);
47+
return (synth(200, "Purge executed."));
48+
}
49+
50+
# For URL-based purging
51+
return (hash);
52+
}
53+
54+
# Handle BAN requests for Drupal's cache tags
55+
if (req.method == "BAN") {
56+
# Allow BAN requests from trusted clients only
57+
if (!client.ip ~ purge) {
58+
return (synth(403, "Access denied."));
59+
}
60+
61+
# Ban by Cache-Tags header (sent by Drupal's varnish_purger module)
62+
if (req.http.Cache-Tags) {
63+
ban("obj.http.Cache-Tags ~ " + req.http.Cache-Tags);
64+
return (synth(200, "Ban added."));
65+
}
66+
67+
return (synth(403, "Invalid ban request"));
68+
}
69+
}
70+
71+
sub vcl_hit {
72+
if (req.method == "PURGE") {
73+
# We found the object in cache, now invalidate it
74+
set req.http.X-Purge-URL = req.url;
75+
set req.http.X-Purge-Host = req.http.host;
76+
return (synth(200, "Purged " + req.url));
77+
}
78+
}
79+
80+
sub vcl_miss {
81+
if (req.method == "PURGE") {
82+
# Object not in cache, but we still respond with a success
83+
set req.http.X-Purge-URL = req.url;
84+
set req.http.X-Purge-Host = req.http.host;
85+
return (synth(200, "Purged " + req.url + " (not in cache)"));
86+
}
2987
}
3088

3189
sub vcl_synth {
@@ -36,3 +94,10 @@ sub vcl_synth {
3694
return (deliver);
3795
}
3896
}
97+
98+
# Store the Cache-Tags header from backend responses
99+
sub vcl_backend_response {
100+
if (beresp.http.Cache-Tags) {
101+
set beresp.http.Cache-Tags = beresp.http.Cache-Tags;
102+
}
103+
}

.markdownlint.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default": true,
3+
"MD033": {
4+
"allowed_elements": ["details", "summary"]
5+
},
6+
"MD013": {
7+
"line_length": 300,
8+
"code_blocks": false,
9+
"tables": false,
10+
"headings": false
11+
},
12+
"MD032": false
13+
}

README.md

Lines changed: 150 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This project is a tailored fork of the popular [drupal-composer template](https:
55
## Getting started
66

77
1. **Create a new project repository**
8-
Click "[Use this template](https://github.com/wunderio/drupal-project/generate)" to generate a new project:
8+
Click "[Use this template](https://github.com/wunderio/drupal-project/generate)" to generate a new project:
99
- Select the correct owner.
1010
- Name the project as `client-COUNTRYCODE-CLIENT-PROJECT`.
1111
- Set the repository to private (unless the project is public).
@@ -77,20 +77,22 @@ This project supports two local development environments: DDEV (preferred) and L
7777
2. Ensure Docker is running on your system
7878
3. Start the environment and set up your project:
7979

80-
```bash
81-
# Start the DDEV environment
82-
ddev start
80+
```bash
81+
# Start the DDEV environment
82+
ddev start
8383

84-
# Authenticate SSH for database syncing
85-
ddev auth ssh
84+
# Authenticate SSH for database syncing
85+
ddev auth ssh
8686

87-
# Synchronize local database with a remote environment
88-
# See `scripts/syncdb.sh` for options
89-
ddev syncdb
87+
# Synchronize local database with a remote environment
88+
# See `scripts/syncdb.sh` for options
89+
ddev syncdb
9090

91-
# Get a one-time login link for admin access
92-
ddev drush uli
93-
```
91+
# Get a one-time login link for admin access
92+
drush uli
93+
```
94+
95+
Note: All commands in the DDEV section should be run within the DDEV environment using `ddev` prefix (e.g., `ddev drush uli`), or by using `ddev ssh` to access the container shell first.
9496

9597
#### DDEV services and access points
9698

@@ -141,9 +143,9 @@ For a complete list of all available services, URLs, and ports, use:
141143
1. Install [Lando](https://github.com/lando/lando/releases)
142144
2. Start the environment:
143145

144-
```bash
145-
lando start
146-
```
146+
```bash
147+
lando start
148+
```
147149

148150
#### Lando common commands
149151

@@ -160,6 +162,44 @@ For a complete list of all available services, URLs, and ports, use:
160162

161163
## Development tips
162164

165+
<details>
166+
<summary>Code quality tools</summary>
167+
168+
### Code quality tools
169+
170+
This project includes several tools to maintain code quality and consistency across the codebase.
171+
172+
#### Markdown Linting
173+
174+
Markdown files can be checked and automatically fixed using the following npm scripts:
175+
176+
```bash
177+
# Check markdown files for linting issues
178+
ddev npm run lint:md
179+
180+
# Automatically fix markdown linting issues where possible
181+
ddev npm run lint:md:fix
182+
```
183+
184+
Markdown linting rules are configured in `.markdownlint.json` at the project root.
185+
186+
#### JavaScript and CSS Linting
187+
188+
The project also includes linting for JavaScript and CSS files:
189+
190+
```bash
191+
# Check JavaScript files
192+
ddev npm run lint:js
193+
194+
# Check CSS/SCSS files
195+
ddev npm run lint:css
196+
197+
# Run all linting (JS, CSS, and Markdown)
198+
ddev npm run lint
199+
```
200+
201+
</details>
202+
163203
<details>
164204
<summary>Cursor AI Code Editor</summary>
165205

@@ -194,44 +234,106 @@ This project uses [Cursor](https://docs.cursor.com/) as the recommended AI-power
194234

195235
### Varnish and Purge configuration
196236

197-
1. **Enable Varnish:**
198-
- Uncomment the Varnish configuration in `.lando.yml` under `services → varnish` and `proxy → varnish`.
199-
- Run `lando rebuild -y`.
237+
This section describes how to set up Varnish caching and Purge functionality in your local development environment.
200238

201-
2. **Basic installation profile configuration:**
202-
- Install the `basic` profile: `lando drush si basic -y`.
203-
- This sets up Purge and Varnish Purge out of the box.
239+
Note: Drush commands in this section should be run with the appropriate environment prefix (`ddev` or `lando`).
204240

205-
3. **Configuration for installed sites:**
206-
- Enable the required modules:
241+
#### Configuration Overview
207242

208-
```bash
209-
lando drush en purge purge_drush purge_processor_lateruntime purge_queuer_coretags purge_tokens purge_ui varnish_purger varnish_purge_tags -y
210-
```
243+
The project includes ready-to-use Varnish configuration:
211244

212-
- Set a value for **Browser and proxy cache maximum age** in `admin/config/development/performance`.
213-
- Navigate to `/admin/config/development/performance/purge`, click **Add purger**, and select **Varnish Purger**:
214-
- **Name:** "Varnish Purger"
215-
- **Headers:** `Cache-Tags`: `[invalidation:expression]`
216-
- Save the configuration.
217-
- Export the configuration:
245+
1. **Configuration Import (Recommended)**
246+
- For existing projects, simply import the configuration from `config/sync`:
218247

219-
```bash
220-
lando drush cex -y
221-
```
248+
```bash
249+
drush cim -y
250+
```
251+
252+
- This applies all Purge and Varnish settings, including processors and purgers
253+
254+
2. **Manual Configuration (for new sites)**
255+
- If config/sync is not available, follow these steps:
256+
257+
a. **Install required modules**:
258+
259+
```bash
260+
drush en purge purge_drush purge_processor_lateruntime purge_queuer_coretags purge_tokens purge_ui varnish_purger varnish_purge_tags -y
261+
```
262+
263+
b. **Configure Varnish Purger**:
264+
- Set a value for **Browser and proxy cache maximum age** in `admin/config/development/performance`
265+
- Navigate to `/admin/config/development/performance/purge`
266+
- Click **Add purger** and select **Varnish Purger**:
267+
- **Name:** "Varnish Purger"
268+
- **Type:** "Tags"
269+
- **Request method:** "BAN" (important: use BAN instead of PURGE for compatibility with Silta)
270+
- **Headers:** `Cache-Tags`: `[invalidation:expression]`
271+
- Save the configuration
272+
273+
c. **Configure processors**:
274+
- Go to `/admin/config/development/performance/purge/processors`
275+
- Ensure these processors are enabled:
276+
- `drush_purge_invalidate` (for manual invalidation via Drush)
277+
- `lateruntime` (for batching invalidations)
278+
- `purge_ui_block_processor` (for admin UI functionality)
279+
280+
d. **Export the configuration**:
281+
282+
```bash
283+
drush cex -y
284+
```
285+
286+
e. **Update settings.php**:
287+
- Find the purger ID in `varnish_purger.settings.<PURGER_ID>.yml`
288+
- Update `web/sites/default/settings.php` with the correct purger ID:
289+
290+
```php
291+
if (getenv('VARNISH_ADMIN_HOST')) {
292+
$config['varnish_purger.settings.<PURGER_ID>']['hostname'] = trim(getenv('VARNISH_ADMIN_HOST'));
293+
$config['varnish_purger.settings.<PURGER_ID>']['port'] = getenv('VARNISH_ADMIN_PORT') ? trim(getenv('VARNISH_ADMIN_PORT')) : '80';
294+
}
295+
```
296+
297+
#### Environment-Specific Setup
298+
299+
##### DDEV (Recommended)
300+
301+
1. **Varnish Configuration**: DDEV comes pre-configured with Varnish in `.ddev` folder.
302+
303+
2. **Testing Configuration**:
304+
305+
```bash
306+
ddev drush cr
307+
ddev exec curl -X BAN -H "Cache-Tags: config:system.performance" http://varnish
308+
```
309+
310+
If working correctly, you should receive a "200 Ban added" response
311+
312+
3. **Viewing Varnish logs**:
313+
314+
```bash
315+
ddev exec -s varnish varnishlog -i BAN -i Cache
316+
```
317+
318+
##### Lando
319+
320+
1. **Enable Varnish**:
321+
- Varnish configuration is already enabled in `.lando.yml` & `.lando/varnish.vcl`.
322+
323+
2. **Testing Configuration**:
324+
325+
```bash
326+
lando drush cr
327+
lando ssh -c "curl -X BAN -H 'Cache-Tags: config:system.performance' http://varnish"
328+
```
222329
223-
- Find the purger ID in the exported `varnish_purger.settings.<PURGER_ID>.yml` file.
224-
- Update `web/sites/default/settings.php`:
225-
- Replace all occurrences of `varnish_purger.settings.<OLD_ID>` with the new purger ID.
226-
- Clear the cache:
330+
### Important Notes
227331
228-
```bash
229-
lando drush cr
230-
```
332+
- **BAN vs PURGE Method:** Always use the "BAN" method in the Varnish purger configuration instead of "PURGE". The Silta Varnish configuration is set up to handle BAN requests but may reject PURGE requests with "405 Method Not Allowed" errors.
231333
232-
Varnish should now be configured to handle caching and purging when content is updated.
334+
- **Processors:** The default Purge setup uses the `purge_processor_lateruntime` module, which empties the purge queue during page requests. This works well for most sites needing immediate cache clearing. Ensure all required processors are enabled.
233335
234-
**Note:** The default Purge setup uses the `purge_processor_lateruntime` module, which empties the purge queue during page requests. This works well for most sites needing immediate cache clearing.
336+
- **Cache Tags:** The Varnish configuration is set up to handle cache tag invalidation with the `Cache-Tags` header.
235337
</details>
236338
237339
<details>
@@ -243,11 +345,11 @@ The [PHPUnit](https://phpunit.de/) test framework is predefined in this project.
243345
244346
#### Testing examples
245347
246-
Use `lando phpunit` to run PHPUnit commands:
348+
Note: Run these commands with the appropriate environment prefix (`ddev phpunit` or `lando phpunit`).
247349
248-
- Run one test class: `lando phpunit path/to/your/class/file.php`
249-
- List groups: `lando phpunit --list-groups`
250-
- Run all tests in a particular group: `lando phpunit --group Groupname`
350+
- Run one test class: `phpunit path/to/your/class/file.php`
351+
- List groups: `phpunit --list-groups`
352+
- Run all tests in a particular group: `phpunit --group Groupname`
251353
</details>
252354
253355
### Secrets handling
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_core:
2+
default_config_hash: jvTSppzcgH5wnzBhX5xnAExcp2I1CzkQ_aky65XNfYI
3+
menu_depth: 4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
_core:
2+
default_config_hash: WgdZsrd_5w9jlmcHV4R9dD2tG9OZEkYo4I_O8h7Gq8Q
13
max_bundle_number: 20
24
hoverintent_functionality: true
35
show_local_tasks: false
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_core:
2+
default_config_hash: 0G5pZBcxbg8ONYzNLd1RJIsvuFFewm9htnS4I-ABKJ8
3+
max_age: 86400
4+
cron_interval: 21600
5+
limit: 10
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
_core:
2+
default_config_hash: fUksROt4FfkAU9BV4hV2XvhTBSS2nTNrZS4U7S-tKrs
3+
interval: 10800
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
uuid: 651e07ca-4570-40dd-8a7b-672eda40beba
12
langcode: en
23
status: true
34
dependencies:
45
module:
56
- system
67
theme:
78
- claro
9+
_core:
10+
default_config_hash: NjcxOBrPOiK5-38t56DwFBDVY4yer7YSlbRWXFuHe7A
811
id: claro_breadcrumbs
912
theme: claro
1013
region: breadcrumb

0 commit comments

Comments
 (0)