From e985b115ba1bd0b0618d282e92976297039a4967 Mon Sep 17 00:00:00 2001 From: Matteo Scaramuccia Date: Thu, 25 Jan 2018 23:05:17 +0100 Subject: [PATCH] [HACK] Install solr extension from source Resolves solr issue in #16, waiting for the upstream as described in #19 --- root/tmp/setup/php-extensions.sh | 3 ++- root/tmp/setup/solr-extension.sh | 36 ++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 root/tmp/setup/solr-extension.sh diff --git a/root/tmp/setup/php-extensions.sh b/root/tmp/setup/php-extensions.sh index 6355ece..f0120cc 100755 --- a/root/tmp/setup/php-extensions.sh +++ b/root/tmp/setup/php-extensions.sh @@ -35,7 +35,8 @@ docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ docker-php-ext-install -j$(nproc) ldap pecl install memcached redis apcu igbinary -docker-php-ext-enable memcached redis apcu igbinary +/tmp/setup/solr-extension.sh +docker-php-ext-enable solr memcached redis apcu igbinary echo 'apc.enable_cli = On' >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini diff --git a/root/tmp/setup/solr-extension.sh b/root/tmp/setup/solr-extension.sh new file mode 100755 index 0000000..b27b65a --- /dev/null +++ b/root/tmp/setup/solr-extension.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +set -e + +# HACK Install solr directly from git since the latest source tarball from PECL, 2.4.0, is outdated (2016-03-30). +# Ref: https://bugs.php.net/bug.php?id=75631 +# At the time of writing this script the latest commit in the source, https://github.com/php/pecl-search_engine-solr/, +# is de1d724299780d927cb9ed14268449ac8a28204b, dated 2017-09-07. +hash=de1d724299780d927cb9ed14268449ac8a28204b + +# Download our 'tagged' source code from git. +echo "Downloading solr extension source archive (${hash})" +curl --location \ + https://github.com/php/pecl-search_engine-solr/archive/${hash}.tar.gz \ + -o /tmp/pecl-search_engine-solr-${hash}.tar.gz +# Extract the compressed archive. +cd /tmp +tar -xvzf pecl-search_engine-solr-${hash}.tar.gz +cd pecl-search_engine-solr-${hash} + +# Compile the extension as required by a manual PECL installation. +echo "Compile solr extension" +phpize +./configure +make +# Finally, install it. +echo "Install solr extension" +make install + +# Remove all the sources. +echo "Cleanup temporary folder and files" +rm /tmp/pecl-search_engine-solr-${hash} -rf +rm /tmp/pecl-search_engine-solr-${hash}.tar.gz -f + +# Done with this hack. +# Please, follow https://github.com/moodlehq/moodle-php-apache/issues/19.