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

Update proxy_url key #127

Merged
merged 1 commit into from
Oct 1, 2024
Merged

Update proxy_url key #127

merged 1 commit into from
Oct 1, 2024

Conversation

Copy link

github-actions bot commented Oct 1, 2024

Thanks for the PR 😍

How to test these changes in your application

  1. Add the Shopware flex endpoint in your composer.json to https://raw.githubusercontent.com/shopware/recipes/flex/pull-127/index.json.

    # When jq is installed
    jq '.extra.symfony.endpoint |= [ "https://raw.githubusercontent.com/shopware/recipes/flex/pull-127/index.json" ] + .' composer.json > composer.tmp && mv composer.tmp composer.json

    or manually

    "endpoint": [
        "https://raw.githubusercontent.com/shopware/recipes/flex/pull-127/index.json",
        "https://raw.githubusercontent.com/shopware/recipes/flex/main/index.json",
        "flex://defaults"
    ]
  2. Install the package(s) related to this recipe:

    composer req 'shopware/platform:^6.6' 'shopware/storefront:^6.6'

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
I'm going keep this comment up to date with any updates of the attached patch.

shopware/platform

6.4 vs 6.6
diff --git a/shopware/platform/6.4/bin/build-administration.sh b/shopware/platform/6.6/bin/build-administration.sh
index f590aa5..0c03adc 100755
--- a/shopware/platform/6.4/bin/build-administration.sh
+++ b/shopware/platform/6.6/bin/build-administration.sh
@@ -4,6 +4,9 @@ CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
 
 export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
 export ENV_FILE=${ENV_FILE:-"${PROJECT_ROOT}/.env"}
+export NPM_CONFIG_FUND=false
+export NPM_CONFIG_AUDIT=false
+export NPM_CONFIG_UPDATE_NOTIFIER=false
 
 # shellcheck source=functions.sh
 source "${PROJECT_ROOT}/bin/functions.sh"
@@ -71,7 +74,7 @@ else
     echo "Cannot check extensions for required npm installations as jq is not installed"
 fi
 
-(cd "${ADMIN_ROOT}"/Resources/app/administration && npm install --no-audit --prefer-offline)
+(cd "${ADMIN_ROOT}"/Resources/app/administration && npm install --prefer-offline --production)
 
 # Dump entity schema
 if [[ -z "${SHOPWARE_SKIP_ENTITY_SCHEMA_DUMP:-""}" ]] && [[ -f "${ADMIN_ROOT}"/Resources/app/administration/scripts/entitySchemaConverter/entity-schema-converter.ts ]]; then
diff --git a/shopware/platform/6.4/bin/build-storefront.sh b/shopware/platform/6.6/bin/build-storefront.sh
index 410d5a7..1859856 100755
--- a/shopware/platform/6.4/bin/build-storefront.sh
+++ b/shopware/platform/6.6/bin/build-storefront.sh
@@ -6,6 +6,9 @@ set -euo pipefail
 
 export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
 export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
+export NPM_CONFIG_FUND=false
+export NPM_CONFIG_AUDIT=false
+export NPM_CONFIG_UPDATE_NOTIFIER=false
 
 if [[ -e "${PROJECT_ROOT}/vendor/shopware/platform" ]]; then
     STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/platform/src/Storefront"}"
@@ -47,7 +50,7 @@ if [[ $(command -v jq) ]]; then
         if [[ -f "$path/package.json" && ! -d "$path/node_modules" && $name != "storefront" ]]; then
             echo "=> Installing npm dependencies for ${name}"
 
-            npm install --prefix "$path" --no-audit --prefer-offline
+            npm install --prefix "$path" --prefer-offline
         fi
     done
     cd "$OLDPWD" || exit
@@ -55,8 +58,12 @@ else
     echo "Cannot check extensions for required npm installations as jq is not installed"
 fi
 
-npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --no-audit --prefer-offline
+npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --prefer-offline --production
 node "${STOREFRONT_ROOT}"/Resources/app/storefront/copy-to-vendor.js
 npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run production
 [[ ${SHOPWARE_SKIP_ASSET_COPY:-""} ]] ||"${BIN_TOOL}" assets:install
-[[ ${SHOPWARE_SKIP_THEME_COMPILE:-""} ]] || "${BIN_TOOL}" theme:compile
+[[ ${SHOPWARE_SKIP_THEME_COMPILE:-""} ]] || "${BIN_TOOL}" theme:compile --active-only
+
+if ! [ "${1:-default}" = "--keep-cache" ]; then
+    "${BIN_TOOL}" cache:clear
+fi
diff --git a/shopware/platform/6.4/bin/ci b/shopware/platform/6.6/bin/ci
index e9f453b..661c0fa 100755
--- a/shopware/platform/6.4/bin/ci
+++ b/shopware/platform/6.6/bin/ci
@@ -3,7 +3,6 @@
 
 use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
 use Shopware\Core\Framework\Plugin\KernelPluginLoader\ComposerPluginLoader;
-use Shopware\Core\HttpKernel;
 use Symfony\Bundle\FrameworkBundle\Console\Application;
 use Symfony\Component\Console\Input\ArgvInput;
 
@@ -39,18 +38,12 @@ return static function (array &$context) {
         $_SERVER['DATABASE_URL'] = 'mysql://_placeholder.test';
     }
 
-    if (method_exists(KernelFactory::class, "create")) {
-        $kernel = KernelFactory::create(
-            environment: $env,
-            debug: $debug,
-            classLoader: $classLoader,
-            pluginLoader: new ComposerPluginLoader($classLoader, null)
-        );
-    } else {
-        $kernel = new HttpKernel($env, $debug, $classLoader);
-        $kernel->setPluginLoader(new ComposerPluginLoader($classLoader, null));
-        $kernel = $kernel->getKernel();
-    }
+    $kernel = KernelFactory::create(
+        environment: $env,
+        debug: $debug,
+        classLoader: $classLoader,
+        pluginLoader: new ComposerPluginLoader($classLoader, null),
+    );
 
     $application = new Application($kernel);
     $kernel->boot();
diff --git a/shopware/platform/6.4/bin/console b/shopware/platform/6.6/bin/console
index 6ec51be..5d89fb3 100755
--- a/shopware/platform/6.4/bin/console
+++ b/shopware/platform/6.6/bin/console
@@ -4,7 +4,6 @@
 use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
 use Shopware\Core\Framework\Plugin\KernelPluginLoader\DbalKernelPluginLoader;
 use Shopware\Core\Framework\Plugin\KernelPluginLoader\StaticKernelPluginLoader;
-use Shopware\Core\HttpKernel;
 use Shopware\Core\Kernel;
 use Symfony\Bundle\FrameworkBundle\Console\Application;
 use Symfony\Component\Console\Input\ArgvInput;
@@ -40,25 +39,16 @@ return static function (array &$context) {
         $context['INSTALL'] = true;
     }
 
-    if (trim($context['DATABASE_URL'] ?? '') === '') {
-        // fake DATABASE_URL
-        $_SERVER['DATABASE_URL'] = 'mysql://_placeholder.test';
-    } else if (!isset($context['INSTALL'])) {
-        $pluginLoader = new DbalKernelPluginLoader($classLoader, null, \Shopware\Core\Kernel::getConnection());
+    if (trim($context['DATABASE_URL'] ?? '') !== '' && !isset($context['INSTALL'])) {
+        $pluginLoader = new DbalKernelPluginLoader($classLoader, null, Kernel::getConnection());
     }
 
-    if (method_exists(KernelFactory::class, "create")) {
-        $kernel = KernelFactory::create(
-            environment: $env,
-            debug: $debug,
-            classLoader: $classLoader,
-            pluginLoader: $pluginLoader
-        );
-    } else {
-        $kernel = new HttpKernel($env, $debug, $classLoader);
-        $kernel->setPluginLoader($pluginLoader);
-        $kernel = $kernel->getKernel();
-    }
+    $kernel = KernelFactory::create(
+        environment: $env,
+        debug: $debug,
+        classLoader: $classLoader,
+        pluginLoader: $pluginLoader
+    );
 
     $application = new Application($kernel);
     $kernel->boot();
diff --git a/shopware/platform/6.4/bin/watch-administration.sh b/shopware/platform/6.6/bin/watch-administration.sh
index 060866e..5e89f3d 100755
--- a/shopware/platform/6.4/bin/watch-administration.sh
+++ b/shopware/platform/6.6/bin/watch-administration.sh
@@ -55,7 +55,7 @@ else
     echo "Cannot check extensions for required npm installations as jq is not installed"
 fi
 
-if [ ! -d vendor/shopware/administration/Resources/app/administration/node_modules ]; then
+if [ ! -d vendor/shopware/administration/Resources/app/administration/node_modules/webpack-dev-server ]; then
     npm install --prefix vendor/shopware/administration/Resources/app/administration/
 fi
 
diff --git a/shopware/platform/6.4/bin/watch-storefront.sh b/shopware/platform/6.6/bin/watch-storefront.sh
index f6c9015..3e6a4fa 100755
--- a/shopware/platform/6.4/bin/watch-storefront.sh
+++ b/shopware/platform/6.6/bin/watch-storefront.sh
@@ -4,6 +4,9 @@ CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
 
 export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
 export ENV_FILE=${ENV_FILE:-"${PROJECT_ROOT}/.env"}
+export NPM_CONFIG_FUND=false
+export NPM_CONFIG_AUDIT=false
+export NPM_CONFIG_UPDATE_NOTIFIER=false
 
 # shellcheck source=functions.sh
 source "${PROJECT_ROOT}/bin/functions.sh"
@@ -23,8 +26,19 @@ export PROXY_URL
 export STOREFRONT_ASSETS_PORT
 export STOREFRONT_PROXY_PORT
 
-DATABASE_URL="" "${CWD}"/console feature:dump
-"${CWD}"/console theme:compile
+if [[ -e "${PROJECT_ROOT}/vendor/shopware/platform" ]]; then
+    STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/platform/src/Storefront"}"
+else
+    STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/storefront"}"
+fi
+
+if [[ ! -d "${STOREFRONT_ROOT}"/Resources/app/storefront/node_modules/webpack-dev-server ]]; then
+    npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --prefer-offline
+fi
+
+"${CWD}"/console bundle:dump
+"${CWD}"/console feature:dump
+"${CWD}"/console theme:compile --active-only
 "${CWD}"/console theme:dump
 
 if [[ $(command -v jq) ]]; then
@@ -55,4 +69,4 @@ else
     echo "Cannot check extensions for required npm installations as jq is not installed"
 fi
 
-npm --prefix vendor/shopware/storefront/Resources/app/storefront/ run-script hot-proxy
+npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run-script hot-proxy
diff --git a/shopware/platform/6.4/manifest.json b/shopware/platform/6.6/manifest.json
index 24d2f4e..9c8883f 100644
--- a/shopware/platform/6.4/manifest.json
+++ b/shopware/platform/6.6/manifest.json
@@ -56,7 +56,7 @@
         "DATABASE_URL": "mysql:\/\/root:root@localhost\/shopware",
         "#1": "With Shopware 6.4.17.0 the MAILER_DSN variable will be used in this template instead of MAILER_URL",
         "MAILER_URL": "null:\/\/null",
-        "STOREFRONT_PROXY_URL": "http:\/\/localhost",
+        "PROXY_URL": "http:\/\/localhost",
         "SHOPWARE_HTTP_CACHE_ENABLED": "1",
         "SHOPWARE_HTTP_DEFAULT_TTL": "7200",
         "OPENSEARCH_URL": "http:\/\/localhost:9200",
@@ -80,8 +80,7 @@
         "!\/var\/.htaccess",
         "\/auth.json",
         "\/install.lock",
-        "public\/asset-manifest.json",
-        "files\/asset-manifest.json"
+        "public\/asset-manifest.json"
     ],
     "composer-scripts": {
         "assets:install": "symfony-cmd"
diff --git a/shopware/platform/6.4/post-install.txt b/shopware/platform/6.6/post-install.txt
index 36869a6..18d1b8f 100644
--- a/shopware/platform/6.4/post-install.txt
+++ b/shopware/platform/6.6/post-install.txt
@@ -19,8 +19,3 @@
     5. Optional: Open the Mail catcher with symfony open:local:webmail
 
   * Read the documentation at https://developer.shopware.com/
-
-  * Warning if updating from older versions of the production template:
-
-    There might be old `require-dev` dependencies in your `composer.json` file. Please remove them before updating shopware/core to versions >= v6.4.
-    You can do it using this command: composer config --unset require-dev
diff --git a/shopware/platform/6.4/public/index.php b/shopware/platform/6.6/public/index.php
index eb330c6..61c8694 100644
--- a/shopware/platform/6.4/public/index.php
+++ b/shopware/platform/6.6/public/index.php
@@ -2,13 +2,9 @@
 
 use Shopware\Core\DevOps\Environment\EnvironmentHelper;
 use Shopware\Core\Framework\Plugin\KernelPluginLoader\ComposerPluginLoader;
-use Shopware\Core\HttpKernel;
 use Shopware\Core\Installer\InstallerKernel;
-use Symfony\Component\HttpFoundation\Request;
 use Shopware\Core\Framework\Adapter\Kernel\KernelFactory;
 use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpKernel\HttpKernelInterface;
-use Symfony\Component\HttpKernel\TerminableInterface;
 
 $_SERVER['SCRIPT_FILENAME'] = __FILE__;
 
@@ -34,62 +30,20 @@ return function (array $context) {
     $appEnv = $context['APP_ENV'] ?? 'dev';
     $debug = (bool) ($context['APP_DEBUG'] ?? ($appEnv !== 'prod'));
 
-    $trustedProxies = $context['TRUSTED_PROXIES'] ?? false;
-    if ($trustedProxies) {
-        Request::setTrustedProxies(
-            explode(',', $trustedProxies),
-            Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO
-        );
-    }
-
-    $trustedHosts = $context['TRUSTED_HOSTS'] ?? false;
-    if ($trustedHosts) {
-        Request::setTrustedHosts(explode(',', $trustedHosts));
-    }
-
     if (!EnvironmentHelper::getVariable('SHOPWARE_SKIP_WEBINSTALLER', false) && !file_exists(dirname(__DIR__) . '/install.lock')) {
         return new InstallerKernel($appEnv, $debug);
     }
 
-    if (method_exists(KernelFactory::class, "create")) {
-        $pluginLoader = null;
-        if (EnvironmentHelper::getVariable('COMPOSER_PLUGIN_LOADER', false)) {
-            $pluginLoader = new ComposerPluginLoader($classLoader, null);
-        }
-
-        return KernelFactory::create(
-            environment: $appEnv,
-            debug: $debug,
-            classLoader: $classLoader,
-            pluginLoader: $pluginLoader
-        );
-    }
-
-    $shopwareHttpKernel = new HttpKernel($appEnv, $debug, $classLoader);
+    $pluginLoader = null;
 
     if (EnvironmentHelper::getVariable('COMPOSER_PLUGIN_LOADER', false)) {
-        $shopwareHttpKernel->setPluginLoader(
-            new ComposerPluginLoader($classLoader, null)
-        );
+        $pluginLoader = new ComposerPluginLoader($classLoader, null);
     }
 
-    return new class($shopwareHttpKernel) implements HttpKernelInterface, TerminableInterface {
-        private HttpKernel $httpKernel;
-
-        public function __construct(HttpKernel $httpKernel)
-        {
-            $this->httpKernel = $httpKernel;
-        }
-
-        public function handle(Request $request, int $type = self::MAIN_REQUEST, bool $catch = true): Response
-        {
-            return $this->httpKernel->handle($request, $type, $catch)->getResponse();
-        }
-
-        public function terminate(Request $request, Response $response): void
-        {
-            $this->httpKernel->terminate($request, $response);
-        }
-    };
+    return KernelFactory::create(
+        environment: $appEnv,
+        debug: $debug,
+        classLoader: $classLoader,
+        pluginLoader: $pluginLoader
+    );
 };
-

shopware/storefront

6.4 vs 6.6
diff --git a/shopware/storefront/6.4/bin/build-storefront.sh b/shopware/storefront/6.6/bin/build-storefront.sh
index 410d5a7..1859856 100755
--- a/shopware/storefront/6.4/bin/build-storefront.sh
+++ b/shopware/storefront/6.6/bin/build-storefront.sh
@@ -6,6 +6,9 @@ set -euo pipefail
 
 export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
 export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
+export NPM_CONFIG_FUND=false
+export NPM_CONFIG_AUDIT=false
+export NPM_CONFIG_UPDATE_NOTIFIER=false
 
 if [[ -e "${PROJECT_ROOT}/vendor/shopware/platform" ]]; then
     STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/platform/src/Storefront"}"
@@ -47,7 +50,7 @@ if [[ $(command -v jq) ]]; then
         if [[ -f "$path/package.json" && ! -d "$path/node_modules" && $name != "storefront" ]]; then
             echo "=> Installing npm dependencies for ${name}"
 
-            npm install --prefix "$path" --no-audit --prefer-offline
+            npm install --prefix "$path" --prefer-offline
         fi
     done
     cd "$OLDPWD" || exit
@@ -55,8 +58,12 @@ else
     echo "Cannot check extensions for required npm installations as jq is not installed"
 fi
 
-npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --no-audit --prefer-offline
+npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --prefer-offline --production
 node "${STOREFRONT_ROOT}"/Resources/app/storefront/copy-to-vendor.js
 npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run production
 [[ ${SHOPWARE_SKIP_ASSET_COPY:-""} ]] ||"${BIN_TOOL}" assets:install
-[[ ${SHOPWARE_SKIP_THEME_COMPILE:-""} ]] || "${BIN_TOOL}" theme:compile
+[[ ${SHOPWARE_SKIP_THEME_COMPILE:-""} ]] || "${BIN_TOOL}" theme:compile --active-only
+
+if ! [ "${1:-default}" = "--keep-cache" ]; then
+    "${BIN_TOOL}" cache:clear
+fi
diff --git a/shopware/storefront/6.4/bin/watch-storefront.sh b/shopware/storefront/6.6/bin/watch-storefront.sh
index f6c9015..3e6a4fa 100755
--- a/shopware/storefront/6.4/bin/watch-storefront.sh
+++ b/shopware/storefront/6.6/bin/watch-storefront.sh
@@ -4,6 +4,9 @@ CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
 
 export PROJECT_ROOT="${PROJECT_ROOT:-"$(dirname "$CWD")"}"
 export ENV_FILE=${ENV_FILE:-"${PROJECT_ROOT}/.env"}
+export NPM_CONFIG_FUND=false
+export NPM_CONFIG_AUDIT=false
+export NPM_CONFIG_UPDATE_NOTIFIER=false
 
 # shellcheck source=functions.sh
 source "${PROJECT_ROOT}/bin/functions.sh"
@@ -23,8 +26,19 @@ export PROXY_URL
 export STOREFRONT_ASSETS_PORT
 export STOREFRONT_PROXY_PORT
 
-DATABASE_URL="" "${CWD}"/console feature:dump
-"${CWD}"/console theme:compile
+if [[ -e "${PROJECT_ROOT}/vendor/shopware/platform" ]]; then
+    STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/platform/src/Storefront"}"
+else
+    STOREFRONT_ROOT="${STOREFRONT_ROOT:-"${PROJECT_ROOT}/vendor/shopware/storefront"}"
+fi
+
+if [[ ! -d "${STOREFRONT_ROOT}"/Resources/app/storefront/node_modules/webpack-dev-server ]]; then
+    npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront install --prefer-offline
+fi
+
+"${CWD}"/console bundle:dump
+"${CWD}"/console feature:dump
+"${CWD}"/console theme:compile --active-only
 "${CWD}"/console theme:dump
 
 if [[ $(command -v jq) ]]; then
@@ -55,4 +69,4 @@ else
     echo "Cannot check extensions for required npm installations as jq is not installed"
 fi
 
-npm --prefix vendor/shopware/storefront/Resources/app/storefront/ run-script hot-proxy
+npm --prefix "${STOREFRONT_ROOT}"/Resources/app/storefront run-script hot-proxy
diff --git a/shopware/storefront/6.4/manifest.json b/shopware/storefront/6.6/manifest.json
index 3536fe4..cb880b5 100644
--- a/shopware/storefront/6.4/manifest.json
+++ b/shopware/storefront/6.6/manifest.json
@@ -8,7 +8,7 @@
         "bin/": "%BIN_DIR%/"
     },
     "env": {
-        "STOREFRONT_PROXY_URL": "http://localhost",
+        "PROXY_URL": "http://localhost",
         "SHOPWARE_HTTP_CACHE_ENABLED": "1",
         "SHOPWARE_HTTP_DEFAULT_TTL": "7200"
     }

@shyim
Copy link
Member

shyim commented Oct 1, 2024

we don't need to update shopware/shopware. It inserts an old flex version, which will be upgraded

@shyim shyim merged commit 3be03a7 into shopware:main Oct 1, 2024
2 checks passed
@PheysX PheysX deleted the ft-1 branch October 2, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants