This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
forked from ezsystems/ezplatform-ee-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.platform.app.yaml
137 lines (125 loc) · 5.93 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
# 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
# NB: Clustered eZ Platform setups are not tested and are likely to have issues.
# The name of this app. Must be unique within a project.
name: app
# The type of the application to build.
type: php:7.2
build:
# "none" means we're running composer manually, see build hook
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'
# If you wish to have a separate 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:solr'
variables:
#php:
# Example of setting php.ini config
#"display_errors": "On"
env:
# For enterprise cluster, disable Symfony Proxy & instead use Fastly Bundle available on eZ Platform Enterprise
#SYMFONY_HTTP_CACHE: 0
# Change this to dev if you want to run site & commands in dev
SYMFONY_ENV: prod
# Uncomment if you want to use DFS clustering:
#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: "web"
# The front-controller script to send non-static requests to.
passthru: "/app.php"
# The number of seconds whitelisted (static) content should be cache
expires: 600
# The size of the persistent disk of the application (in MB).
disk: 2048
# The mounts that will be performed when the package is deployed.
mounts:
"/var/cache": "shared:files/cache"
"/var/logs": "shared:files/logs"
"/web/var": "shared:files/files"
# Might want to not mount this one, it will slow down sessions, if you need cluster use memcached/redis!
"/var/sessions": "shared:files/sessions"
"/src/AppBundle/MigrationVersions/References": "shared:files/src/AppBundle/MigrationVersions/References"
# Uncomment if you want to use DFS clustering:
#"/dfsdata": "shared:files/dfsdata"
# The hooks that will be performed when the package is deployed.
hooks:
# Build hook, done once before connected to services, disk is still writable here
build: |
set -e
if [ -z "$COMPOSER_KEY" ]; then
echo "The 'composer_key' project variable must be set."
exit 1
elif [ -z "$COMPOSER_PASSWORD" ]; then
echo "The 'composer_password' project variable must be set."
exit 1
fi
composer config http-basic.updates.ez.no $COMPOSER_KEY $COMPOSER_PASSWORD
rm web/app_dev.php
if [ "$SYMFONY_ENV" = "dev" ] ; then
composer install --prefer-dist --no-progress --no-interaction --optimize-autoloader
else
composer install --no-dev --prefer-dist --no-progress --no-interaction --optimize-autoloader
fi
# 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
# Mainly relevant for eZ Platform demo usage, for own setup adapt this or remove and rely on migrations.
if [ ! -f web/var/.platform.installed ]; then
. ./.env
php -d memory_limit=-1 bin/console ezplatform:install $INSTALL_EZ_INSTALL_TYPE
touch web/var/.platform.installed
fi
# When deploying changes to existing cluster, clear all cache now that we have shared mounts available
if [ "$SYMFONY_ENV" != "prod" ] ; then
# Clear class cache before we boot up symfony in case of interface changes on classes cached
rm -Rf var/cache/$SYMFONY_ENV/*.*
bin/console cache:clear
elif [ -d "var/cache/prod/$PLATFORM_TREE_ID" ] ; then
# Clear cache on re-deploy when the folder exits, move folder so post_deploy can cleanup
mv -f var/cache/prod/$PLATFORM_TREE_ID var/cache/prod/old_deploy
fi
# Example of additional deploy hooks if you use doctrine and/or kaliop migration bundle
##bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration
##bin/console kaliop:migration:migrate --no-interaction --no-debug
# Post deploy hook, like deploy but after being deployed and live, for deploy tasks we can do asynchronously
post_deploy: |
set -e
# Cleanup old prod cache folders, basically all except current $PLATFORM_TREE_ID folder.
find var/cache/prod -mindepth 1 -maxdepth 1 -type d \! \( -name "$PLATFORM_TREE_ID" \) -exec rm -rf '{}' \;
# The configuration of scheduled execution.
# see https://docs.platform.sh/configuration/app/cron.html#cron-jobs
crons:
minute:
# NOTE: Platform.sh PS does not execute every minute, so might sometimes miss jobs scheduled for a given time
spec: "* * * * *"
cmd: "php bin/console ezplatform:cron:run"
weekly:
spec: "0 0 * * 0"
cmd: "php bin/console ezplatform:check-urls"
runtime:
extensions:
- xsl
- imagick
- readline
- redis
#- apcu
#- name: 'blackfire'
# configuration:
# server_id: 'xxxx-xxx-xxx-xxx-xxxx'
# server_token: 'xxxx'