forked from platformsh-templates/magento2ce
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.platform.app.yaml
132 lines (121 loc) · 4.44 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
# 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: app
# The runtime the application uses.
type: php:8.3
# Specify additional PHP extensions that should be loaded.
runtime:
extensions:
- xsl
- sodium
- redis
# Configuration of the build of this application.
build:
flavor: none
dependencies:
php:
composer/composer: '^2'
# 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 `<service name>:<endpoint name>`.
relationships:
database: db:mysql
redis: cache:redis
redis-session: session:redis
opensearch: indexer:opensearch
rabbitmq: queue:rabbitmq
# The size of the persistent disk of the application (in MB).
disk: 2048
# The 'mounts' describe writable, persistent filesystem mounts in the application.
mounts:
"/var":
source: local
source_path: "var"
"/app/etc":
source: local
source_path: "etc"
"/pub/media":
source: local
source_path: "media"
"/pub/static":
source: local
source_path: "static"
# The hooks executed at various points in the lifecycle of the application.
hooks:
build: |
set -e
if [ "${COMPOSER_AUTH#*"repo.magento.com"}" = "$COMPOSER_AUTH" ]
then
printf "\n!!!\n Please configure your COMPOSER_AUTH enviromental variable as per the README file \n!!!\n"
exit 1
fi
#prep node as per https://experienceleague.adobe.com/en/docs/commerce-knowledge-base/kb/how-to/configure-npm-to-be-able-to-use-pwa-studio
unset NPM_CONFIG_PREFIX
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | sed 's/curl --/curl --retry 5 --/g' | bash
export NVM_DIR="$PLATFORM_APP_DIR/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm current
nvm install 18
#install php application
composer install --no-dev --no-interaction
php ./vendor/bin/ece-tools build:generate
php ./vendor/bin/ece-tools build:transfer
deploy: |
set -e
php ./vendor/bin/ece-tools deploy
post_deploy: |
set -e
php ./vendor/bin/ece-tools post-deploy
# The configuration of scheduled execution.
crons:
magento:
spec: "*/5 * * * *"
cmd: bash -c 'for group in $(grep -shoP "(?<=<group id=\")(.+)(?=\">)" {app,vendor}/*/*/etc/cron_groups.xml); do echo -n Running cron group ${group} --- && php -d memory_limit=-1 bin/magento cron:run --group=${group}; done'
logrotate:
spec: "45 1 * * *"
cmd: shtool rotate -n10 $PLATFORM_APP_DIR/var/log/*.log
reportcleanup:
spec: "0 2 * * *"
cmd: find $PLATFORM_APP_DIR/var/report/* -mtime +10 -delete
# The configuration of app when it is exposed to the web.
web:
locations:
"/":
# The public directory of the app, relative to its root.
root: "pub"
# The front-controller script to send non-static requests to.
passthru: "/index.php"
index:
- index.php
expires: -1
scripts: true
allow: false
rules:
\.(css|js|map|hbs|gif|jpe?g|png|tiff|wbmp|ico|jng|bmp|svgz|midi?|mp?ga|mp2|mp3|m4a|ra|weba|3gpp?|mp4|mpe?g|mpe|ogv|mov|webm|flv|mng|asx|asf|wmv|avi|ogx|swf|jar|ttf|eot|woff|otf|html?)$:
allow: true
^/sitemap(.*)\.xml$:
passthru: "/media/sitemap$1.xml"
^/.well-known/apple-developer-merchantid-domain-association.xml$:
passthru: "/media/apple-developer-merchantid-domain-association.xml"
^/.well-known/apple-developer-merchantid-domain-association.txt$:
passthru: "/media/apple-developer-merchantid-domain-association.txt"
"/media":
root: "pub/media"
allow: true
scripts: false
expires: 30d
passthru: "/get.php"
"/static":
root: "pub/static"
allow: true
scripts: false
expires: 30d
passthru: "/front-static.php"
rules:
^/static/version\d+/(?<resource>.*)$:
passthru: "/static/$resource"