integer-net / magento2-requirejs-bundling

Tools, patches and snippets for Magento 2 RequireJS Bundling
23 stars 20 forks source link

The "patches/composer/M233/github-pr-25587-base.diff" file could not be downloaded: failed to open stream: No such file or directory #4

Closed zzvara closed 4 years ago

zzvara commented 4 years ago
root@magento-6549c69ff9-79tp8:/opt/bitnami/magento/htdocs# composer install
Gathering patches for root package.
Removing package magento/magento2-base so that it can be re-installed and re-patched.
  - Removing magento/magento2-base (2.3.4)
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 1 install, 0 updates, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing magento/magento2-base (2.3.4): Loading from cache
  - Applying patches for magento/magento2-base
    patches/composer/M233/github-pr-25587-base.diff (Refactor JavaScript mixins module https://github.com/magento/magento2/pull/25587)
Deprecation Notice: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:233
Deprecation Notice: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in phar:///opt/bitnami/php/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:233
   Could not apply patch! Skipping. The error was: The "patches/composer/M233/github-pr-25587-base.diff" file could not be downloaded: failed to open stream: No such file or directory

  [Exception]
  Cannot apply patch Refactor JavaScript mixins module https://github.com/magento/magento2/pull/25587 (patches/composer
  /M233/github-pr-25587-base.diff)!

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
wigman commented 4 years ago

Did you even download the patches to your project?

zzvara commented 4 years ago

No, how should I do that? Isn't the composer module also for that? The documentation is not very clear to me in this regard.

Moreover, if I upgrade to Magento 2.3.5 I should require this patch, is that so? Is it in the 2.3.5 release?

wigman commented 4 years ago

There’s a blogpost, it explains everything step by step.

I have not tested / checked whether the last patch is still needed for 2.3.5.

zzvara commented 4 years ago

I will upgrade the base image in my Dockerfile. Everything, including Baler is automatically built in Docker build anyway. I will report back.

wigman commented 4 years ago

Okay. I checked and the patch is still needed. The remaining question is whether the patch still works on 2.3.5 If it works, everything’s okay.

Otherwise, I’ll need to revise a new patch. If you can report back, it would be appreciated.

zzvara commented 4 years ago

What I did:

I'm happy since it is fully reproducable and upgradable and it works. Varnish is not even deployed on the staging environment, but with the custom theme it reports the following:

image

I can confirm that it works with 2.3.5.

zzvara commented 4 years ago

After that what I did is that I copied the production database to staging database, just to reproduce everything, and then I restarted the container. I started to see these:

image

This is what I do every time the container starts:


echo "Setting up Baler."
sudo -u bitnami php -d memory_limit=8192M bin/magento module:enable Magento_Baler || true
sudo -u bitnami php bin/magento config:set dev/js/enable_baler_js_bundling 1 || true
# Disable incompatible features as suggested by [https://github.com/magento/baler/blob/master/docs/ALPHA.md#disable-incompatible-features-in-magento].
sudo -u bitnami php bin/magento config:set dev/js/minify_files 0 || true
sudo -u bitnami php bin/magento config:set dev/js/enable_js_bundling 0 || true
sudo -u bitnami php bin/magento config:set dev/js/merge_files 0 || true

echo "Running upgrade on Magento."
sudo -u bitnami php -d memory_limit=8192M /opt/bitnami/magento/htdocs/bin/magento setup:upgrade -vvv || true

echo "Running compile on Magento."
sudo -u bitnami php -d memory_limit=8192M /opt/bitnami/magento/htdocs/bin/magento setup:di:compile -vvv || true

echo "Running deployment on Magento sources."
sudo -u bitnami rm -rf pub/static
sudo -u bitnami php -d memory_limit=8192M /opt/bitnami/magento/htdocs/bin/magento setup:static-content:deploy -f -vvv || true

echo "Running Baler."
chmod a+x /usr/local/bin/baler
sudo -u bitnami baler build

All checks out.

This is how I install Baler in the Dockerfile:


# Installing Baler.
RUN git clone https://github.com/magento/baler.git
WORKDIR /opt/bitnami/magento/htdocs/baler
RUN npm install || exit 1
RUN npm test || exit 1
RUN npm run build || exit 1

USER root
RUN npm link || exit 1

USER bitnami:daemon

WORKDIR /opt/bitnami/magento/htdocs

RUN composer require mageplaza/module-core
RUN composer require mageplaza/module-smtp
RUN composer require mageplaza/module-gdpr
RUN composer require mageplaza/magento-2-social-login
RUN composer require dhl/module-rates-express
RUN composer require mageplaza/magento-2-hungarian-language-pack:dev-master

# Continue installing Baler.
RUN sed -i "s|\"minimum-stability\": \"stable\"|\"minimum-stability\": \"dev\",\n\"prefer-stable\": true|g" composer.json
RUN echo "Composer JSON updated as follows:"
RUN cat composer.json
RUN composer config repositories.magento-baler vcs git@github.com:magento/m2-baler.git
RUN composer require magento/module-baler:dev-master
# Fix for Baler as showed on [https://www.integer-net.com/magento-2-javascript-bundling-setup-default/#bundling-patches].
RUN wget https://github.com/magento/magento2/pull/25587.diff || exit 1
RUN mkdir -p patches/composer/M234/
RUN mv 25587.diff patches/composer/M234/25587.diff
RUN composer require cweagans/composer-patches || exit 1
RUN sed -i "s|\"magento-force\": \"override\"|\"magento-force\": \"override\",\n\"composer-exit-on-patch-failure\": true,\n\"patches\": {\n\"magento/magento2-base\": {\n\"Refactor JavaScript mixins module https://github.com/magento/magento2/pull/25587\": \"patches/composer/M234/25587.diff\"\n}\n}|g" composer.json || exit 1
RUN composer install || exit 1