swoole / docker-swoole

🏄 Official Docker Image of Swoole
https://hub.docker.com/r/phpswoole/swoole
Apache License 2.0
526 stars 112 forks source link

Suggest adding some common extensions to become more usable out of the box #33

Closed Yurunsoft closed 2 years ago

Yurunsoft commented 2 years ago

For example: redis, pdo_mysql, gd, etc.

image

image

liulyn commented 2 years ago

邮件已收到 谢谢!

MichonneHsu commented 2 years ago

支持搞一下

XiaoHai-Xie commented 2 years ago

So

deminy commented 2 years ago

Thanks for the suggestion. Extension redis and _pdomysql have been added to the nightly images (built daily using the latest code of Swoole):

docker run --rm -ti phpswoole/swoole:php8.0 php --ri pdo_mysql
# ...
docker run --rm -ti phpswoole/swoole:php8.2 php --ri redis

The two extensions won't be added to existing version-based images (e.g., 4.8.11 and 5.0.0), but they will be added to new images (4.8.12+ and 5.0.1+).

If you want to add the two extensions manually to an existing image, you can update the Dockerfile like this:

RUN \
    set -ex && \
    docker-php-ext-install pdo_mysql && \
    pecl channel-update pecl.php.net && \
    pecl install --configureoptions 'enable-redis-igbinary="no" enable-redis-lzf="no" enable-redis-zstd="no"' redis-stable && \
    docker-php-ext-enable redis
liulyn commented 1 year ago

邮件已收到 谢谢!

XhmikosR commented 1 year ago

Note that this was a breaking changefor us. Doctrine relies on Redis for caching on production, but we didn't have it installed (on purpose). When the docker image was updated to 4.8.12, Doctrine started throwing errors because it did see the Redis extension and no Redis present.

We have disabled the extension, still, it'd be nice to follow some kind of semver here. If this was made in v4.9 or bigger, it wouldn't have affected us.

deminy commented 1 year ago

Thanks for the feedback, and sorry for the inconvenience.

I agree that we shouldn't introduce backward-incompatible changes in minor versions of the images. However, there were a few reasons why I added the two extensions in the Docker images starting from 4.8.12+ and 5.0.1+:

Thus, we either have to wait until Swoole 6.0 is out (which is not in plan yet), or keep making it difficult for those who want to use Redis/PDO_MySQL in the Swoole images.

Thus, I made a hard decision to make this backward-incompatible change and included the details in the README and CHANGELOG files. It benefits new users but could cause problems for existing users. I will add instructions on how to disable/remove the two extensions.

On my side, I will avoid making it happen again. Thanks

XhmikosR commented 1 year ago

Just to clarify, if you did the change in a minor version, it'd be OK too, since the new image would have affected less users. I personally use the minor version tag so that I get patch fixes and reduce the chances for something to break.

Thanks for the reply!