Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spryker 202108.0 support #655

Merged
merged 19 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,15 @@ pipeline {
sh './test spryker dynamic'
}
}
// Deliberately not having an "Install Mutagen" step to test the installer we ship with the harness
// todo: remove this step after the mutagen installer from harness is working again
stage('Install Mutagen') {
steps {
sh 'apk add grep'
sh 'curl --fail --silent --show-error --location --output /tmp/mutagen.tar.gz https://github.com/mutagen-io/mutagen/releases/download/v0.11.8/mutagen_linux_amd64_v0.11.8.tar.gz'
sh 'tar -C /usr/local/bin/ -xf /tmp/mutagen.tar.gz'
sh 'rm -f /tmp/mutagen.tar.gz'
}
}
stage('Acceptance Tests') {
environment {
REUSE_EXISTING_WORKSPACE = "yes"
Expand Down
3 changes: 2 additions & 1 deletion src/spryker/application/overlay/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ parameters:
- %rootDir%/../../../src/Generated/*
- %rootDir%/../../../src/Orm/*

bootstrap: %rootDir%/../../../phpstan-bootstrap.php
bootstrapFiles:
- %rootDir%/../../../phpstan-bootstrap.php

ignoreErrors:
- '#Call to an undefined method .+Criteria::.+\(\).#'
Expand Down
18 changes: 12 additions & 6 deletions src/spryker/application/skeleton/composer-harness.json.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
"php": ">= 7.4"
},
"require-dev": {
"behat/behat": "^3.5",
"behat/mink": "^1.7",
"behat/behat": "^3.10",
"behat/mink": "^1.9",
"behat/mink-extension": "^2.3",
"behat/mink-goutte-driver": "^1.2",
"behat/mink-goutte-driver": "^2.0",
"ciaranmcnulty/behat-stepthroughextension": "^1.0",
"dmore/behat-chrome-extension": "^1.3",
"dmore/chrome-mink-driver": "^2.6",
"jakoch/phantomjs-installer": "^3.0",
"roave/better-reflection": "~3.5",
"roave/better-reflection": "^4.3.0",
"phpcompatibility/php-compatibility": "dev-master",
"sensiolabs/behat-page-object-extension": "^2.3",
"guzzlehttp/guzzle": "^6.3.0",
"symfony/browser-kit": "^4.4"
"symfony/browser-kit": "^5.1.8"
},
"autoload-dev": {
"psr-4": {
Expand Down Expand Up @@ -65,5 +65,11 @@
"platform": {
"php": "7.4.10"
}
}
},
"repositories": [
{
"type": "git",
"url": "https://github.com/spryker-sdk/lib-innerbrowser.git"
}
]
}
111 changes: 44 additions & 67 deletions src/spryker/application/skeleton/config/Shared/config_local.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Pyz\Shared\Queue\QueueConstants;
use Pyz\Shared\Scheduler\SchedulerConfig;
use Pyz\Zed\Propel\PropelConfig;
use Spryker\Shared\Application\ApplicationConstants;
use Spryker\Shared\Collector\CollectorConstants;
use Spryker\Shared\Customer\CustomerConstants;
Expand All @@ -13,12 +14,12 @@
use Spryker\Shared\Newsletter\NewsletterConstants;
use Spryker\Shared\ProductManagement\ProductManagementConstants;
use Spryker\Shared\Propel\PropelConstants;
use Spryker\Shared\PropelQueryBuilder\PropelQueryBuilderConstants;
use Spryker\Shared\RabbitMq\RabbitMqEnv;
use Spryker\Shared\Router\RouterConstants;
use Spryker\Shared\Scheduler\SchedulerConstants;
use Spryker\Shared\SchedulerJenkins\SchedulerJenkinsConfig;
use Spryker\Shared\SchedulerJenkins\SchedulerJenkinsConstants;
use Spryker\Shared\Search\SearchConstants;
use Spryker\Shared\SearchElasticsearch\SearchElasticsearchConstants;
use Spryker\Shared\Session\SessionConstants;
use Spryker\Shared\SessionRedis\SessionRedisConstants;
Expand All @@ -27,65 +28,43 @@
use Spryker\Shared\ZedRequest\ZedRequestConstants;
use Twig\Cache\FilesystemCache;

// todo: this file sets hardcoded auth secrets, remote environments needs to have a different ones supplied via env vars
require 'common/config_oauth-devvm.php';

$CURRENT_STORE = Store::getInstance()->getStoreName();
$sprykerFrontendHost = getenv('YVES_HOST_' . $CURRENT_STORE);
$sprykerBackendHost = getenv('ZED_HOST_' . $CURRENT_STORE);
$sprykerBackendApiHost = getenv('ZED_API_HOST_' . $CURRENT_STORE);

// ---------- Yves host
$config[ApplicationConstants::HOST_YVES] = getenv('YVES_HOST_' . $CURRENT_STORE);
$config[ApplicationConstants::PORT_SSL_YVES] = '';
$config[ApplicationConstants::HOST_YVES] = $sprykerFrontendHost;
$config[ApplicationConstants::BASE_URL_YVES] = sprintf(
'http://%s%s',
$config[ApplicationConstants::HOST_YVES],
''
);
$config[ApplicationConstants::BASE_URL_SSL_YVES] = sprintf(
'https://%s%s',
$config[ApplicationConstants::HOST_YVES],
''
'https://%s',
$sprykerFrontendHost,
);
$config[ProductManagementConstants::BASE_URL_YVES] = $config[ApplicationConstants::BASE_URL_YVES];
$config[NewsletterConstants::BASE_URL_YVES] = $config[ApplicationConstants::BASE_URL_YVES];
$config[CustomerConstants::BASE_URL_YVES] = $config[ApplicationConstants::BASE_URL_YVES];
$config[ApplicationConstants::YVES_TRUSTED_HOSTS]
= $config[HttpConstants::YVES_TRUSTED_HOSTS]
= [
$config[ApplicationConstants::HOST_YVES],
];
$config[HttpConstants::YVES_TRUSTED_PROXIES] = ['REMOTE_ADDR'];
$config[ApplicationConstants::YVES_SSL_ENABLED]
= $config[SessionConstants::YVES_SSL_ENABLED]
$config[SessionConstants::YVES_SSL_ENABLED]
= $config[RouterConstants::YVES_IS_SSL_ENABLED]
= true;

// ---------- Zed host
$config[ApplicationConstants::HOST_ZED] = getenv('ZED_HOST_' . $CURRENT_STORE);
$config[ApplicationConstants::PORT_SSL_ZED] = '';
$config[ApplicationConstants::BASE_URL_ZED] = sprintf(
'http://%s%s',
$config[ApplicationConstants::HOST_ZED],
''
);
$config[ApplicationConstants::BASE_URL_SSL_ZED] = sprintf(
'https://%s%s',
$config[ApplicationConstants::HOST_ZED],
''
'https://%s',
$sprykerBackendHost,
);
$config[ZedRequestConstants::HOST_ZED_API] = getenv('ZED_API_HOST_' . $CURRENT_STORE) ?: $config[ApplicationConstants::HOST_ZED];
$config[ZedRequestConstants::HOST_ZED_API] = $sprykerBackendApiHost ?: $sprykerBackendHost;
$config[ZedRequestConstants::BASE_URL_ZED_API] = sprintf(
'http://%s%s',
'http://%s',
$config[ZedRequestConstants::HOST_ZED_API],
''
);
$config[ZedRequestConstants::BASE_URL_SSL_ZED_API] = sprintf(
'https://%s%s',
'https://%s',
$config[ZedRequestConstants::HOST_ZED_API],
''
);
$config[ApplicationConstants::ZED_TRUSTED_HOSTS]
= $config[HttpConstants::ZED_TRUSTED_HOSTS]
= [];

$config[ApplicationConstants::ZED_SSL_ENABLED]
= $config[SessionConstants::ZED_SSL_ENABLED]
$config[SessionConstants::ZED_SSL_ENABLED]
= $config[RouterConstants::ZED_IS_SSL_ENABLED]
= $config[ZedRequestConstants::ZED_API_SSL_ENABLED]
= false;
Expand All @@ -95,18 +74,12 @@
$config[GlueApplicationConstants::GLUE_APPLICATION_CORS_ALLOW_ORIGIN] = sprintf('http://%s', getenv('GLUE_HOST_' . $CURRENT_STORE));

// ---------- Session
$config[SessionConstants::YVES_SESSION_COOKIE_NAME] = $config[ApplicationConstants::HOST_YVES];
$config[SessionConstants::YVES_SESSION_COOKIE_DOMAIN] = $config[ApplicationConstants::HOST_YVES];

// ---------- Assets / Media
$config[ApplicationConstants::BASE_URL_STATIC_ASSETS] = $config[ApplicationConstants::BASE_URL_YVES];
$config[ApplicationConstants::BASE_URL_STATIC_MEDIA] = $config[ApplicationConstants::BASE_URL_YVES];
$config[ApplicationConstants::BASE_URL_SSL_STATIC_ASSETS] = $config[ApplicationConstants::BASE_URL_SSL_YVES];
$config[ApplicationConstants::BASE_URL_SSL_STATIC_MEDIA] = $config[ApplicationConstants::BASE_URL_SSL_YVES];
$config[SessionConstants::YVES_SESSION_COOKIE_NAME] = $sprykerFrontendHost;
$config[SessionConstants::YVES_SESSION_COOKIE_DOMAIN] = $sprykerFrontendHost;

// ---------- Session
$config[SessionConstants::ZED_SESSION_COOKIE_NAME] = $config[ApplicationConstants::HOST_ZED];
$config[SessionConstants::ZED_SESSION_COOKIE_DOMAIN] = $config[ApplicationConstants::HOST_ZED];
$config[SessionConstants::ZED_SESSION_COOKIE_NAME] = $sprykerBackendHost;
$config[SessionConstants::ZED_SESSION_COOKIE_DOMAIN] = $sprykerBackendHost;

// ---------- Database credentials
$config[PropelConstants::ZED_DB_USERNAME] = getenv('DB_USER');
Expand All @@ -115,38 +88,32 @@
$config[PropelConstants::ZED_DB_HOST] = getenv('DB_HOST');
$config[PropelConstants::ZED_DB_PORT] = 5432;
$config[PropelConstants::USE_SUDO_TO_MANAGE_DATABASE] = false;
$config[PropelConstants::ZED_DB_ENGINE]
= $config[PropelQueryBuilderConstants::ZED_DB_ENGINE]
= PropelConfig::DB_ENGINE_PGSQL;

// ---------- Elasticsearch
$ELASTICA_INDEX_NAME = strtolower($CURRENT_STORE) . '_search';
$config[ApplicationConstants::ELASTICA_PARAMETER__TRANSPORT]
= $config[SearchElasticsearchConstants::TRANSPORT]
= getenv('ELASTICSEARCH_SCHEME') ?: 'http';
$config[SearchConstants::ELASTICA_PARAMETER__HOST]
= $config[SearchElasticsearchConstants::HOST]
= getenv('ELASTICSEARCH_HOST');
$config[SearchConstants::ELASTICA_PARAMETER__PORT]
= $config[SearchElasticsearchConstants::PORT]
= getenv('ELASTICSEARCH_PORT');
$config[CollectorConstants::ELASTICA_PARAMETER__INDEX_NAME] = $ELASTICA_INDEX_NAME;

$config[SearchElasticsearchConstants::HOST] = getenv('ELASTICSEARCH_HOST');
$config[SearchElasticsearchConstants::TRANSPORT] = getenv('ELASTICSEARCH_SCHEME') ?: 'http';
$config[SearchElasticsearchConstants::PORT] = getenv('ELASTICSEARCH_PORT');
if (getenv('ELASTICSEARCH_USERNAME')) {
$config[ApplicationConstants::ELASTICA_PARAMETER__AUTH_HEADER]
= $config[SearchElasticsearchConstants::AUTH_HEADER]
= base64_encode(getenv('ELASTICSEARCH_USERNAME') . ':' . getenv('ELASTICSEARCH_PASSWORD'));
$config[SearchElasticsearchConstants::AUTH_HEADER] = base64_encode(getenv('ELASTICSEARCH_USERNAME') . ':' . getenv('ELASTICSEARCH_PASSWORD'));
}
$ELASTICA_INDEX_NAME = strtolower($CURRENT_STORE) . '_search';
$config[CollectorConstants::ELASTICA_PARAMETER__INDEX_NAME] = $ELASTICA_INDEX_NAME;

// ----------- Session and KV storage
$config[StorageRedisConstants::STORAGE_REDIS_PROTOCOL] = getenv('REDIS_PROTOCOL');
$config[StorageRedisConstants::STORAGE_REDIS_SCHEME] = getenv('REDIS_PROTOCOL');
$config[StorageRedisConstants::STORAGE_REDIS_HOST] = getenv('REDIS_HOST');
$config[StorageRedisConstants::STORAGE_REDIS_PORT] = getenv('REDIS_PORT');
$config[StorageRedisConstants::STORAGE_REDIS_PASSWORD] = getenv('REDIS_PASSWORD');
$config[StorageRedisConstants::STORAGE_REDIS_DATABASE] = 0;
$config[SessionRedisConstants::YVES_SESSION_REDIS_PROTOCOL] = getenv('REDIS_PROTOCOL');
$config[SessionRedisConstants::YVES_SESSION_REDIS_SCHEME] = getenv('REDIS_PROTOCOL');
$config[SessionRedisConstants::YVES_SESSION_REDIS_HOST] = getenv('REDIS_HOST');
$config[SessionRedisConstants::YVES_SESSION_REDIS_PORT] = getenv('REDIS_PORT');
$config[SessionRedisConstants::YVES_SESSION_REDIS_PASSWORD] = getenv('REDIS_PASSWORD');
$config[SessionRedisConstants::YVES_SESSION_REDIS_DATABASE] = 1;
$config[SessionRedisConstants::ZED_SESSION_REDIS_PROTOCOL] = getenv('REDIS_PROTOCOL');
$config[SessionRedisConstants::ZED_SESSION_REDIS_SCHEME] = getenv('REDIS_PROTOCOL');
$config[SessionRedisConstants::ZED_SESSION_REDIS_HOST] = getenv('REDIS_HOST');
$config[SessionRedisConstants::ZED_SESSION_REDIS_PORT] = getenv('REDIS_PORT');
$config[SessionRedisConstants::ZED_SESSION_REDIS_PASSWORD] = getenv('REDIS_PASSWORD');
Expand Down Expand Up @@ -243,3 +210,13 @@
FilesystemCache::FORCE_BYTECODE_INVALIDATION
),
];

// ---------- Security
$config[HttpConstants::YVES_TRUSTED_HOSTS]
= $config[HttpConstants::ZED_TRUSTED_HOSTS]
= $config[KernelConstants::DOMAIN_WHITELIST]
= [
$sprykerFrontendHost,
$sprykerBackendHost,
$sprykerBackendApiHost,
];
29 changes: 20 additions & 9 deletions src/spryker/application/skeleton/config/install/docker.yml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ sections:
hidden:
excluded: true
maintenance-all-on:
command: "vendor/bin/console maintenance:enable"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console maintenance:enable; fi"

maintenance-all-off:
command: "vendor/bin/console maintenance:disable"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console maintenance:disable; fi"

maintenance-zed-on:
command: "vendor/bin/console maintenance:enable zed"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console maintenance:enable zed; fi"

maintenance-zed-off:
command: "vendor/bin/console maintenance:disable zed"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console maintenance:disable zed; fi"

maintenance-yves-on:
command: "vendor/bin/console maintenance:enable yves"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console maintenance:enable yves; fi"

maintenance-yves-off:
command: "vendor/bin/console maintenance:disable yves"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console maintenance:disable yves; fi"

environment:
console-environment:
Expand Down Expand Up @@ -97,7 +97,11 @@ sections:
stores: true

router-cache-warmup-zed:
command: "vendor/bin/console router:cache:warm-up"
command: "vendor/bin/console router:cache:warm-up:backend"
stores: true

router-cache-warmup-zed-gateway:
command: "vendor/bin/console router:cache:warm-up:backend-gateway"
stores: true

twig-cache-warmup:
Expand Down Expand Up @@ -205,7 +209,7 @@ sections:
- propel

maintenance-page-enable:
command: "vendor/bin/console maintenance:enable"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console maintenance:enable yves; fi"
stores: true
condition:
command: "propel-migration-check"
Expand All @@ -219,7 +223,7 @@ sections:
- propel

maintenance-page-disable:
command: "vendor/bin/console maintenance:disable"
command: "if [ \"$APPLICATION_ENV\" = \"development\" ]; then vendor/bin/console maintenance:disable yves; fi"
stores: true

init-database:
Expand All @@ -233,6 +237,13 @@ sections:
groups:
- elastic

performance:
composer-autoloader:
command: 'composer dumpautoload -a -o --classmap-authoritative'

class-resolver-build:
command: 'vendor/bin/console cache:class-resolver:build'

demodata:
import:
command: "vendor/bin/console data:import --config=data/import/local/full_EU.yml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Spryker\Shared\EventDispatcher\EventDispatcherInterface;
use Spryker\Yves\Router\Plugin\EventDispatcher\RouterSslRedirectEventDispatcherPlugin as SprykerRouterSslRedirectEventDispatcherPlugin;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;

class RouterSslRedirectEventDispatcherPlugin extends SprykerRouterSslRedirectEventDispatcherPlugin
Expand All @@ -26,7 +26,7 @@ class RouterSslRedirectEventDispatcherPlugin extends SprykerRouterSslRedirectEve
*/
protected function addListener(EventDispatcherInterface $eventDispatcher): EventDispatcherInterface
{
$eventDispatcher->addListener(KernelEvents::REQUEST, function (GetResponseEvent $event): void {
$eventDispatcher->addListener(KernelEvents::REQUEST, function (RequestEvent $event): void {
$request = $event->getRequest();
if ($this->shouldBeSsl($request)) {
$fakeRequest = clone $request;
Expand Down
Loading