forked from ezsystems/ezplatform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.platform.app.yaml
186 lines (162 loc) · 7.89 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
# This file describes an application. You can have multiple applications
# in the same project.
# Please see doc/platformsh/README.md and doc/platformsh/INSTALL.md for eZ specific getting started instructions.
# Full documentation: https://docs.platform.sh
# eZ requirements: https://doc.ezplatform.com/en/latest/getting_started/requirements/#ez-platform-cloud-requirements-and-setup
# The name of this app. Must be unique within a project.
name: app
dependencies:
nodejs:
yarn: "*"
# The type of the application to build.
type: php:7.3
build:
# "none" means we're running composer manually, see build hook
# We currently need to do this to install newer version of Node.js
flavor: "none"
# 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: 'mysqldb:user'
# Uncomment if you want to store dfs tables in a separate database:
#dfs_database: 'mysqldb:dfs'
rediscache: 'rediscache:redis'
# [Recommended] To have an isolated and persisted Redis instance for sessions, uncomment
# this relationship and the corresponding service in .platform/services.yaml
#redissession: 'redissession:redis'
# If you wish to use solr, uncomment this relationship and the corresponding service in .platform/services.yaml
#solr: 'solrsearch:collection1'
variables:
#php:
# Example of setting php.ini config
#"display_errors": "On"
env:
# We disable Symfony Proxy, as we rather use Varnish
APP_HTTP_CACHE: 0
TRUSTED_PROXIES: "TRUST_REMOTE"
# Change this if you use a different env than "prod"
# If you change to "dev" remove "--no-dev" from the `composer install` command.
APP_ENV: prod
# Uncomment if you want to use DFS clustering:
# NOTE: Recommended on PE Dedicated cluster setup. Required if using Legacy Bridge on PE dedicated cluster setup.
#PLATFORMSH_DFS_NFS_PATH: 'dfsdata'
# The configuration of app when it is exposed to the web.
web:
locations:
"/":
# The public directory of the app, relative to its root.
root: "public"
# The front-controller script to send non-static requests to.
passthru: "/index.php"
# The number of seconds whitelisted (static) content should be cache
expires: 600
rules:
# Disable .php(3) and other executable extensions in the var directory
'^/var/.*(?i)\.(php3?|phar|phtml|sh|exe|pl|bin)$':
allow: false
# The size of the persistent disk of the application (in MB).
disk: 3072
# The mounts that will be performed when the package is deployed.
mounts:
# PE Cluster Note: By default will set all to shared, so if moving to PE dedicated cluster you should ask platform.sh
# Support to make sure at least cache + logs are local, while you can let web/var be shared if you prefer that over DFS.
'var/cache':
source: local
source_path: cache
'var/log':
source: local
source_path: log
'var/sessions':
source: local
source_path: sessions
'var/encore':
source: local
source_path: encore
'public/var':
source: local
source_path: var
'config/graphql/types/ezplatform':
source: local
source_path: graphql_types
# Uncomment if you need to use Kaliop Migrations on your setup and not able to get it to write to "var" dir.
# 'src/AppBundle/MigrationVersions/References':
# source: local
# source_path: MigrationVersionsReferences
# Uncomment if you want to use DFS clustering, required if using Legacy Bridge on PE dedicated cluster setup.
# 'dfsdata':
# # Platform.sh Staff: This MUST be shared on cluster, all others SHOULD be local for performance reasons
# source: local
# source_path: dfsdata
# The hooks that will be performed when the package is deployed.
hooks:
# Build hook, done before connected to services, disk is still writable here
build: |
set -e
# Install newer version of Node.js, as current default (v6LTS) does not play well with WebpackEncore
unset NPM_CONFIG_PREFIX
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | dash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm current
nvm install 10.15.3
if [ -z "$COMPOSER_AUTH" ]; then
echo "TIP: If you need to authenticate against Github/Gitlab/updates.ez.no, use COMPOSER_AUTH env variable"
echo "See: https://docs.platform.sh/tutorials/composer-auth.html#set-the-envcomposerauth-project-variable"
fi
composer install --no-dev --prefer-dist --no-progress --no-interaction --optimize-autoloader
# Deploy hook, access to services & done once (per cluster, not per node), only mounts are writable at this point
# Note: Http traffic is paused while this is running, so for prod code this should finish as fast as possible, < 30s
deploy: |
set -e
unset NPM_CONFIG_PREFIX
command -v nvm && nvm use 10.15.3
# Mainly relevant for eZ Platform demo usage, for own setup adapt this or remove and rely on migrations.
if [ ! -f public/var/.platform.installed ]; then
# To workaround issues with p.sh Varnish we clear container cache & temporary set Symfony Proxy
rm -Rf var/cache/$APP_ENV/*.*
HTTPCACHE_PURGE_TYPE="local" php -d memory_limit=-1 `which composer` ezplatform-install
touch public/var/.platform.installed
fi
# Now that mounts are available, clear cache on mount.
# Note: Skip on PE Cluster setup using e.g. "if [$PLATFORM_BRANCH" != 'production']; then" & get p.sh to enable this on internal per node "pre_start" hook
sh bin/platformsh_prestart_cacheclear.sh
# If you also need to clear Redis cache on every deploy, you can either use this command or redis-cli
# Normally this should only be needed if cached data structures changes (upgrades), or you change data via sql (e.g. restore backup)
##php bin/console cache:pool:clear cache.redis
# Example of additional deploy hooks if you use doctrine and/or kaliop migration bundle
##php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration
##php bin/console kaliop:migration:migrate --no-interaction --no-debug
# When using Solr, there are two cases where you'll need to rebuild indexes:
# - When Solr / search configuration changes
# - On database import/restore
# So in development it might be convenient to rebuild indexes, slowing down deploy time
##php bin/console ezplatform:reindex --processes=auto
# Post deploy hook, like deploy but after being deployed and live, for deploy tasks we can do asynchronously
#post_deploy: |
# set -e
# The configuration of scheduled execution.
# see https://docs.platform.sh/configuration/app/cron.html#cron-jobs
crons:
frequent:
# NOTE: The minimum interval between cron runs is 5 minutes, even if specified as less.
# Except for PE. There crons can be run every minute.
# So if you are not on PE please change specs to "*/5 * * * *" to avoid warning on each deploy.
spec: "* * * * *"
cmd: "php bin/console ezplatform:cron:run"
weekly:
spec: "0 0 * * 0"
cmd: "php bin/console ezplatform:check-urls --quiet"
runtime:
extensions:
- xsl
- imagick
- readline
- redis
- igbinary
#- apcu
#- name: 'blackfire'
# configuration:
# server_id: 'xxxx-xxx-xxx-xxx-xxxx'
# server_token: 'xxxx'