From 0c085f4984292323c436c18c51e45a85ad012917 Mon Sep 17 00:00:00 2001 From: Pavel Savushkin Date: Sun, 14 Mar 2021 15:17:38 +0200 Subject: [PATCH 1/2] feat(cassandra extension): upgrade version of cassandra and avoid installation for PHP 8.0 Cassandra should not be installed for PHP 8.0 due to unsupported PHP driver. See the issue's references. Closes #2876 --- workspace/Dockerfile | 48 ++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 1225fc8..e76643d 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -516,28 +516,32 @@ RUN if [ ${INSTALL_AMQP} = true ]; then \ ARG INSTALL_CASSANDRA=false RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ - apt-get install libgmp-dev -y && \ - curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/dependencies/libuv/v1.28.0/libuv1-dev_1.28.0-1_amd64.deb -o libuv1-dev.deb && \ - curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/dependencies/libuv/v1.28.0/libuv1_1.28.0-1_amd64.deb -o libuv1.deb && \ - curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.12.0/cassandra-cpp-driver-dev_2.12.0-1_amd64.deb -o cassandra-cpp-driver-dev.deb && \ - curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.12.0/cassandra-cpp-driver_2.12.0-1_amd64.deb -o cassandra-cpp-driver.deb && \ - dpkg -i libuv1.deb && \ - dpkg -i libuv1-dev.deb && \ - dpkg -i cassandra-cpp-driver.deb && \ - dpkg -i cassandra-cpp-driver-dev.deb && \ - rm libuv1.deb libuv1-dev.deb cassandra-cpp-driver-dev.deb cassandra-cpp-driver.deb && \ - cd /usr/src && \ - git clone https://github.com/datastax/php-driver.git && \ - cd /usr/src/php-driver/ext && \ - phpize && \ - mkdir /usr/src/php-driver/build && \ - cd /usr/src/php-driver/build && \ - ../ext/configure > /dev/null && \ - make clean >/dev/null && \ - make >/dev/null 2>&1 && \ - make install && \ - echo "extension=cassandra.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/cassandra.ini && \ - ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/cassandra.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-cassandra.ini \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ + echo "PHP Driver for Cassandra is not supported for PHP 8.0."; \ + else \ + apt-get install libgmp-dev -yqq && \ + curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/dependencies/libuv/v1.35.0/libuv1-dev_1.35.0-1_amd64.deb -o libuv1-dev.deb && \ + curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/dependencies/libuv/v1.35.0/libuv1_1.35.0-1_amd64.deb -o libuv1.deb && \ + curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.16.0/cassandra-cpp-driver-dev_2.16.0-1_amd64.deb -o cassandra-cpp-driver-dev.deb && \ + curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.16.0/cassandra-cpp-driver_2.16.0-1_amd64.deb -o cassandra-cpp-driver.deb && \ + dpkg -i libuv1.deb && \ + dpkg -i libuv1-dev.deb && \ + dpkg -i cassandra-cpp-driver.deb && \ + dpkg -i cassandra-cpp-driver-dev.deb && \ + rm libuv1.deb libuv1-dev.deb cassandra-cpp-driver-dev.deb cassandra-cpp-driver.deb && \ + cd /usr/src && \ + git clone https://github.com/datastax/php-driver.git && \ + cd /usr/src/php-driver/ext && \ + phpize && \ + mkdir /usr/src/php-driver/build && \ + cd /usr/src/php-driver/build && \ + ../ext/configure > /dev/null && \ + make clean >/dev/null && \ + make >/dev/null 2>&1 && \ + make install && \ + echo "extension=cassandra.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/cassandra.ini && \ + ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/cassandra.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-cassandra.ini; \ + fi \ ;fi ########################################################################### From 925e02bc7bfb06b73d19fdac70f98c45a18e4286 Mon Sep 17 00:00:00 2001 From: Pavel Savushkin Date: Sun, 14 Mar 2021 16:15:45 +0200 Subject: [PATCH 2/2] fix(cassandra extension): get installed cassandra for horizon and worker images Setup the installation on laravel-horizon and php-worker images. Closes #2876 --- docker-compose.yml | 2 +- env-example | 1 + laravel-horizon/Dockerfile | 33 ++++++++++++++++++--------------- php-fpm/Dockerfile | 35 +++++++++++++++++++++++++++++++++++ php-worker/Dockerfile | 33 ++++++++++++++++++--------------- 5 files changed, 73 insertions(+), 31 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e3a247c..9d653fe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -354,7 +354,7 @@ services: - INSTALL_MEMCACHED=${PHP_FPM_INSTALL_MEMCACHED} - INSTALL_SOCKETS=${LARAVEL_HORIZON_INSTALL_SOCKETS} - INSTALL_YAML=${LARAVEL_HORIZON_INSTALL_YAML} - - INSTALL_CASSANDRA=${PHP_FPM_INSTALL_CASSANDRA} + - INSTALL_CASSANDRA=${LARAVEL_HORIZON_INSTALL_CASSANDRA} - INSTALL_PHPREDIS=${LARAVEL_HORIZON_INSTALL_PHPREDIS} - INSTALL_MONGO=${LARAVEL_HORIZON_INSTALL_MONGO} - INSTALL_FFMPEG=${LARAVEL_HORIZON_INSTALL_FFMPEG} diff --git a/env-example b/env-example index aebc0b6..170cd5d 100644 --- a/env-example +++ b/env-example @@ -321,6 +321,7 @@ LARAVEL_HORIZON_INSTALL_YAML=false LARAVEL_HORIZON_INSTALL_ZIP_ARCHIVE=false LARAVEL_HORIZON_INSTALL_PHPREDIS=true LARAVEL_HORIZON_INSTALL_MONGO=false +LARAVEL_HORIZON_INSTALL_CASSANDRA=false LARAVEL_HORIZON_INSTALL_FFMPEG=false LARAVEL_HORIZON_INSTALL_AUDIOWAVEFORM=false LARAVEL_HORIZON_PGID=1000 diff --git a/laravel-horizon/Dockerfile b/laravel-horizon/Dockerfile index a05137e..fe34494 100644 --- a/laravel-horizon/Dockerfile +++ b/laravel-horizon/Dockerfile @@ -178,21 +178,24 @@ RUN if [ ${INSTALL_AUDIOWAVEFORM} = true ]; then \ # Install Cassandra drivers: ARG INSTALL_CASSANDRA=false RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ - apk --update add cassandra-cpp-driver \ - ;fi - -WORKDIR /usr/src -RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ - git clone https://github.com/datastax/php-driver.git \ - && cd php-driver/ext \ - && phpize \ - && mkdir -p /usr/src/php-driver/build \ - && cd /usr/src/php-driver/build \ - && ../ext/configure > /dev/null \ - && make clean >/dev/null \ - && make >/dev/null 2>&1 \ - && make install \ - && docker-php-ext-enable cassandra \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ + echo "PHP Driver for Cassandra is not supported for PHP 8.0."; \ + else \ + apk add --update --no-cache cassandra-cpp-driver libuv gmp \ + && apk add --update --no-cache cassandra-cpp-driver-dev gmp-dev --virtual .build-sec \ + && cd /usr/src \ + && git clone https://github.com/datastax/php-driver.git \ + && cd php-driver/ext \ + && phpize \ + && mkdir -p /usr/src/php-driver/build \ + && cd /usr/src/php-driver/build \ + && ../ext/configure > /dev/null \ + && make clean > /dev/null \ + && make > /dev/null 2>&1 \ + && make install \ + && docker-php-ext-enable cassandra \ + && apk del .build-sec; \ + fi \ ;fi # Install MongoDB drivers: diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 2d8d67e..d3e105f 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -389,6 +389,41 @@ RUN if [ ${INSTALL_AMQP} = true ]; then \ docker-php-ext-install sockets \ ;fi +########################################################################### +# CASSANDRA: +########################################################################### + +ARG INSTALL_CASSANDRA=false + +RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ + echo "PHP Driver for Cassandra is not supported for PHP 8.0."; \ + else \ + apt-get install libgmp-dev -yqq && \ + curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/dependencies/libuv/v1.35.0/libuv1-dev_1.35.0-1_amd64.deb -o libuv1-dev.deb && \ + curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/dependencies/libuv/v1.35.0/libuv1_1.35.0-1_amd64.deb -o libuv1.deb && \ + curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.16.0/cassandra-cpp-driver-dev_2.16.0-1_amd64.deb -o cassandra-cpp-driver-dev.deb && \ + curl https://downloads.datastax.com/cpp-driver/ubuntu/18.04/cassandra/v2.16.0/cassandra-cpp-driver_2.16.0-1_amd64.deb -o cassandra-cpp-driver.deb && \ + dpkg -i libuv1.deb && \ + dpkg -i libuv1-dev.deb && \ + dpkg -i cassandra-cpp-driver.deb && \ + dpkg -i cassandra-cpp-driver-dev.deb && \ + rm libuv1.deb libuv1-dev.deb cassandra-cpp-driver-dev.deb cassandra-cpp-driver.deb && \ + cd /usr/src && \ + git clone https://github.com/datastax/php-driver.git && \ + cd /usr/src/php-driver/ext && \ + phpize && \ + mkdir /usr/src/php-driver/build && \ + cd /usr/src/php-driver/build && \ + ../ext/configure > /dev/null && \ + make clean > /dev/null && \ + make > /dev/null 2>&1 && \ + make install && \ + echo "extension=cassandra.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/cassandra.ini && \ + ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/cassandra.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-cassandra.ini; \ + fi \ +;fi + ########################################################################### # GEARMAN: ########################################################################### diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index dcc8245..d3f9743 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -239,21 +239,24 @@ RUN if [ ${INSTALL_GEARMAN} = true ]; then \ # Install Cassandra drivers: ARG INSTALL_CASSANDRA=false RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ - apk --update add cassandra-cpp-driver \ - ;fi - -WORKDIR /usr/src -RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ - git clone https://github.com/datastax/php-driver.git \ - && cd php-driver/ext \ - && phpize \ - && mkdir -p /usr/src/php-driver/build \ - && cd /usr/src/php-driver/build \ - && ../ext/configure --with-php-config=/usr/bin/php-config7.1 > /dev/null \ - && make clean >/dev/null \ - && make >/dev/null 2>&1 \ - && make install \ - && docker-php-ext-enable cassandra \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \ + echo "PHP Driver for Cassandra is not supported for PHP 8.0."; \ + else \ + apk add --update --no-cache cassandra-cpp-driver libuv gmp \ + && apk add --update --no-cache cassandra-cpp-driver-dev gmp-dev --virtual .build-sec \ + && cd /usr/src \ + && git clone https://github.com/datastax/php-driver.git \ + && cd php-driver/ext \ + && phpize \ + && mkdir -p /usr/src/php-driver/build \ + && cd /usr/src/php-driver/build \ + && ../ext/configure > /dev/null \ + && make clean > /dev/null \ + && make > /dev/null 2>&1 \ + && make install \ + && docker-php-ext-enable cassandra \ + && apk del .build-sec; \ + fi \ ;fi # Install Phalcon ext