From 45ea9a6de14f4b793b9289c04706b4334bbbbdd0 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Mon, 3 Jan 2022 18:32:24 +0530 Subject: [PATCH 01/17] Resolve composer dependencies --- .../application/skeleton/composer-harness.json.twig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spryker/application/skeleton/composer-harness.json.twig b/src/spryker/application/skeleton/composer-harness.json.twig index 098d448f1..41f563d4f 100644 --- a/src/spryker/application/skeleton/composer-harness.json.twig +++ b/src/spryker/application/skeleton/composer-harness.json.twig @@ -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": { From e01e34b4a1cbb5ef241d25df6ecc70ed52070b03 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Mon, 3 Jan 2022 18:32:45 +0530 Subject: [PATCH 02/17] Apply config changes --- .../skeleton/config/Shared/config_local.php | 108 +++++++----------- 1 file changed, 41 insertions(+), 67 deletions(-) diff --git a/src/spryker/application/skeleton/config/Shared/config_local.php b/src/spryker/application/skeleton/config/Shared/config_local.php index da4be4b8b..b953652fc 100644 --- a/src/spryker/application/skeleton/config/Shared/config_local.php +++ b/src/spryker/application/skeleton/config/Shared/config_local.php @@ -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; @@ -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; @@ -28,64 +29,39 @@ use Twig\Cache\FilesystemCache; $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; @@ -95,18 +71,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'); @@ -115,38 +85,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'); @@ -243,3 +207,13 @@ FilesystemCache::FORCE_BYTECODE_INVALIDATION ), ]; + +// ---------- Security +$config[HttpConstants::YVES_TRUSTED_HOSTS] + = $config[HttpConstants::ZED_TRUSTED_HOSTS] + = $config[KernelConstants::DOMAIN_WHITELIST] + = [ + $sprykerFrontendHost, + $sprykerBackendHost, + $sprykerBackendApiHost, +]; From 773f8a974ed93b73ccb888c2a241aa5f2a5d59f9 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Mon, 3 Jan 2022 18:33:02 +0530 Subject: [PATCH 03/17] Fix overwritten file --- .../RouterSslRedirectEventDispatcherPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spryker/application/skeleton/src/Inviqa/Yves/Router/Plugin/EventDispatcher/RouterSslRedirectEventDispatcherPlugin.php b/src/spryker/application/skeleton/src/Inviqa/Yves/Router/Plugin/EventDispatcher/RouterSslRedirectEventDispatcherPlugin.php index b1d14368d..4fa983b9f 100644 --- a/src/spryker/application/skeleton/src/Inviqa/Yves/Router/Plugin/EventDispatcher/RouterSslRedirectEventDispatcherPlugin.php +++ b/src/spryker/application/skeleton/src/Inviqa/Yves/Router/Plugin/EventDispatcher/RouterSslRedirectEventDispatcherPlugin.php @@ -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 @@ -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; From 3b5f5a5164dae038e1084eeda8864832df6b1dad Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Mon, 3 Jan 2022 18:33:19 +0530 Subject: [PATCH 04/17] Change demoshop version, update elasticsearch and composer versions --- src/spryker/harness.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spryker/harness.yml b/src/spryker/harness.yml index bf38e2309..7c1f4e21e 100644 --- a/src/spryker/harness.yml +++ b/src/spryker/harness.yml @@ -26,13 +26,13 @@ attributes: spryker: salt: 2tkqCCRKy5rT4wMVz8KTCh8r3sJGkL5v demoshop-url: https://github.com/spryker-shop/b2c-demo-shop.git - demoshop-version: "202009.0" + demoshop-version: "202108.0" mode: development oauth_client_secret: ~ zed_request_token: ~ php: composer: - major_version: 1 + major_version: 2 fpm: ini: max_execution_time: 600 @@ -89,7 +89,7 @@ attributes: php-fpm: "= 'my127/spryker:' ~ @('php.version') ~ '-fpm-' ~ (@('php.version') >= 7.4 ? 'buster' : 'stretch')" elasticsearch: image: elasticsearch - tag: '6.8.12' + tag: '7.16.2' hostname_aliases: "= replace(flatten([ @('glue.external_hosts'), @('yves.external_hosts'), From 2f46c5c71bf6225f448c2e8905a421fa89a23051 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Fri, 7 Jan 2022 11:43:35 +0530 Subject: [PATCH 05/17] Fix Yves to Zed calls --- .../skeleton/config/Shared/config_local.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/spryker/application/skeleton/config/Shared/config_local.php b/src/spryker/application/skeleton/config/Shared/config_local.php index b953652fc..cdfc9cf3f 100644 --- a/src/spryker/application/skeleton/config/Shared/config_local.php +++ b/src/spryker/application/skeleton/config/Shared/config_local.php @@ -28,6 +28,9 @@ 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); @@ -213,7 +216,8 @@ = $config[HttpConstants::ZED_TRUSTED_HOSTS] = $config[KernelConstants::DOMAIN_WHITELIST] = [ - $sprykerFrontendHost, - $sprykerBackendHost, - $sprykerBackendApiHost, -]; + $sprykerFrontendHost, + $sprykerBackendHost, + $sprykerBackendApiHost, + ]; + From 58ddf2298bdcbbfc7f70ad70e5f085bd46a1c31e Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Fri, 7 Jan 2022 11:43:50 +0530 Subject: [PATCH 06/17] Fix zed router cache warmup --- .../application/skeleton/config/install/docker.yml.twig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/spryker/application/skeleton/config/install/docker.yml.twig b/src/spryker/application/skeleton/config/install/docker.yml.twig index 831eaa0d7..41b3e1c12 100644 --- a/src/spryker/application/skeleton/config/install/docker.yml.twig +++ b/src/spryker/application/skeleton/config/install/docker.yml.twig @@ -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: From 82b71cb5576cc5b5049f8be0ea24b6ec1ffc77b5 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Fri, 7 Jan 2022 11:44:10 +0530 Subject: [PATCH 07/17] Set separate root directories for zed and zed-gateway endpoints --- .../etc/nginx/conf.d/zed.conf.template.twig | 44 ++++++++++++++++++- src/spryker/harness.yml | 2 + 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/spryker/docker/image/nginx/root/etc/nginx/conf.d/zed.conf.template.twig b/src/spryker/docker/image/nginx/root/etc/nginx/conf.d/zed.conf.template.twig index e44c04d09..4b23c5ff2 100644 --- a/src/spryker/docker/image/nginx/root/etc/nginx/conf.d/zed.conf.template.twig +++ b/src/spryker/docker/image/nginx/root/etc/nginx/conf.d/zed.conf.template.twig @@ -3,7 +3,7 @@ server { listen 80; listen 443 ssl http2; - server_name ${ZED_HOST_{{ store_code }}} ${ZED_API_HOST_{{ store_code }}}; + server_name ${ZED_HOST_{{ store_code }}} include snippets/certificate.conf; include snippets/ssl-params.conf; @@ -12,7 +12,7 @@ server { {{ name }} {{ value }}; {% endfor %} - root {{ @('app.web_directory') }}/Zed; + root {{ @('zed.root_dir') }}; # Timeout for ZED requests - 10 minutes # (longer requests should be converted to jobs and executed via jenkins) @@ -46,3 +46,43 @@ server { } } {% endfor %} + +{% for store_code, zed_api_external_host in @('zed_api.external_hosts') %} +server { + listen 80; + listen 443 ssl http2; + + server_name ${ZED_API_HOST_{{ store_code }}}; + + include snippets/certificate.conf; + include snippets/ssl-params.conf; + + {% for name, value in @('nginx.site.conf') %} + {{ name }} {{ value }}; + {% endfor %} + + root {{ @('zed_api.root_dir') }}; + + # Timeout for ZED requests - 10 minutes + # (longer requests should be converted to jobs and executed via jenkins) + proxy_read_timeout 600s; + proxy_send_timeout 600s; + fastcgi_read_timeout {{ @('php.fpm.ini.max_execution_time') + 1 }}s; + client_body_timeout 600s; + client_header_timeout 600s; + send_timeout 600s; + + # PHP application gets all requests + location / { + add_header X-Server $hostname; + fastcgi_pass ${FPM_HOST}:{{ @('php-fpm.pools.zed.port') }}; + fastcgi_index index.php; + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_NAME /index.php; + fastcgi_param SCRIPT_FILENAME $document_root/index.php; + + # Spryker variables + fastcgi_param APPLICATION_STORE {{ store_code }}; + } +} +{% endfor %} diff --git a/src/spryker/harness.yml b/src/spryker/harness.yml index 7c1f4e21e..3b245f98f 100644 --- a/src/spryker/harness.yml +++ b/src/spryker/harness.yml @@ -123,11 +123,13 @@ attributes: DE: = 'zed-de-' ~ @('hostname') AT: = 'zed-at-' ~ @('hostname') US: = 'zed-us-' ~ @('hostname') + root_dir: = @('app.web_directory') ~ '/Zed' zed_api: external_hosts: DE: = 'zed-api-de-' ~ @('hostname') AT: = 'zed-api-at-' ~ @('hostname') US: = 'zed-api-us-' ~ @('hostname') + root_dir: = @('app.web_directory') ~ '/BackendGateway' glue: external_hosts: DE: = 'glue-de-' ~ @('hostname') From 4c781b6eded79b2090a9e3f53af0deab2dcc04fa Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Fri, 7 Jan 2022 12:15:09 +0530 Subject: [PATCH 08/17] Fix phpstan error --- src/spryker/application/skeleton/config/Shared/config_local.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/spryker/application/skeleton/config/Shared/config_local.php b/src/spryker/application/skeleton/config/Shared/config_local.php index cdfc9cf3f..e7beaafc5 100644 --- a/src/spryker/application/skeleton/config/Shared/config_local.php +++ b/src/spryker/application/skeleton/config/Shared/config_local.php @@ -220,4 +220,3 @@ $sprykerBackendHost, $sprykerBackendApiHost, ]; - From 6748d999e54642ef24393feb86556a1d1ac0d842 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Fri, 7 Jan 2022 12:55:10 +0530 Subject: [PATCH 09/17] Revert composer version change --- src/spryker/harness.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spryker/harness.yml b/src/spryker/harness.yml index 3b245f98f..0aa825cbd 100644 --- a/src/spryker/harness.yml +++ b/src/spryker/harness.yml @@ -32,7 +32,7 @@ attributes: zed_request_token: ~ php: composer: - major_version: 2 + major_version: 1 fpm: ini: max_execution_time: 600 From c7050caa7355b4336632fb4519c41d8666ad14f5 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Mon, 10 Jan 2022 11:14:38 +0530 Subject: [PATCH 10/17] Install mutagen until the harness installer is fixed --- Jenkinsfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c9a216673..ad4df8e1f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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" From 3d89575dd6b9b2da27f22fd7944e4595ff24984d Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Mon, 10 Jan 2022 11:15:09 +0530 Subject: [PATCH 11/17] Add Spryker version check for config changes --- src/spryker/harness.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spryker/harness.yml b/src/spryker/harness.yml index 0aa825cbd..71050a45d 100644 --- a/src/spryker/harness.yml +++ b/src/spryker/harness.yml @@ -89,7 +89,7 @@ attributes: php-fpm: "= 'my127/spryker:' ~ @('php.version') ~ '-fpm-' ~ (@('php.version') >= 7.4 ? 'buster' : 'stretch')" elasticsearch: image: elasticsearch - tag: '7.16.2' + tag: "= @('spryker.demoshop-version') <= '202009.0'? '6.8.22' : '7.16.2'" hostname_aliases: "= replace(flatten([ @('glue.external_hosts'), @('yves.external_hosts'), @@ -129,7 +129,7 @@ attributes: DE: = 'zed-api-de-' ~ @('hostname') AT: = 'zed-api-at-' ~ @('hostname') US: = 'zed-api-us-' ~ @('hostname') - root_dir: = @('app.web_directory') ~ '/BackendGateway' + root_dir: "= @('spryker.demoshop-version') >= '202108.0'? @('app.web_directory') ~ '/BackendGateway' : @('app.web_directory') ~ '/Zed'" glue: external_hosts: DE: = 'glue-de-' ~ @('hostname') From b3b5af8f89d427cb228a6039011833f3260955d0 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Mon, 10 Jan 2022 12:35:50 +0530 Subject: [PATCH 12/17] Switch composer version back to 2 --- src/spryker/harness.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spryker/harness.yml b/src/spryker/harness.yml index 71050a45d..1f070d2fc 100644 --- a/src/spryker/harness.yml +++ b/src/spryker/harness.yml @@ -32,7 +32,7 @@ attributes: zed_request_token: ~ php: composer: - major_version: 1 + major_version: 2 fpm: ini: max_execution_time: 600 From 5a34fd74495a989174b3be4ddfd8db1abd5372b1 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Thu, 20 Jan 2022 13:36:03 +0530 Subject: [PATCH 13/17] Fix composer auth issue --- .../application/skeleton/composer-harness.json.twig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/spryker/application/skeleton/composer-harness.json.twig b/src/spryker/application/skeleton/composer-harness.json.twig index 41f563d4f..de0d89307 100644 --- a/src/spryker/application/skeleton/composer-harness.json.twig +++ b/src/spryker/application/skeleton/composer-harness.json.twig @@ -65,5 +65,11 @@ "platform": { "php": "7.4.10" } - } + }, + "repositories": [ + { + "type": "git", + "url": "https://github.com/spryker-sdk/lib-innerbrowser.git" + } + ] } From 623d01a65eb11ecc48d8eb31aea924eb491afe6e Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Mon, 24 Jan 2022 14:11:05 +0530 Subject: [PATCH 14/17] Migrate changes from Spryker installation recipe --- src/spryker/application/overlay/phpstan.neon | 3 ++- .../skeleton/config/install/docker.yml.twig | 23 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/spryker/application/overlay/phpstan.neon b/src/spryker/application/overlay/phpstan.neon index 6152585b9..858671b1a 100644 --- a/src/spryker/application/overlay/phpstan.neon +++ b/src/spryker/application/overlay/phpstan.neon @@ -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::.+\(\).#' diff --git a/src/spryker/application/skeleton/config/install/docker.yml.twig b/src/spryker/application/skeleton/config/install/docker.yml.twig index 41b3e1c12..372a8ef95 100644 --- a/src/spryker/application/skeleton/config/install/docker.yml.twig +++ b/src/spryker/application/skeleton/config/install/docker.yml.twig @@ -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: @@ -209,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" @@ -223,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: @@ -237,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" From f37569e57f24655498a2a9f241cccdfaa34af8eb Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Tue, 25 Jan 2022 11:25:29 +0530 Subject: [PATCH 15/17] Add default demoshop version to workspace.yml and upgrade instruction --- UPGRADE.md | 10 ++++++++++ src/spryker/.ci/sample-dynamic/workspace.yml | 2 ++ src/spryker/.ci/sample-static/workspace.yml | 2 ++ src/spryker/harness.yml | 2 +- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/UPGRADE.md b/UPGRADE.md index 45af1e385..579c1d7ca 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -2,6 +2,16 @@ In addition to the README's [Harness Upgrade Instructions], please note these specific version upgrade instructions. +## Upgrading from 1.2.x to 1.3.x + +### Spryker +With support for Spryker 202108.0 release, we have upgraded the Elasticsearch version to 7.x and also there is a change in +Zed application's root directory (Spryker now supports different entrypoints for backoffice and Zed gateway applications). +However, both of these changes are not backward compatible. So, to make sure we do not break projects using old demoshop version, +we are using `spryker.demoshop-version` attribute to apply these changes conditionally. +In order to make sure your project uses the right version of Elasticsearch and Zed root directory, make sure you set the +right `spryker.demoshop-version` in your workspace.yml + ## Upgrading from 1.1.x to 1.2.x ### Chrome diff --git a/src/spryker/.ci/sample-dynamic/workspace.yml b/src/spryker/.ci/sample-dynamic/workspace.yml index ad1503b18..66f425af0 100644 --- a/src/spryker/.ci/sample-dynamic/workspace.yml +++ b/src/spryker/.ci/sample-dynamic/workspace.yml @@ -8,3 +8,5 @@ attribute('aws.access_key_id'): null attribute('aws.secret_access_key'): null attribute('docker.port_forward.enabled'): false + +attribute('spryker.demoshop-version'): "202108.0" diff --git a/src/spryker/.ci/sample-static/workspace.yml b/src/spryker/.ci/sample-static/workspace.yml index a02fd81b2..08b61ce56 100644 --- a/src/spryker/.ci/sample-static/workspace.yml +++ b/src/spryker/.ci/sample-static/workspace.yml @@ -9,5 +9,7 @@ attribute('app.repository'): null attribute('aws.access_key_id'): null attribute('aws.secret_access_key'): null +attribute('spryker.demoshop-version'): "202108.0" + attribute('spryker.oauth_client_secret'): '= decrypt("YTozOntpOjA7czo3OiJkZWZhdWx0IjtpOjE7czoyNDoi/ZxjAtTonBTdHCfPRmh3rlDOOTPZ8oaVIjtpOjI7czo2NDoiXHkN92FXiuuj/PVZKwzJEKtsQzRtAEvdPSYT/6mEA2GVtk+98N4ch+y+MVbg6REiwTAFXOZSb7lEyqZOJMEY+iI7fQ==")' attribute('spryker.zed_request_token'): '= decrypt("YTozOntpOjA7czo3OiJkZWZhdWx0IjtpOjE7czoyNDoi5TNpTpnAi3Yjlstw46A63Pvn1nnGoE1VIjtpOjI7czo5NjoiFHj6M4K5I2pUBD5t2nnjzhR6jixzGOtQl/HSBWWyrD9TFmg+Qw82CLZlqBYgQXaCDiOB1GV9tVKAuvvr9ntHZ0KWeZLu5spfhdaqcVsJVm2kxNX6A1YKb5mw/g4V4NvAIjt9")' diff --git a/src/spryker/harness.yml b/src/spryker/harness.yml index 1f070d2fc..9dcde2e31 100644 --- a/src/spryker/harness.yml +++ b/src/spryker/harness.yml @@ -89,7 +89,7 @@ attributes: php-fpm: "= 'my127/spryker:' ~ @('php.version') ~ '-fpm-' ~ (@('php.version') >= 7.4 ? 'buster' : 'stretch')" elasticsearch: image: elasticsearch - tag: "= @('spryker.demoshop-version') <= '202009.0'? '6.8.22' : '7.16.2'" + tag: "= @('spryker.demoshop-version') <= '202009.0'? '6.8.23' : '7.16.3'" hostname_aliases: "= replace(flatten([ @('glue.external_hosts'), @('yves.external_hosts'), From b6ed56129829f42faaec9d0757b264fc28086606 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Fri, 28 Jan 2022 18:17:43 +0530 Subject: [PATCH 16/17] Apply suggestions from code review Co-authored-by: andytson-inviqa --- UPGRADE.md | 1 + src/spryker/harness.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/UPGRADE.md b/UPGRADE.md index 579c1d7ca..0ffe62b40 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -9,6 +9,7 @@ With support for Spryker 202108.0 release, we have upgraded the Elasticsearch ve Zed application's root directory (Spryker now supports different entrypoints for backoffice and Zed gateway applications). However, both of these changes are not backward compatible. So, to make sure we do not break projects using old demoshop version, we are using `spryker.demoshop-version` attribute to apply these changes conditionally. + In order to make sure your project uses the right version of Elasticsearch and Zed root directory, make sure you set the right `spryker.demoshop-version` in your workspace.yml diff --git a/src/spryker/harness.yml b/src/spryker/harness.yml index 9dcde2e31..27272b37e 100644 --- a/src/spryker/harness.yml +++ b/src/spryker/harness.yml @@ -89,7 +89,7 @@ attributes: php-fpm: "= 'my127/spryker:' ~ @('php.version') ~ '-fpm-' ~ (@('php.version') >= 7.4 ? 'buster' : 'stretch')" elasticsearch: image: elasticsearch - tag: "= @('spryker.demoshop-version') <= '202009.0'? '6.8.23' : '7.16.3'" + tag: "= version_compare(@('spryker.demoshop-version'), '202009.0', '<=') ? '6.8.23' : '7.16.3'" hostname_aliases: "= replace(flatten([ @('glue.external_hosts'), @('yves.external_hosts'), From 36d430a3a9686ff285f23fb0d2ff8bf50fc11888 Mon Sep 17 00:00:00 2001 From: Hardik Gajjar Date: Fri, 28 Jan 2022 18:56:24 +0530 Subject: [PATCH 17/17] Remove install mutagen step for Spryker build --- Jenkinsfile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ad4df8e1f..2a48c1b0b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -250,15 +250,6 @@ pipeline { sh './test spryker dynamic' } } - // 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"