From 4f004fa25fa18d424e2208d0673fb174b9df18d8 Mon Sep 17 00:00:00 2001 From: Kosta Harlan Date: Thu, 25 Nov 2021 20:23:15 +0100 Subject: [PATCH 1/2] Add ElasticSearch service * Install Docker in VM creation * Run ElasticSearch as a container using the image from releng/dev-images which has WMF plugins * Run CirrusSearch setup scripts in postinstall.sh Periodically cleaning up old search index data is not done in this patch. It can be done by deleting the volume associated with the container (since this is considered throwaway data). It would be nice if runJobs.php ran periodically for the wiki, as that's needed to process updates to the search index. Ideas welcome on how to do that. Fixes #356 --- localsettings/extensions-CirrusSearch.txt | 5 +++++ new/postinstall.sh | 9 +++++++++ setup.sh | 12 ++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 localsettings/extensions-CirrusSearch.txt diff --git a/localsettings/extensions-CirrusSearch.txt b/localsettings/extensions-CirrusSearch.txt new file mode 100644 index 00000000..47550e15 --- /dev/null +++ b/localsettings/extensions-CirrusSearch.txt @@ -0,0 +1,5 @@ +require_once "$IP/extensions/CirrusSearch/tests/jenkins/FullyFeaturedConfig.php"; +$wgCirrusSearchServers = [ 'localhost' ]; +$wgCirrusSearchWMFExtraFeatures = [ + 'weighted_tags' => [ 'build' => true, 'use' => true ] +]; diff --git a/new/postinstall.sh b/new/postinstall.sh index 52cf0e3c..a1750746 100755 --- a/new/postinstall.sh +++ b/new/postinstall.sh @@ -38,6 +38,15 @@ if [ -d $PATCHDEMO/wikis/$NAME/w/extensions/SecurePoll ]; then php $PATCHDEMO/wikis/$NAME/w/maintenance/createAndPromote.php "Patch Demo" --force --custom-groups electionadmin fi +# CirrusSearch +if [ -d $PATCHDEMO/wikis/$NAME/w/extensions/CirrusSearch ]; then + php $PATCHDEMO/wikis/$NAME/w/maintenance/update.php --quick + php $PATCHDEMO/wikis/$NAME/w/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php + php $PATCHDEMO/wikis/$NAME/w/extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipLinks --indexOnSkip + php $PATCHDEMO/wikis/$NAME/w/extensions/CirrusSearch/maintenance/ForceSearchIndex.php --skipParse + php $PATCHDEMO/wikis/$NAME/w/maintenance/runJobs.php +fi + # import extension/skin/service-specific XML dumps while IFS=' ' read -r repo dir; do filename=$(echo $repo | sed "s/\//-/g" | sed "s/^mediawiki-//") diff --git a/setup.sh b/setup.sh index 54e46250..f48189c6 100755 --- a/setup.sh +++ b/setup.sh @@ -3,6 +3,18 @@ sudo apt-get install apache2 default-mysql-server php libapache2-mod-php php-mys # dependencies of our system sudo apt-get install git composer npm unzip rdfind +# Docker +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh +# ElasticSearch +docker run -d --restart=always \ + -v elasticdata:/usr/share/elasticsearch/data \ + -e "discovery.type=single-node" \ + -e "bootstrap.system_call_filter=false" \ + -p 9200:9200 \ + -p 9300:9300 \ + docker-registry.wikimedia.org/dev/stretch-elasticsearch:0.1.0 + # create master copies of repositories sudo -u www-data mkdir repositories cd repositories From b770ca58a70702dbf680eda21b919e381e34b1c5 Mon Sep 17 00:00:00 2001 From: Kosta Harlan Date: Thu, 25 Nov 2021 20:26:58 +0100 Subject: [PATCH 2/2] Document where the convenience script comes from --- setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.sh b/setup.sh index f48189c6..3df2925f 100755 --- a/setup.sh +++ b/setup.sh @@ -4,6 +4,7 @@ sudo apt-get install apache2 default-mysql-server php libapache2-mod-php php-mys sudo apt-get install git composer npm unzip rdfind # Docker +# https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh # ElasticSearch