From a6b7afe8fe78b5f24dc1e1b1823ec64cf6353c9f Mon Sep 17 00:00:00 2001 From: Jacob Tobiasz Date: Fri, 30 Aug 2024 11:21:29 +0200 Subject: [PATCH] Add platform.sh configuration --- .platform.app.yaml | 117 ++++++++++++++++++++++++++++++++++++++++ .platform/routes.yaml | 7 +++ .platform/services.yaml | 3 ++ 3 files changed, 127 insertions(+) create mode 100644 .platform.app.yaml create mode 100644 .platform/routes.yaml create mode 100644 .platform/services.yaml diff --git a/.platform.app.yaml b/.platform.app.yaml new file mode 100644 index 00000000..64e6ce9f --- /dev/null +++ b/.platform.app.yaml @@ -0,0 +1,117 @@ +name: app +type: php:8.2 +build: + flavor: none + +variables: + env: + # Tell Symfony to always install in production-mode. + APP_ENV: 'prod' + APP_DEBUG: 0 + +# The hooks that will be performed when the package is deployed. +hooks: + build: | + set -x -e + + cd tests/Application + + curl -fs https://get.symfony.com/cloud/configurator | bash + + NODE_VERSION=18 symfony-build + + yarn install + yarn build:prod + deploy: | + set -x -e + + cd tests/Application + + rm -rf var/cache/* + + symfony-deploy + + mkdir -p public/media/image + bin/console sylius:fixtures:load -n + bin/console assets:install --symlink --relative public + bin/console cache:warmup + +# 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 `:`. +relationships: + database: "database:mysql" + +dependencies: + nodejs: + yarn: "*" + php: + composer/composer: '^2' + +# 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: + "/tests/Application/var/cache": "shared:files/cache" + "/tests/Application/var/log": "shared:files/log" + "/tests/Application/var/sessions": "shared:files/sessions" + "/tests/Application/public/uploads": "shared:files/uploads" + "/tests/Application/public/media": "shared:files/media" + "/tests/Application/public/assets": "shared:files/assets" + "/tests/Application/public/bundles": "shared:files/bundles" + +# The configuration of app when it is exposed to the web. +web: + locations: + "/": + # The public directory of the app, relative to its root. + root: "tests/Application/public" + # The front-controller script to send non-static requests to. + passthru: "/index.php" + allow: true + expires: -1 + scripts: true + '/assets/shop': + expires: 2w + passthru: true + allow: false + rules: + # Only allow static files from the assets directories. + '\.(css|js|jpe?g|png|gif|svgz?|ico|bmp|tiff?|wbmp|ico|jng|bmp|html|pdf|otf|woff2|woff|eot|ttf|jar|swf|ogx|avi|wmv|asf|asx|mng|flv|webm|mov|ogv|mpe|mpe?g|mp4|3gpp|weba|ra|m4a|mp3|mp2|mpe?ga|midi?)$': + allow: true + '/media/image': + expires: 2w + passthru: true + allow: false + rules: + # Only allow static files from the assets directories. + '\.(jpe?g|png|gif|svgz?)$': + allow: true + '/media/cache/resolve': + passthru: "/index.php" + expires: -1 + allow: true + scripts: true + '/media/cache': + expires: 2w + passthru: true + allow: false + rules: + # Only allow static files from the assets directories. + '\.(jpe?g|png|gif|svgz?)$': + allow: true +runtime: + extensions: + - apcu + - ctype + - iconv + - mbstring + - pdo_pgsql + - sodium + - xsl + +resources: + base_memory: 64 + memory_ratio: 128 diff --git a/.platform/routes.yaml b/.platform/routes.yaml new file mode 100644 index 00000000..a9181e0c --- /dev/null +++ b/.platform/routes.yaml @@ -0,0 +1,7 @@ +"https://{default}/": + type: upstream + upstream: "app:http" + +"https://www.{default}/": + type: redirect + to: "https://{default}/" diff --git a/.platform/services.yaml b/.platform/services.yaml new file mode 100644 index 00000000..0eab86b3 --- /dev/null +++ b/.platform/services.yaml @@ -0,0 +1,3 @@ +database: + type: mysql:11.0 + disk: 256