Skip to content

Commit 95d5c2b

Browse files
authored
examples/stacks/drupal: fix for local (#1801)
1 parent 8ee393e commit 95d5c2b

20 files changed

+1795
-1865
lines changed

examples/stacks/drupal/composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
],
1717
"require": {
1818
"composer/installers": "^1.9",
19-
"drupal/core-composer-scaffold": "^9.4",
20-
"drupal/core-project-message": "^9.4",
21-
"drupal/core-recommended": "^9.4",
22-
"drush/drush": "^11.3"
19+
"drupal/core-composer-scaffold": "^10.2",
20+
"drupal/core-project-message": "^10.2",
21+
"drupal/core-recommended": "^10.2",
22+
"drush/drush": "^12.4"
2323
},
2424
"conflict": {
2525
"drupal/drupal": "*"

examples/stacks/drupal/composer.lock

Lines changed: 1629 additions & 1783 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../web

examples/stacks/drupal/devbox.d/web/index.html

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/stacks/drupal/devbox.json

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
{
2-
"packages": [
3-
"git@latest",
4-
5-
"php81Packages.composer@latest",
6-
"mariadb@latest",
7-
"nginx@latest"
8-
],
2+
"packages": {
3+
"git": "latest",
4+
"php": "8.1",
5+
"php81Packages.composer": "latest",
6+
"mariadb": "latest",
7+
"nginx": "latest",
8+
"curl": {
9+
"version": "latest",
10+
"outputs": ["bin"]
11+
}
12+
},
13+
"env": {
14+
"MYSQL_UNIX_PORT": "/tmp/devbox/mariadb/run/mysql.sock"
15+
},
916
"shell": {
1017
"init_hook": [],
1118
"scripts": {
1219
"run_test": [
13-
"mkdir -p /tmp/devbox/mariadb/run",
14-
"export MYSQL_UNIX_PORT=/tmp/devbox/mariadb/run/mysql.sock",
20+
"mkdir -p -m 0755 \"$(dirname \"$MYSQL_UNIX_PORT\")\"",
21+
"ls -la .devbox .devbox/virtenv .devbox/virtenv/mariadb .devbox/virtenv/mariadb/data || true",
1522
"devbox services up -b",
16-
"echo 'Waiting for services to start' && sleep 2",
23+
"echo 'Waiting for services to start' && sleep 5",
1724
"./install-drupal.sh",
18-
"curl localhost:8000",
25+
"curl localhost:8081",
1926
"devbox services stop"
2027
]
2128
}

examples/stacks/drupal/devbox.lock

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
{
22
"lockfile_version": "1",
33
"packages": {
4+
"curl@latest": {
5+
"last_modified": "2024-02-08T11:55:47Z",
6+
"resolved": "github:NixOS/nixpkgs/c0b7a892fb042ede583bdaecbbdc804acb85eabe#curl",
7+
"source": "devbox-search",
8+
"version": "8.5.0",
9+
"systems": {
10+
"aarch64-darwin": {
11+
"store_path": "/nix/store/d785m1nyahmrn9bczvqvvlc877gj18zj-curl-8.5.0-bin"
12+
},
13+
"aarch64-linux": {
14+
"store_path": "/nix/store/sd6baacv8sk7nfrfhs66nw52s5i1r097-curl-8.5.0-bin"
15+
},
16+
"x86_64-darwin": {
17+
"store_path": "/nix/store/1zia3iiqlg684043gn34pcz4psbzflk3-curl-8.5.0-bin"
18+
},
19+
"x86_64-linux": {
20+
"store_path": "/nix/store/j1yhiywlyh13ayzx46lzh7h1y7cq9p9c-curl-8.5.0-bin"
21+
}
22+
}
23+
},
424
"git@latest": {
525
"last_modified": "2023-08-30T00:25:28Z",
626
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#git",
@@ -23,7 +43,7 @@
2343
},
2444
"mariadb@latest": {
2545
"last_modified": "2023-08-30T00:25:28Z",
26-
"plugin_version": "0.0.2",
46+
"plugin_version": "0.0.4",
2747
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#mariadb_110",
2848
"source": "devbox-search",
2949
"version": "11.0.3",
@@ -44,7 +64,7 @@
4464
},
4565
"nginx@latest": {
4666
"last_modified": "2023-09-04T16:24:30Z",
47-
"plugin_version": "0.0.3",
67+
"plugin_version": "0.0.4",
4868
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#nginx",
4969
"source": "devbox-search",
5070
"version": "1.24.0",
@@ -85,7 +105,7 @@
85105
},
86106
87107
"last_modified": "2023-09-04T16:24:30Z",
88-
"plugin_version": "0.0.2",
108+
"plugin_version": "0.0.3",
89109
"resolved": "github:NixOS/nixpkgs/3c15feef7770eb5500a4b8792623e2d6f598c9c1#php81",
90110
"source": "devbox-search",
91111
"version": "8.1.23",

examples/stacks/drupal/install-drupal.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ mysql -u root < setup_db.sql
88
composer install
99

1010
echo "Your Drupal demo website is ready,"
11-
echo "Open localhost:8000 in your browser."
11+
echo "Open localhost:8081 in your browser."

examples/stacks/drupal/setup_db.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ USE devbox_drupal
88
CREATE USER IF NOT EXISTS 'devbox_user'@'localhost' IDENTIFIED BY 'password';
99
GRANT ALL PRIVILEGES ON devbox_drupal.* TO 'devbox_user'@'localhost' IDENTIFIED BY 'password';
1010

11-
-- Connect in drupal using:
11+
-- Connect in drupal using:
1212
-- Database: devbox_drupal
1313
-- User: devbox_user
1414
-- Password: password
1515
-- Host: 127.0.0.1
1616
-- Port: 3306
17-

examples/stacks/drupal/web/.ht.router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// Work around the PHP bug.
4040
$path = $url['path'];
4141
$script = 'index.php';
42-
if (strpos($path, '.php') !== FALSE) {
42+
if (str_contains($path, '.php')) {
4343
// Work backwards through the path to check if a script exists. Otherwise
4444
// fallback to index.php.
4545
do {

examples/stacks/drupal/web/.htaccess

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ AddEncoding gzip svgz
2626
# sites/default/default.settings.php and
2727
# Drupal\Core\DrupalKernel::bootEnvironment() for settings that can be
2828
# changed at runtime.
29-
30-
# PHP 7, Apache 1 and 2.
31-
<IfModule mod_php7.c>
32-
php_value assert.active 0
33-
</IfModule>
34-
35-
# PHP 8, Apache 1 and 2.
3629
<IfModule mod_php.c>
3730
php_value assert.active 0
3831
</IfModule>
@@ -42,8 +35,8 @@ AddEncoding gzip svgz
4235
# Enable expirations.
4336
ExpiresActive On
4437

45-
# Cache all files and redirects for 2 weeks after access (A).
46-
ExpiresDefault A1209600
38+
# Cache all files for 1 year after access.
39+
ExpiresDefault "access plus 1 year"
4740

4841
<FilesMatch \.php$>
4942
# Do not allow PHP scripts to be cached unless they explicitly send cache
@@ -180,7 +173,13 @@ AddEncoding gzip svgz
180173

181174
# Various header fixes.
182175
<IfModule mod_headers.c>
183-
# Disable content sniffing, since it's an attack vector.
176+
# Disable content sniffing for all responses, since it's an attack vector.
177+
# This header is also set in FinishResponseSubscriber, which depending on
178+
# Apache configuration might get placed in the 'onsuccess' table. To prevent
179+
# header duplication, unset that one prior to setting in the 'always' table.
180+
# See "To circumvent this limitation..." in
181+
# https://httpd.apache.org/docs/current/mod/mod_headers.html.
182+
Header onsuccess unset X-Content-Type-Options
184183
Header always set X-Content-Type-Options nosniff
185184
# Disable Proxy header, since it's an attack vector.
186185
RequestHeader unset Proxy

0 commit comments

Comments
 (0)