This repository has been archived by the owner on Nov 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.platform.app.yaml
174 lines (150 loc) · 5.14 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
# 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: 'unity'
# The runtime the application uses.
type: 'php:7.4'
dependencies:
php:
composer/composer: '^2'
runtime:
# Enable the redis extension so Drupal can communicate with the Redis cache.
extensions:
- apcu
- redis
# 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:
#uregni_solr: 'solr:uregni'
# The size of the persistent disk of the application (in MB).
disk: 30720
# The 'mounts' describe writable, persistent filesystem mounts in the application.
mounts:
'/web/files':
source: local
source_path: 'files'
'/tmp':
source: local
source_path: 'tmp'
'/private':
source: local
source_path: 'private'
'/.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
# During post_deploy the sites are available (see https://docs.platform.sh/configuration/app/hooks.html)
post_deploy: |
set -e
# Save the Fastly service value and overwrite with a dummy one in order to break
# the connection to Fastly, otherwise any cache clear of any site will purge the
# entire Fastly cache - we don't want this to happen as we'd like Fastly to continue
# serving the sites to anonymous users during a release.
echo "***** Breaking connection to Fastly ******"
temp=$FASTLY_API_SERVICE
export FASTLY_API_SERVICE=dummyservice
# For each multi site - run db-updates and import config.
for site in ADD SITE NAMES HERE
do
echo "****** $site deployment ******"
cd /app/web/sites/$site
# Disable Fastly logging
drush disable-fastly-logging
# Readonlymode module should be installed on all sites,
# but we'll just make sure.
drush en readonlymode -l $site -y
# Set site to readonly just in case editors are logged on.
drush -l $site cset readonlymode.settings enabled 1 -y
drush -l $site -y cache-rebuild
drush -l $site -y config-import
drush -l $site -y updatedb
drush -l $site import-all-if-installed safe
# Turn off readonly mode.
drush -l $site cset readonlymode.settings enabled 0 -y
done
# Reconnect to Fastly
echo "***** Reinstate connection to Fastly ******"
export FASTLY_API_SERVICE=$temp
# For each multi site - clear cache (including Fastly cache)
for site in ADD SITE NAMES HERE
do
echo "****** $site cache clear ******"
cd /app/web/sites/$site
drush -l $site -y cache-rebuild
# Enable Fastly logging
drush enable-fastly-logging
done
# 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
'^/robots\.txt$':
allow: true
'^/sitemap\.xml$':
allow: true
'^\/sites\/.+\/themes\/.+\/images\/favicons\/.+\.webmanifest$':
allow: true
expires: 2w
# Deny direct access to configuration files.
'^/sites/sites\.php$':
scripts: false
'^/sites/[^/]+/settings.*?\.php$':
scripts: false
'/files':
# Allow access to all files in the public files directory.
allow: true
expires: 1d
passthru: '/index.php'
root: 'web/files'
# Do not execute PHP scripts.
scripts: false
rules:
# Provide a longer TTL (2 weeks) for aggregated CSS and JS files.
'^/sites/default/files/(css|js)':
expires: 2w
# The configuration of scheduled execution.
crons:
boundarycommission:
spec: '10 * * * *'
cmd: 'cd web/sites/uregni ; drush core-cron'