Skip to content

Commit fc9bccc

Browse files
authored
Merge pull request #346 from itk-dev/feature/d-10
Drupal 10
2 parents 065762c + 9d1700a commit fc9bccc

File tree

200 files changed

+4693
-5846
lines changed

Some content is hidden

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

200 files changed

+4693
-5846
lines changed

.docker/vhost.conf

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ server {
3333
}
3434

3535
# Block access to "hidden" files and directories whose names begin with a
36-
# period. This includes directories used by version control systems such
37-
# as Subversion or Git to store control files.
36+
# period.
3837
location ~ (^|/)\. {
3938
return 403;
4039
}
@@ -44,7 +43,7 @@ server {
4443
}
4544

4645
location @rewrite {
47-
rewrite ^/(.*)$ /index.php?q=$1;
46+
rewrite ^ /index.php;
4847
}
4948

5049
# Don't allow direct access to PHP files in the vendor directory.
@@ -53,13 +52,23 @@ server {
5352
return 404;
5453
}
5554

55+
# Protect files and directories from prying eyes.
56+
location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|.tar|.gz|.bz2|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ {
57+
deny all;
58+
return 404;
59+
}
60+
5661
location ~ '\.php$|^/update.php' {
62+
include fastcgi_params;
63+
5764
fastcgi_buffers 16 32k;
5865
fastcgi_buffer_size 64k;
5966
fastcgi_busy_buffers_size 64k;
6067

6168
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
62-
include fastcgi_params;
69+
70+
# Ensure the php file exists. Mitigates CVE-2019-11043
71+
try_files $fastcgi_script_name =404;
6372

6473
fastcgi_param HTTP_PROXY "";
6574
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
@@ -70,30 +79,12 @@ server {
7079
fastcgi_pass phpfpm:9000;
7180
}
7281

73-
location ~ ^/sites/.*/files/styles/ {
74-
try_files $uri @rewrite;
75-
}
76-
77-
# Handle private files through Drupal. Private file's path can come
78-
# with a language prefix.
79-
location ~ ^(/[a-z\-]+)?/system/files/ {
80-
try_files $uri /index.php?$query_string;
81-
}
82-
83-
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
84-
try_files $uri @rewrite;
85-
expires max;
86-
log_not_found off;
87-
}
88-
8982
# Enforce clean URLs
90-
# Removes index.php from urls like:
91-
# www.example.com/index.php/my-page --> www.example.com/my-page
9283
#
84+
# Removes index.php from urls like www.example.com/index.php/my-page --> www.example.com/my-page
9385
# Could be done with 301 for permanent or other redirect codes.
94-
absolute_redirect off;
9586
if ($request_uri ~* "^(.*/)index\.php/(.*)") {
96-
return 301 /$2;
87+
return 307 $1$2;
9788
}
9889

9990
error_log /dev/stderr;

.github/workflows/docker-image.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Setup PHP, with composer and extensions
1212
uses: shivammathur/setup-php@v2
1313
with:
14-
php-version: 7.4
14+
php-version: 8.2
1515
extensions: dom, zip
1616
coverage: none
1717
tools: composer:v2

.github/workflows/pr.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- name: Setup PHP, with composer and extensions
1010
uses: shivammathur/setup-php@v2
1111
with:
12-
php-version: 8.1
12+
php-version: 8.2
1313
extensions: ctype, dom, iconv, json, zip, gd, soap
1414
coverage: none
1515
tools: composer:v2
@@ -35,7 +35,7 @@ jobs:
3535
- name: Setup PHP, with composer and extensions
3636
uses: shivammathur/setup-php@v2
3737
with:
38-
php-version: 8.1
38+
php-version: 8.2
3939
extensions: ctype, dom, iconv, json, zip, gd, soap
4040
coverage: none
4141
tools: composer:v2
@@ -51,10 +51,7 @@ jobs:
5151
restore-keys: ${{ runner.os }}-composer-
5252
- name: Install Dependencies
5353
run: |
54-
# Using `--no-scripts` breaks something with mglaman/drupal-check.
5554
composer install --no-interaction --no-progress
56-
# @see https://github.com/Dealerdirect/phpcodesniffer-composer-installer#calling-the-plugin-directly
57-
composer run-script install-codestandards
5855
- name: PHPCS
5956
run: |
6057
composer coding-standards-check
@@ -98,7 +95,7 @@ jobs:
9895
- name: Setup PHP, with composer and extensions
9996
uses: shivammathur/setup-php@v2
10097
with:
101-
php-version: 8.1
98+
php-version: 8.2
10299
extensions: ctype, dom, iconv, json, zip, gd, soap
103100
coverage: none
104101
tools: composer:v2
@@ -168,7 +165,7 @@ jobs:
168165
- name: Setup PHP, with composer and extensions
169166
uses: shivammathur/setup-php@v2
170167
with:
171-
php-version: 8.1
168+
php-version: 8.2
172169
extensions: ctype, dom, iconv, json, zip, gd, soap
173170
coverage: none
174171
tools: composer:v2

.gitignore

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@
129129
/web/sites/*/*settings*.php
130130
/web/sites/*/*services*.yml
131131

132+
# We want all custom site settings in settings.local.php, so we don't ignore settings.php.
133+
!/web/sites/*/settings.php
134+
132135
# Ignore paths that may contain user-generated content
133136
/web/sites/*/files
134137
/web/sites/*/public
@@ -183,10 +186,6 @@
183186

184187
# ------------------------------------------------------------------------------
185188

186-
# We want all custom site settings in settings.local.php
187-
/web/sites/*/settings.local.php
188-
!/web/sites/*/settings.php
189-
190189
# Ignore PhpStorm
191190
.idea
192191

@@ -199,4 +198,6 @@ node_modules/
199198
yarn-error.log
200199

201200
# Ignore DS store
202-
.DS_Store
201+
.DS_Store
202+
203+
.env*.local

README.md

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,34 @@
1010
OS2loop is a question-answering system built on Drupal 9. See [os2.eu/produkt/os2loop](https://os2.eu/produkt/os2loop)
1111
(in Danish) for more information.
1212

13+
## Upgrading to Drupal 10
14+
15+
Upgrading to [Drupal 10](https://www.drupal.org/about/10) is a two-step process:
16+
first the site must be prepared for the upgrade ([tag:
17+
d-10-prepare](/releases/tag/d-10-prepare)) and then the actual upgrade must be
18+
performed.
19+
20+
```sh
21+
# Backup the database
22+
23+
# Prepare for the upgrade
24+
git checkout d-10-prepare
25+
composer install --no-dev --optimize-autoloader
26+
vendor/bin/drush --yes pm:uninstall samlauth
27+
vendor/bin/drush --yes deploy
28+
vendor/bin/drush --yes locale:update
29+
vendor/bin/drush --yes cache:rebuild
30+
31+
# Check that site still works
32+
33+
# Upgrade to Drupal 10
34+
git checkout «release tag»
35+
composer install --no-dev --optimize-autoloader
36+
vendor/bin/drush --yes deploy
37+
vendor/bin/drush --yes locale:update
38+
vendor/bin/drush --yes cache:rebuild
39+
```
40+
1341
## Installation
1442

1543
### Production
@@ -54,14 +82,15 @@ modules.
5482

5583
See [docs/development](docs/development/README.md) for details on development.
5684

85+
[Install Task](https://taskfile.dev/installation/) and run
86+
5787
```sh
58-
docker compose up --detach
59-
docker compose exec phpfpm composer install
60-
docker compose exec phpfpm vendor/bin/drush --yes site:install os2loop --existing-config
88+
task dev:up
89+
task dev:install-site --yes
6190
# Get the site url
6291
echo "http://$(docker compose port nginx 8080)"
6392
# Get admin sign in url
64-
docker compose exec phpfpm vendor/bin/drush --yes --uri="http://$(docker compose port nginx 8080)" user:login
93+
task dev:drush -- --yes --uri="http://$(docker compose port nginx 8080)" user:login
6594
```
6695

6796
### Modules
@@ -100,11 +129,11 @@ docker compose exec phpfpm vendor/bin/drush --yes pm:enable entity_reference_int
100129
## Updates
101130

102131
```sh
103-
composer install --no-dev --optimize-autoloader
104-
vendor/bin/drush --yes updatedb
105-
vendor/bin/drush --yes config:import
106-
vendor/bin/drush --yes locale:update
107-
vendor/bin/drush --yes cache:rebuild
132+
docker compose exec phpfpm composer install --no-dev --optimize-autoloader
133+
docker compose exec phpfpm vendor/bin/drush --yes updatedb
134+
docker compose exec phpfpm vendor/bin/drush --yes config:import
135+
docker compose exec phpfpm vendor/bin/drush --yes locale:update
136+
docker compose exec phpfpm vendor/bin/drush --yes cache:rebuild
108137
```
109138

110139
## Translations
@@ -132,14 +161,14 @@ for further details.
132161
## Coding standards
133162

134163
```sh
135-
composer coding-standards-check
136-
composer coding-standards-apply
164+
docker compose exec phpfpm composer coding-standards-check
165+
docker compose exec phpfpm composer coding-standards-apply
137166
```
138167

139168
```sh
140-
docker run --rm --volume ${PWD}:/app --workdir /app node:16 yarn install
141-
docker run --rm --volume ${PWD}:/app --workdir /app node:16 yarn coding-standards-check
142-
docker run --rm --volume ${PWD}:/app --workdir /app node:16 yarn coding-standards-apply
169+
docker compose run --rm node yarn install
170+
docker compose run --rm node yarn coding-standards-check
171+
docker compose run --rm node yarn coding-standards-apply
143172
```
144173

145174
### GitHub Actions
@@ -163,18 +192,16 @@ act -P ubuntu-latest=shivammathur/node:focal pull_request
163192
To run only twigcs:
164193

165194
```sh
166-
composer coding-standards-check/twigcs
195+
docker compose exec phpfpm composer coding-standards-check/twigcs
167196
```
168197

169198
But this is also a part of
170199

171200
```sh
172-
composer coding-standards-check
201+
docker compose exec phpfpm composer coding-standards-check
173202
```
174203

175-
## Build assets
204+
## Build theme assets
176205

177-
```sh
178-
docker run --rm --volume ${PWD}:/app --workdir /app node:16 yarn install
179-
docker run --rm --volume ${PWD}:/app --workdir /app node:16 yarn encore dev
180-
```
206+
See
207+
[os2loop_theme/README.md](web/profiles/custom/os2loop/themes/os2loop_theme/README.md).

Taskfile.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: '3'
2+
3+
dotenv:
4+
- '.env.docker.local'
5+
6+
includes:
7+
dev:
8+
taskfile: task/
9+
10+
server:
11+
taskfile: task/
12+
vars:
13+
DOCKER_COMPOSE: itkdev-docker-compose-server

0 commit comments

Comments
 (0)