Skip to content

Commit

Permalink
Sync templates, var/cache mount, node 22
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Sep 4, 2024
1 parent 704b668 commit d7c471e
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 143 deletions.
84 changes: 0 additions & 84 deletions 15-symfony-flex-platformsh.yaml

This file was deleted.

74 changes: 40 additions & 34 deletions 30-symfony-flex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,21 @@ template: |
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 -}}
{{ range $ext := $.PHPExtensions -}}
{{- if php_extension_available $ext $.PhpVersion -}}
- {{ $ext }}
{{ end -}}
{{- end }}
#variables:
# php:
# # uncomment on PHP 7.4+
# #opcache.preload: config/preload.php
{{ if php_at_least "7.4" -}}
variables:
php:
opcache.preload: config/preload.php
{{- end }}
build:
flavor: none
disk: 512
disk: 1024
web:
locations:
Expand All @@ -43,40 +34,55 @@ template: |
expires: 1h
passthru: "/{{.FrontController}}"
{{ if has_composer_package "symfony/messenger" -}}
workers:
messenger:
# PHP background workers usually don't require much CPU. See
# https://symfony.com/doc/current/cloud/cookbooks/resources_allocation.html
# for more information
size: XS
resources:
base_memory: 64 # Keep in sync with the `memory-limit` flag value
memory_ratio: 128
commands:
# Don't forget to update your receiver name(s)
start: symfony console --time-limit=3600 --memory-limit=64M messenger:consume async
{{- end }}
mounts:
"/var": { source: local, source_path: var }
"/var/cache": { source: local, source_path: var/cache }
{{ if file_exists "templates/debug/source_code.html.twig" -}}
"/data": { source: local, source_path: "data" }
{{- end }}
{{ if $.Services -}}
relationships:
{{ range $service := $.Services -}}
{{ $service.Name }}: "{{ $service.Name }}:{{ $service.Type }}"
{{ end -}}
{{- end }}
hooks:
build: |
set -x -e
curl -fs https://get.symfony.com/cloud/configurator | bash
{{ range $ext := php_extensions -}}
{{ range $ext := $.PHPExtensions -}}
{{- if not (php_extension_available $ext $.PhpVersion) -}}
# php-ext-install {{ $ext }} X.Y.Z
{{ end -}}
{{- end }}
NODE_VERSION=18 symfony-build
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: php-session-clean
{{ if has_composer_package "symfony/messenger" -}}
workers:
messenger:
# PHP background workers usually don't require much CPU. See
# https://symfony.com/doc/current/cloud/cookbooks/resources_allocation.html
# for more information
size: XS
resources:
base_memory: 64 # Keep in sync with the `memory-limit` flag value
memory_ratio: 128
commands:
# Consume "async" messages (as configured in the routing section of config/packages/messenger.yaml)
start: symfony console --time-limit=3600 --memory-limit=64M messenger:consume async
{{- end }}
47 changes: 24 additions & 23 deletions 60-symfony-without-flex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,7 @@ template: |
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 -}}
{{ range $ext := $.PHPExtensions -}}
{{- if php_extension_available $ext $.PhpVersion -}}
- {{ $ext }}
{{ end -}}
Expand All @@ -29,15 +20,15 @@ template: |
build:
flavor: none
disk: 1024
web:
locations:
"/":
root: "{{.PublicDirectory}}"
expires: 1h
passthru: "/{{.FrontController}}"
disk: 512
{{ if not (file_exists "app/cache") -}}
# These variables are available at build time
variables:
Expand All @@ -58,40 +49,50 @@ template: |
"var/logs": { source: local, source_path: "var/logs" }
{{- end }}
{{ if $.Services -}}
relationships:
{{ range $service := $.Services -}}
{{ $service.Name }}: "{{ $service.Name }}:{{ $service.Type }}"
{{ end -}}
{{- end }}
hooks:
build: |
set -x -e
curl -fs https://get.symfony.com/cloud/configurator | bash
{{ range $ext := php_extensions -}}
{{ range $ext := $.PHPExtensions -}}
{{- if not (php_extension_available $ext $.PhpVersion) -}}
# php-ext-install {{ $ext }} X.Y.Z
{{ end -}}
{{- end }}
NODE_VERSION=18 symfony-build
# Keep the cache in a persistent directory if possible to speed up
# deployments. *Enable this only if your cache can be built before
# deployment and reused each time*.
# mkdir -p tmp/cache && mv app/cache/prod tmp/cache/
NODE_VERSION=22 symfony-build
deploy: |
set -x -e
(>&2 symfony-deploy)
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: php-session-clean
extra_files:
"app/config/parameters_symfonycloud.php": |
"app/config/parameters_platformsh.php": |
<?php
// Don't forget to add the import in your `app/config/config.yml`:
// imports:
// - { resource: parameters.yml }
// + - { resource: parameters_symfonycloud.php }
// + - { resource: parameters_platformsh.php }
// - { resource: security.yml }
// - { resource: services.yml }
// Not running in a SymfonyCloud runtime
// Not running in a Platform.sh runtime
if (!isset($_SERVER['SYMFONY_ENVIRONMENT'])) {
return;
}
Expand Down
5 changes: 5 additions & 0 deletions 99-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ template: |
expires: 10m
disk: 256
crons:
clean-expired-sessions:
spec: '17,47 * * * *'
cmd: php-session-clean
1 change: 1 addition & 0 deletions php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ allow_url_include=off
display_errors=off
display_startup_errors=off
max_execution_time=30
session.gc_probability=0
session.use_strict_mode=On
realpath_cache_ttl=3600
zend.detect_unicode=Off
8 changes: 6 additions & 2 deletions upsun/15-symfony-flex-upsun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ template: |
passthru: "/{{.FrontController}}"
mounts:
"/var": { source: storage, source_path: var }
"/var/cache": { source: instance, source_path: var/cache }
"/var/cache/prod/pools/app": { source: storage, source_path: var/cache/prod/pools/app }
{{ if file_exists "templates/debug/source_code.html.twig" -}}
"/data": { source: storage, source_path: "data" }
{{- end }}
Expand All @@ -68,7 +69,7 @@ template: |
# php-ext-install {{ $ext }} X.Y.Z
{{ end -}}
{{- end }}
NODE_VERSION=18 symfony-build
NODE_VERSION=22 symfony-build
deploy: |
set -x -e
Expand All @@ -80,6 +81,9 @@ template: |
# 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: php-session-clean
{{ if has_composer_package "symfony/messenger" -}}
workers:
Expand Down

0 comments on commit d7c471e

Please sign in to comment.