Closed Morgy93 closed 2 years ago
@Morgy93 Hi,
Did you check that sodium
extension is added to the list of extensions of your docker-compose.yaml
file?
It should be something like that:
generic:
hostname: generic.magento2.docker
image: 'magento/magento-cloud-docker-php:7.4-cli-1.2.4'
env_file: ./.docker/config.env
environment:
- 'PHP_EXTENSIONS=bcmath ..... sodium'
@oshmyheliuk Thanks for your reply!
Actually I'm using this for a GitLab Runner with .gitlab-ci.yml
While providing PHP_EXTENSIONS
with sodium
manually works fine, I think it should be included by default, shouldn't it?
Since it is a default requirement by Magento 2.4.3 and all~
@Morgy93 images are used for multiple versions though and I am pretty sure in older versions it was conflicting with the other extension that was used instead. It makes sense to bundle it into PHP 7.4+ though, since these versions were not available at the time of transition to Sodium, so they won't have issues most likely.
I have stuck into the same issue when running locally
curl https://raw.githubusercontent.com/magento/magento-cloud-docker/1.2.4/bin/init-docker.sh | bash -s -- --php 7.4
onto a fresh 2.4.3 template.
I can't reproduce this issue with templates:
` environment:
By default we have it in magento.app.yaml
runtime:
extensions:
- xsl
- json
- newrelic
- sodium
If this extension wasn't added such error occurs.
I have stuck into the same issue when running locally
curl https://raw.githubusercontent.com/magento/magento-cloud-docker/1.2.4/bin/init-docker.sh | bash -s -- --php 7.4
onto a fresh 2.4.3 template.
init-docker.sh uses the docker image tagged "magento/magento-cloud-docker-php:${PHP_VERSION}-cli-${IMAGE_VERSION}". And php-cli-7.2, php-cli-7.3... do NOT include the sodium extension in the proper way.
The init-docker.sh
script is my concern. Right now it can't install recent versions of Magento. Is there an easy way to enable all PHP extensions in the container? Something like PHP_EXTENSIONS=all
? I worked around the issue using the command below, but it's very wordy.
docker run --rm -e "MAGENTO_ROOT=/app" -e "PHP_EXTENSIONS=bcmath bz2 calendar exif gd gettext intl mysqli pcntl pdo_mysql soap sockets sysvmsg sysvsem sysvshm opcache zip xsl sodium" -v "$(pwd)":/app -v ~/.composer/cache:/composer/cache "magento/magento-cloud-docker-php:7.4-cli-1.2.4" composer install --ansi
@BaDos may you please take a look?
I see in the 1.2.2 release notes...
Sodium enabled by default—Enabled the sodium PHP extension by default within PHP Docker images.
https://devdocs.magento.com/cloud/release-notes/mcd-release-notes.html#v122
So, was this a regression? Or, was sodium removed on purpose?
I think ideally, if PHP_EXTENSIONS
is not defined, the base Magento PHP extension requirements should be enabled. Basically...
PHP_EXTENSIONS="bcmath bz2 calendar exif gd gettext intl mysqli pcntl pdo_mysql soap sockets sysvmsg sysvsem sysvshm opcache zip xsl sodium"
...should be a default value within the images.
Same problem here, I'm forced to use a --ignore-platform-reqs
on my composer install
command to get a fresh install of Magento withou having to use a docker-compose.yml
file.
The image is meant to be used as a standalone image, thus it should have all the requirements of Magento such as sodium.
Having the same issue today! Here is my workaround for being able to execute composer install.
docker run -it -v $(pwd):/app -w /app magento/magento-cloud-docker-php:7.4-cli-1.2.1 bash -c 'docker-php-ext-enable sodium && composer install'
@Axel29 this way you can avoid using the --ignore-platform-reqs
flag which should be always avoided, otherwise wrong incompatible may be installed.
@amansilla , you should try modifying command to just use recent containers instead of 1.2.1. If that still doesn't work - we will look at it additionally.
CC: @BaDos
@amansilla , you should try modifying command to just use recent containers instead of 1.2.1. If that still doesn't work - we will look at it additionally.
CC: @BaDos
@YPyltiai I tried it on the php7.4-cli-1.3.0 and it didn't work.
@amansilla , you should try modifying the command to just use recent containers instead of 1.2.1. If that still doesn't work - we will look at it additionally.
CC: @BaDos
Sorry for that, in fact I've tested both magento/magento-cloud-docker-php:7.4-cli-1.2.1
and magento/magento-cloud-docker-php:7.4-cli-1.3.0
and in both cases the extension is missing.
@BaDos , could you please take a look? I would expect https://github.com/magento/magento-cloud-docker/blob/develop/images/php/7.4-fpm/Dockerfile#L124-L135 had to install it by default but not clear why it doesn't happen.
Hi! All PHP images contain a lot of extensions, including sodium.
But these extensions are disabled by default, and we enable them only if PHP_EXTENSIONS
contains some of them
For example, the template has sodium
extension: https://github.com/magento/magento-cloud/blob/2.4.3/.magento.app.yaml#L18
When you run ./vendor/bin/ece-docker build:compose
this command reads .magento.app.yaml
and generates the correct docker-compose.yaml
file with sodium
We can add a new option to init-docker.sh
such as --ext
to provide a list of needed extensions.
Only optional extensions are expected to be configurable. Required extensions are expected to be up and working by default in a corresponding template.
Hi! All PHP images contain a lot of extensions, including sodium.
But these extensions are disabled by default, and we enable them only if
PHP_EXTENSIONS
contains some of themFor example, the template has
sodium
extension: https://github.com/magento/magento-cloud/blob/2.4.3/.magento.app.yaml#L18 When you run./vendor/bin/ece-docker build:compose
this command reads.magento.app.yaml
and generates the correctdocker-compose.yaml
file withsodium
Hello @BaDos ,
It doesn't really make sense to disable sodium by default, as the image is meant to be used for many commands, not only as a docker-compose service.
For example, in the official documentation, at the Run Composer with Docker, it is suggested to use the following command to run composer:
docker run -it -v $(pwd):/app/:delegated -v ~/.composer/:/root/.composer/:delegated magento/magento-cloud-docker-php:7.3-cli-1.1 bash -c "composer install&&chown www. /app/"
but this wouldn't use a docker-compose file, thus it won't read any "PHP_EXTENSIONS" line from it.
Since libsodium is a required extension for Magento, it should be (in my opinion) enabled by default in all of Magento Cloud Docker PHP images
@dshevtsov
Only optional extensions are expected to be configurable. Required extensions are expected to be up and working by default in a corresponding template.
init-docker.sh
does not read files form templates
@Alex29
I have checked our images/code
We are trying to support all Magento versions. Previous time there was a conflict when sodium
was enabled by default.
MCD 1.3.1 will have enabled sodium
by default.
Thank you for your contribution and for raising this issue!
This issue will be fixed as part of internal task MCLOUD-8364 and will be added in the next release of MCD 1.3.1
@BaDos When will MCD 1.3.1 be available?
@dunagan5887 hello!
We going to release MCD 1.3.1 in ~ a few weeks
@BaDos I'm currently testing the Docker PHP CLI 7.4-cli-1.3.1 image (linked here: https://hub.docker.com/layers/magento/magento-cloud-docker-php/7.4-cli-1.3.1/images/sha256-0c91371f027bb0fa5515b6e1cf32346d5c0fb39523f0e5a918e153dda13e36b3?context=explore) and still seeing sodium not being installed on CLI commands. Is this the version which was supposed to address this issue?
Overview
The php extension ext-sodium is missing for
magento/magento-cloud-docker-php
:7.4-cli-1.2.4
which is a requirement for Magento 2.4.3 to build. Also reported here: https://github.com/magento/magento2/issues/33743Preconditions
Magento 2.4.3 magento/magento-cloud-docker-php: 7.4-cli-1.2.4 (latest)
Steps to reproduce
Expected result
Build should succeed.
Actual result
Short:
Long: