Skip to content

Commit

Permalink
feature #942 Add platform.sh support (senghe, TheMilek)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.12 branch.

Discussion
----------

Hi. I've already prepared a platform.sh setup configuration for Sylius. In a nearest future I'll push also a documentation for this feature into Sylius repository.

I hope you like it 🖖 

Commits
-------

576f1eb Add platform.sh configuration
47036cb Bump node version
4a6a7fd Add CRON hook to platform.app.yaml file
90e3542 Change CRON hook crons section in platform.app.yaml file
cf624b9 Fixes after review
66cbe3e Bump node to 20 version
  • Loading branch information
GSadee authored May 13, 2024
2 parents a8fe04d + 66cbe3e commit 2c6cac8
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 deletions.
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
112 changes: 112 additions & 0 deletions .platform.app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: sylius

type: php:8.3

relationships:
database: "db:mysql"

disk: 2048

mounts:
"config/jwt":
source: local
source_path: jwt
"/var/cache":
source: local
source_path: cache
"/var/log":
source: local
source_path: log
"/var/sessions":
source: local
source_path: sessions
"/public/assets":
source: local
source_path: assets
"/public/bundles":
source: local
source_path: bundles
"/public/uploads":
source: local
source_path: uploads
"/public/media":
source: local
source_path: media

web:
locations:
"/":
root: "public"
passthru: "/index.php"
allow: true
expires: -1
scripts: true
'/assets/shop':
expires: 2w
passthru: true
allow: false
rules:
'\.(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:
'\.(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:
'\.(jpe?g|png|gif|svgz?)$':
allow: true

variables:
env:
APP_ENV: 'prod'
APP_DEBUG: 0
N_PREFIX: /app/.global

build:
flavor: composer

dependencies:
nodejs:
n: "*"
yarn: "*"
php:
composer/composer: '^2'

crons:
sylius-cancel-unpaid-orders:
spec: "0 2 * * *"
cmd: "php bin/console --env=prod sylius:cancel-unpaid-orders"
sylius-remove-expired-carts:
spec: "0 2 * * *"
cmd: "php bin/console --env=prod sylius:remove-expired-carts"

hooks:
build: |
set -e
curl -fs https://get.symfony.com/cloud/configurator | bash
n auto
hash -r
yarn install --frozen-lockfile
yarn build:prod
deploy: |
set -e
symfony-deploy
rm -rf var/cache/*
mkdir -p public/media/image
bin/console sylius:fixtures:load -n
bin/console lexik:jwt:generate-keypair --skip-if-exists
bin/console assets:install --symlink --relative public
bin/console cache:clear
1 change: 1 addition & 0 deletions .platform/local/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/
7 changes: 7 additions & 0 deletions .platform/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"https://{default}/":
type: upstream
upstream: "sylius:http"

"https://www.{default}/":
type: redirect
to: "https://{default}/"
3 changes: 3 additions & 0 deletions .platform/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
db:
type: mysql:11.0
disk: 256

0 comments on commit 2c6cac8

Please sign in to comment.