diff --git a/templates/magento2ce/files/.platform.app.yaml b/templates/magento2ce/files/.platform.app.yaml index a9dbbb5ce..859966eae 100644 --- a/templates/magento2ce/files/.platform.app.yaml +++ b/templates/magento2ce/files/.platform.app.yaml @@ -1,113 +1,161 @@ -# 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 +# Complete list of all available properties: https://docs.platform.sh/create-apps/app-reference.html -# The name of this app. Must be unique within a project. -name: app +# A unique name for the app. Must be lowercase alphanumeric characters. Changing the name destroys data associated +# with the app. +name: magento # The runtime the application uses. -type: php:8.1 - -# Specify additional PHP extensions that should be loaded. -runtime: - extensions: - - xsl - - sodium - - redis - - blackfire - -# Configuration of the build of this application. -build: - flavor: composer - -dependencies: - php: - composer/composer: '^2' +# Complete list of available runtimes: https://docs.platform.sh/create-apps/app-reference.html#types +type: php:7.4 # 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 `:`. +# More information: https://docs.platform.sh/create-apps/app-reference.html#relationships relationships: - database: db:mysql - redis: cache:redis - elasticsearch: indexer:elasticsearch - rabbitmq: queue:rabbitmq + database: magento_database:mysql + redis: magento_redis:redis + search: magento_search:opensearch -# The size of the persistent disk of the application (in MB). +# The size of the persistent disk of the application (in MB). Minimum value is 128. disk: 2048 -# The 'mounts' describe writable, persistent filesystem mounts in the application. +# Mounts define directories that are writable after the build is complete. If set as a local source, disk property is required. +# More information: https://docs.platform.sh/create-apps/app-reference.html#mounts 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" + "var": "shared:files/var" + "generated": "shared:files/generated" + "app/etc": "shared:files/etc" + "pub/media": "shared:files/media" + "pub/static": "shared:files/static" + +# The web key configures the web server running in front of your app. +# More information: https://docs.platform.sh/create-apps/app-reference.html#web +web: + # Each key in locations is a path on your site with a leading /. + # More information: https://docs.platform.sh/create-apps/app-reference.html#locations + locations: + '/': + # The directory to serve static assets for this location relative to the app’s root directory. Must be an + # actual directory inside the root directory. + root: "pub" + # Whether to forward disallowed and missing resources from this location to the app. A string is a path + # with a leading / to the controller, such as /index.php. + passthru: "/index.php" + # Files to consider when serving a request for a directory. + index: + - index.php + # Whether to allow scripts to run. Doesn’t apply to paths specified in passthru. Meaningful only on PHP containers. + scripts: true + # Whether to allow serving files which don’t match a rule. + allow: false + # The key of each item in rules is a regular expression to match paths exactly. If an incoming request + # matches the rule, it’s handled by the properties under the rule, overriding any conflicting rules from the + # rest of the locations properties. + # More information: https://docs.platform.sh/create-apps/app-reference.html#rules + 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" + '/media': + root: "pub/media" + allow: true + scripts: false + passthru: "/get.php" + expires: 1y + '/static': + root: "pub/static" + allow: true + scripts: false + passthru: "/static.php" + expires: 1y + rules: + ^/static/version\d+/(?.*)$: + passthru: "/static/$resource" + +# Alternate copies of the application to run as background processes. +# More information: https://docs.platform.sh/create-apps/app-reference.html#workers +workers: + queue: + size: S + disk: 128 + commands: + start: | + bin/magento queue:consumers:start async.operations.all --single-thread --max-messages=10000 + +# Variables to control the environment. More information: https://docs.platform.sh/create-apps/app-reference.html#variables +variables: + # Customize your PHP.ini. + # See: https://docs.platform.sh/languages/php/ini.html + php: + # Include Magento's out-of-the-box settings + include: /app/.user.ini -# The hooks executed at various points in the lifecycle of the application. +# Specifies a default set of build tasks to run. Flavors are language-specific. +# More information: https://docs.platform.sh/create-apps/app-reference.html#build +build: + flavor: composer + +# Installs global dependencies as part of the build process. They’re independent of your app’s dependencies and +# are available in the PATH during the build process and in the runtime environment. They’re installed before +# the build hook runs using a package manager for the language. +# More information: https://docs.platform.sh/create-apps/app-reference.html#dependencies +dependencies: + php: + composer/composer: "2.2.22" + +# Hooks allow you to customize your code/environment as the project moves through the build and deploy stages +# More information: https://docs.platform.sh/create-apps/app-reference.html#hooks hooks: + # The build hook is run after any build flavor. + # More information: https://docs.platform.sh/create-apps/hooks/hooks-comparison.html#build-hook build: | set -e - php ./vendor/bin/ece-tools build:generate - php ./vendor/bin/ece-tools build:transfer + mkdir -p .versioned_backup/etc && cp app/etc/* .versioned_backup/etc/ + + # The deploy hook is run after the app container has been started, but before it has started accepting requests. + # More information: https://docs.platform.sh/create-apps/hooks/hooks-comparison.html#deploy-hook deploy: | set -e - php ./vendor/bin/ece-tools deploy -vvv - post_deploy: | - set -e - php ./vendor/bin/ece-tools post-deploy -vvv - php bin/magento admin:user:create --admin-user=admin --admin-password=admin --admin-email=admin@example.com --admin-firstname=Admin --admin-lastname=Istrator + cp .versioned_backup/etc/* app/etc/ + php deploy.php -# The configuration of scheduled execution. +# Scheduled tasks for the app. +# More information: https://docs.platform.sh/create-apps/app-reference.html#crons crons: - magento: - spec: "*/5 * * * *" - commands: bash -c 'for group in $(grep -shoP "(?<=)" {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 * * *" - commands: shtool rotate -n10 $PLATFORM_APP_DIR/var/log/*.log - reportcleanup: - spec: "0 2 * * *" - commands: find $PLATFORM_APP_DIR/var/report/* -mtime +10 -delete + magento: + spec: "*/5 * * * *" + commands: + start: "php bin/magento cron:run" -# 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 - "/media": - root: "pub/media" - allow: true - scripts: false - expires: 1y - passthru: "/get.php" - "/static": - root: "pub/static" - allow: true - scripts: false - expires: 1y - passthru: "/front-static.php" - rules: - ^/static/version\d+/(?.*)$: - passthru: "/static/$resource" +### +# Customizations to your PHP or Lisp runtime. More information: https://docs.platform.sh/create-apps/app-reference.html#runtime +# Specify additional PHP extensions that should be loaded. +# To determine what you need to enable +# 1. run locally: composer check-platform-reqs | grep "ext-\|php" +# 2. Compare to https://docs.platform.sh/languages/php/extensions.html +# - "Def" = Already Enabled +# - "Avail" = Available, but you need to enable below. +runtime: + extensions: + - xsl + - sodium + +# Information on the app's source code and operations that can be run on it. +# More information: https://docs.platform.sh/create-apps/app-reference.html#source +source: + ###################################################################################################################### + ## ## + ## This source operation is part of the Platform.sh process of updating and maintaining our collection of ## + ## templates. For more information see https://docs.platform.sh/create-apps/source-operations.html and ## + ## https://github.com/platformsh/source-operations ## + ## ## + ## YOU CAN SAFELY DELETE THIS COMMENT AND THE LINES BENEATH IT ## + ## ## + ###################################################################################################################### + operations: + auto-update: + command: | + curl -fsS https://raw.githubusercontent.com/platformsh/source-operations/main/setup.sh | { bash /dev/fd/3 sop-autoupdate; } 3<&0