Skip to content

Commit

Permalink
Merge branch '1.12' into docker-cron-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferror authored Nov 10, 2022
2 parents 6192af1 + f3a3f87 commit 21b1401
Show file tree
Hide file tree
Showing 84 changed files with 212 additions and 341 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
extensions: intl
extensions: intl, mbstring
tools: symfony
coverage: none

Expand Down
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# the different stages of this Dockerfile are meant to be built into separate images
# https://docs.docker.com/compose/compose-file/#target

ARG PHP_VERSION=8.0
ARG PHP_VERSION=8.1
ARG NODE_VERSION=16
ARG NGINX_VERSION=1.21
ARG ALPINE_VERSION=3.15
ARG COMPOSER_VERSION=2
ARG COMPOSER_VERSION=2.4
ARG PHP_EXTENSION_INSTALLER_VERSION=latest

FROM composer:${COMPOSER_VERSION} AS composer
Expand All @@ -24,7 +24,10 @@ RUN apk add --no-cache \

COPY --from=php_extension_installer /usr/bin/install-php-extensions /usr/local/bin/

RUN install-php-extensions apcu curl exif gd iconv intl mbstring pdo_mysql opcache xml zip
# default PHP image extensions
# ctype curl date dom fileinfo filter ftp hash iconv json libxml mbstring mysqlnd openssl pcre PDO pdo_sqlite Phar
# posix readline Reflection session SimpleXML sodium SPL sqlite3 standard tokenizer xml xmlreader xmlwriter zlib
RUN install-php-extensions apcu exif gd intl pdo_mysql opcache zip

COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY docker/php/prod/php.ini $PHP_INI_DIR/php.ini
Expand All @@ -51,7 +54,7 @@ RUN set -eux; \
composer clear-cache

# copy only specifically what we need
COPY .env .env.prod .env.test .env.test_cached ./
COPY .env .env.prod ./
COPY assets assets/
COPY bin bin/
COPY config config/
Expand Down Expand Up @@ -131,6 +134,8 @@ WORKDIR /srv/sylius

ENV APP_ENV=dev

COPY .env.test .env.test_cached ./

RUN set -eux; \
composer install --prefer-dist --no-autoloader --no-interaction --no-scripts --no-progress; \
composer clear-cache
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## About

Sylius is the first decoupled eCommerce platform based on [**Symfony**](http://symfony.com) and [**Doctrine**](http://doctrine-project.org).
Sylius is the first decoupled eCommerce framework based on [**Symfony**](http://symfony.com) and [**Doctrine**](http://doctrine-project.org).
The highest quality of code, strong testing culture, built-in Agile (BDD) workflow and exceptional flexibility make it the best solution for application tailored to your business requirements.
Enjoy being an eCommerce Developer again!

Expand Down Expand Up @@ -77,7 +77,7 @@ $ tail -f var/log/dev.log

## Contributing

Would like to help us and build the most developer-friendly eCommerce platform? Start from reading our [Contribution Guide](https://docs.sylius.com/en/latest/contributing/)!
Would like to help us and build the most developer-friendly eCommerce framework? Start from reading our [Contribution Guide](https://docs.sylius.com/en/latest/contributing/)!

## Stay Updated

Expand Down
35 changes: 6 additions & 29 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,13 @@

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

set_time_limit(0);

require dirname(__DIR__).'/vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

require dirname(__DIR__).'/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
return function (array $context) {
return new Application(new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']));
};
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
],
"require": {
"php": "^8.0",
"sylius/paypal-plugin": "^1.5.x-dev",
"sylius/sylius": "^1.12.x-dev",
"sylius/paypal-plugin": "^1.5",
"sylius/sylius": "^1.12",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/runtime": "^5.4 || ^6.0",
"symfony/flex": "^2.1"
},
"require-dev": {
Expand Down Expand Up @@ -68,7 +69,8 @@
"symfony/flex": true,
"dealerdirect/phpcodesniffer-composer-installer": false,
"phpstan/extension-installer": false,
"symfony/thanks": false
"symfony/thanks": false,
"symfony/runtime": true
}
},
"extra": {
Expand Down Expand Up @@ -124,6 +126,7 @@
"symfony/polyfill-intl-icu": "*",
"symfony/polyfill-intl-idn": "*",
"symfony/polyfill-intl-normalizer": "*",
"symfony/polyfill-mbstring": "*",
"symfony/polyfill-php54": "*",
"symfony/polyfill-php55": "*",
"symfony/polyfill-php56": "*",
Expand Down
4 changes: 4 additions & 0 deletions config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ imports:
parameters:
sylius_core.public_dir: '%kernel.project_dir%/public'

when@dev:
sylius_api:
enabled: true

sylius_addressing:
resources:
address:
Expand Down
2 changes: 0 additions & 2 deletions config/packages/dev/_sylius.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/packages/dev/framework.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions config/packages/dev/routing.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions config/packages/dev/web_profiler.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ doctrine:
mappings:
App:
is_bundle: false
type: annotation
type: attribute
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
12 changes: 12 additions & 0 deletions config/packages/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@ framework:
serializer:
mapping:
paths: [ '%kernel.project_dir%/config/serialization' ]

when@dev:
framework:
profiler: { only_exceptions: false }

when@test: &framework_test
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file

when@test_cached: *framework_test
9 changes: 9 additions & 0 deletions config/packages/mailer.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
framework:
mailer:
dsn: '%env(MAILER_DSN)%'

when@test: &mailer_test
framework:
cache:
pools:
test.mailer_pool:
adapter: cache.adapter.filesystem

when@test_cached: *mailer_test
2 changes: 1 addition & 1 deletion config/packages/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
framework:
router:
strict_requirements: ~
strict_requirements: true
10 changes: 0 additions & 10 deletions config/packages/staging/monolog.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions config/packages/test/framework.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions config/packages/test/mailer.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions config/packages/test/web_profiler.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/packages/test_cached/framework.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/packages/test_cached/mailer.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/packages/test_cached/twig.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/packages/test_cached/web_profiler.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions config/packages/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ services:
autoconfigure: true

Twig\Extra\Intl\IntlExtension: ~

when@test_cached:
twig:
strict_variables: true
14 changes: 14 additions & 0 deletions config/packages/web_profiler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
when@dev:
web_profiler:
toolbar: true
intercept_redirects: false

when@test: &web_profiler_test
web_profiler:
toolbar: false
intercept_redirects: false

framework:
profiler: { collect: false }

when@test_cached: *web_profiler_test
26 changes: 23 additions & 3 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ services:
depends_on:
- mysql
environment:
APP_DEBUG: 0
APP_ENV: prod
APP_SECRET: EDITME
DATABASE_URL: mysql://sylius:${MYSQL_PASSWORD}@mysql/sylius_prod
MAILER_URL: smtp://localhost
MESSENGER_TRANSPORT_DSN: doctrine://default
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
APP_ENV: prod
APP_DEBUG: 0
APP_SECRET: EDITME
volumes:
# use a bind-mounted host directory, as we want to keep the sessions
- ./var/sessions:/srv/sylius/var/sessions:rw
Expand All @@ -29,11 +30,30 @@ services:
depends_on:
- mysql
environment:
APP_ENV: prod
APP_DEBUG: 0
APP_SECRET: EDITME
DATABASE_URL: mysql://sylius:${MYSQL_PASSWORD}@mysql/sylius_prod
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
networks:
- sylius

worker:
container_name: worker
command: ["php", "bin/console", "messenger:consume", "main", "catalog_promotion_removal", "--limit=5", "--memory-limit=256M", "--time-limit=600"]
restart: always
build:
context: .
target: sylius_php_prod
depends_on:
- mysql
environment:
APP_ENV: prod
APP_DEBUG: 0
APP_SECRET: EDITME
DATABASE_URL: mysql://sylius:${MYSQL_PASSWORD}@mysql/sylius_prod
MESSENGER_TRANSPORT_DSN: doctrine://default
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
networks:
- sylius

Expand Down
26 changes: 4 additions & 22 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
<?php

use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

require dirname(__DIR__).'/config/bootstrap.php';
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

Debug::enable();
}

if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}

if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
6 changes: 2 additions & 4 deletions src/Entity/Addressing/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Address as BaseAddress;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_address")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_address')]
class Address extends BaseAddress
{
}
6 changes: 2 additions & 4 deletions src/Entity/Addressing/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Addressing\Model\Country as BaseCountry;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_country")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_country')]
class Country extends BaseCountry
{
}
6 changes: 2 additions & 4 deletions src/Entity/Addressing/Province.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Addressing\Model\Province as BaseProvince;

/**
* @ORM\Entity
* @ORM\Table(name="sylius_province")
*/
#[ORM\Entity]
#[ORM\Table(name: 'sylius_province')]
class Province extends BaseProvince
{
}
Loading

0 comments on commit 21b1401

Please sign in to comment.