Skip to content

Commit

Permalink
[HACK] Install solr extension from source
Browse files Browse the repository at this point in the history
Resolves solr issue in moodlehq#16, waiting for the upstream as described in moodlehq#19
  • Loading branch information
scara committed Jan 25, 2018
1 parent aaf7d05 commit e985b11
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
3 changes: 2 additions & 1 deletion root/tmp/setup/php-extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
36 changes: 36 additions & 0 deletions root/tmp/setup/solr-extension.sh
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit e985b11

Please sign in to comment.