-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path60-symfony-without-flex.yaml
137 lines (115 loc) · 4.48 KB
/
60-symfony-without-flex.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
requirements:
- type: file_exists
value: composer.json
- type: has_composer_package
value: symfony/symfony
template: |
name: {{.Slug}}
type: php:{{.PhpVersion}}
runtime:
extensions:
{{ if php_extension_available "apcu" $.PhpVersion -}}
- apcu
{{ end -}}
{{- if php_extension_available "mbstring" $.PhpVersion -}}
- mbstring
{{ end -}}
{{- if php_extension_available "sodium" $.PhpVersion -}}
- sodium
{{ end -}}
{{ range $ext := php_extensions -}}
{{- if php_extension_available $ext $.PhpVersion -}}
- {{ $ext }}
{{ end -}}
{{- end }}
build:
flavor: none
disk: 1024
web:
locations:
"/":
root: "{{.PublicDirectory}}"
expires: 1h
passthru: "/{{.FrontController}}"
{{ if not (file_exists "app/cache") -}}
# These variables are available at build time
variables:
env:
# Cache dir is set at "var/cache" instead of the legacy default "app/cache"
SYMFONY_APP_CACHE_DIR: "var/cache"
{{- end }}
mounts:
{{ if file_exists "app/cache" -}}
"app/cache": { source: local, source_path: "var/cache" }
{{- else -}}
"var/cache": { source: local, source_path: "var/cache" }
{{- end }}
{{ if file_exists "app/logs" -}}
"app/logs": { source: local, source_path: "var/logs" }
{{- else -}}
"var/logs": { source: local, source_path: "var/logs" }
{{- end }}
hooks:
build: |
set -x -e
curl -fs https://get.symfony.com/cloud/configurator | bash
{{ range $ext := php_extensions -}}
{{- if not (php_extension_available $ext $.PhpVersion) -}}
# php-ext-install {{ $ext }} X.Y.Z
{{ end -}}
{{- end }}
NODE_VERSION=22 symfony-build
deploy: |
set -x -e
symfony-deploy
crons:
security-check:
# Check that no security issues have been found for PHP packages deployed in production
spec: '50 23 * * *'
cmd: if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then croncape COMPOSER_ROOT_VERSION=1.0.0 COMPOSER_AUDIT_ABANDONED=ignore composer audit --no-cache; fi
clean-expired-sessions:
spec: '17,47 * * * *'
cmd: croncape php-session-clean
extra_files:
"app/config/parameters_symfonycloud.php": |
<?php
// Don't forget to add the import in your `app/config/config.yml`:
// imports:
// - { resource: parameters.yml }
// + - { resource: parameters_symfonycloud.php }
// - { resource: security.yml }
// - { resource: services.yml }
// Not running in a SymfonyCloud runtime
if (!isset($_SERVER['SYMFONY_ENVIRONMENT'])) {
return;
}
/*
/!\ This file is not evaluated at runtime. This does not replace a proper
runtime parameter evaluation usage with Symfony >= 3.4 and DotEnv.
*/
$container->setParameter('secret', $_SERVER['APP_SECRET'] ?? $_SERVER['SECRET']);
$container->setParameter('kernel.environment', $_SERVER['APP_ENV'] ?? $_SERVER['SYMFONY_ENV']);
$container->setParameter('kernel.debug', (bool) ($_SERVER['APP_DEBUG'] ?? $_SERVER['SYMFONY_DEBUG']));
$container->setParameter('router.request_context.host', $_SERVER['SYMFONY_APPLICATION_DEFAULT_ROUTE_HOST']);
$container->setParameter('router.request_context.scheme', $_SERVER['SYMFONY_APPLICATION_DEFAULT_ROUTE_SCHEME']);
$envMapping = [
// You need to adapt this list to match your application configuration.
// Please refer to https://symfony.com/doc/master/cloud/services/intro.html
// for environment variable names.
/*'database_host' => 'DATABASE_HOST',
'database_port' => 'DATABASE_PORT',
'database_name' => 'DATABASE_NAME',
'database_user' => 'DATABASE_USER',
'database_password' => 'DATABASE_PASSWORD',*/
'mailer_transport' => 'MAILER_TRANSPORT',
'mailer_user' => 'MAILER_USER',
'mailer_password' => 'MAILER_PASSWORD',
'mailer_host' => 'MAILER_HOST',
'mailer_port' => 'MAILER_PORT',
];
foreach ($envMapping as $parameter => $env) {
if (!isset($_SERVER[$env])) {
continue;
}
$container->setParameter($parameter, $_SERVER[$env]);
}