-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.platform.app.yaml
225 lines (199 loc) · 6.46 KB
/
.platform.app.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# This file describes an application. You can have multiple applications
# in the same project.
#
# See https://docs.platform.sh/user_guide/reference/platform-app-yaml.html
# The name of this app. Must be unique within a project.
name: 'dept'
# The runtime the application uses.
type: 'php:8.3'
variables:
php:
memory_limit: "256M"
opcache.interned_strings_buffer: "32"
opcache.max_accelerated_files: "10000"
opcache.memory_consumption: "256"
opcache.enable_file_override: "1"
zend.detect_unicode: "Off"
xdebug.mode: "debug"
display_startup_errors: "off"
date.timezone: "Europe/Dublin"
realpath_cache_ttl: 3600
realpath_cache_size: 512k
dependencies:
php:
composer/composer: '^2'
runtime:
# Enable the redis extension so Drupal can communicate with the Redis cache.
extensions:
- apcu
- redis
- blackfire
xdebug:
idekey: PHPSTORM
# The relationships of the application with services or other applications.
#
# The left-hand side is the name of the relationship as it will be exposed
# to the application in the PLATFORM_RELATIONSHIPS variable. The right-hand
# side is in the form `:`.
relationships:
solr: 'solr_8_11:solr'
redis: "redis:redis"
# For MariaDB, the endpoint does not change whether you used the mysql or mariadb service type.
database: 'db:dept'
# The size of the persistent disk of the application (in MB).
disk: 137216
# The 'mounts' describe writable, persistent filesystem mounts in the application.
mounts:
'/web/sites/default/files':
source: local
source_path: 'files'
'/web/.well-known':
source: local
source_path: well-known
'/tmp':
source: local
source_path: 'tmp'
'/private':
source: local
source_path: 'private'
'/imports':
source: local
source_path: 'imports'
'/log':
source: local
source_path: 'log'
'/.drush':
source: local
source_path: 'drush'
'/drush-backups':
source: local
source_path: 'drush-backups'
'/.console':
source: local
source_path: 'console'
# Configuration of the build of this application.
build:
flavor: composer
# The hooks executed at various points in the lifecycle of the application.
hooks:
build: |
set -e
echo ">>> Replace vanilla CKEditor config with a custom one to fix the click/drag bug with embedded entities"
git clone https://github.com/dof-dss/ckeditor4-fix-widget-dnd.git
rm -rf web/core/assets/vendor/ckeditor
mv ckeditor4-fix-widget-dnd/build/ckeditor web/core/assets/vendor/ckeditor
rm -rf ckeditor4-fix-widget-dnd
echo ">>> Install Platform CLI tool"
curl -fsSL https://raw.githubusercontent.com/platformsh/cli/main/installer.sh | bash
echo "Update robots.txt with customisations"
cp -f robots_custom.txt web/robots.txt
echo "Add AI bots to robots.txt"
bash /app/platformsh-tools/add_ai_bots_to_robots_txt.sh
# The deploy hook runs after your application has been deployed and started.
deploy: |
set -e
php ./drush/platformsh_generate_drush_yml.php
cd web
# Rebuild caches, run db-updates and import config.
../vendor/bin/drush -y cache-rebuild
../vendor/bin/drush -y updatedb
# General config import
../vendor/bin/drush -y config-import
# Final cache rebuild.
../vendor/bin/drush -y cache-rebuild
post_deploy: |
set -e
echo "***** Creating QA accounts ******"
cd /app/web
if [[ $QA_USERNAMES ]]; then
echo "$QA_USERNAMES" | tr ',' '\n' | while read username; do
echo $item
../vendor/bin/drush ucrt $username --password=$QA_PASSWORD
../vendor/bin/drush urol administrator $username
done
fi
echo "***** Reset QA Account passwords ******"
cd /app/web
../vendor/bin/drush password_qa_accounts
# Temp fix as the config is not always updated on Edge.
../vendor/bin/drush cim -y
# The configuration of app when it is exposed to the web.
web:
# Specific parameters for different URL prefixes.
locations:
'/':
# The folder from which to serve static assets, for this location.
#
# This is a filesystem path, relative to the application root.
root: 'web'
# How long to allow static assets from this location to be cached.
#
# Can be a time in seconds, or -1 for no caching. Times can be
# suffixed with "s" (seconds), "m" (minutes), "h" (hours), "d"
# (days), "w" (weeks), "M" (months, as 30 days) or "y" (years, as
# 365 days).
expires: 5m
# Whether to forward disallowed and missing resources from this
# location to the application.
#
# Can be true, false or a URI path string.
passthru: '/index.php'
# Deny access to static files in this location.
allow: false
# Rules for specific URI patterns.
rules:
# Allow access to common static files.
'\.(jpe?g|png|gif|svgz?|css|js|map|ico|bmp|eot|woff2?|otf|ttf)$':
allow: true
expires: 2w
'^/robots\.txt$':
allow: true
'^/sitemap\.xml$':
allow: true
'^\/themes\/custom\/.+\/favicons\/.+\.webmanifest$':
allow: true
expires: 2w
'^/\.well-known/security\.txt$':
allow: true
# Deny direct access to configuration files.
'^/sites/sites\.php$':
scripts: false
'^/sites/[^/]+/settings.*?\.php$':
scripts: false
'/sites/default/files':
# Allow access to all files in the public files directory.
allow: true
expires: 1d
passthru: '/index.php'
root: 'web/sites/default/files'
# Do not execute PHP scripts.
scripts: false
rules:
# Allow a longer Fastly TTL for publication files
'^/sites/default/files/publications/':
headers:
Surrogate-Control: max-age=31536000
# Provide a longer TTL (2 weeks) for aggregated CSS and JS files.
'^/sites/default/files/(css|js)':
expires: 2w
# Provide a longer TTL (2 weeks) for Drupal image files.
'^/sites/default/files/styles/[^\.]+\.(jpe?g|png|gif|svgz?)$':
expires: 2w
# Cron jobs.
crons:
autoban:
spec: '*/13 * * * *'
commands:
start: /app/platformsh-tools/autoban_in_fastly.sh
shutdown_timeout: 31
daily_edge_solr_reindex:
spec: '0 6 * * 0-5'
cmd: './reindex-edge-solr.sh'
drupal:
spec: '*/15 * * * *'
cmd: 'vendor/bin/drush cron'
logging:
spec: '*/5 * * * *'
commands:
start: '/bin/bash /app/cronjob.sh'
shutdown_timeout: 290