Merge pull request #1044 from nextcloud/enh/1036/fulltextsearch

add fulltextsearch as option
This commit is contained in:
Simon L 2022-08-25 12:58:18 +02:00 committed by GitHub
commit 40efd3092f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 157 additions and 5 deletions

View file

@ -0,0 +1,4 @@
# Probably from here https://github.com/elastic/elasticsearch/blob/main/distribution/docker/src/docker/Dockerfile
FROM elasticsearch:7.17.5
RUN elasticsearch /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch ingest-attachment

View file

@ -238,7 +238,8 @@ RUN set -ex; \
chmod +r /upgrade.exclude && \
chmod +x /cron.sh && \
chmod +x /notify.sh && \
chmod +x /activate-collabora.sh
chmod +x /activate-collabora.sh && \
chmod +x /activate-fulltextsearch.sh
RUN set -ex; \
mkdir /mnt/ncdata; \

View file

@ -2,7 +2,7 @@
if [ "$COLLABORA_ENABLED" != yes ]; then
# Basically sleep for forever if collabora is not enabled
sleep 365d
sleep inf
fi
while ! nc -z "$NC_DOMAIN" 443; do
sleep 5
@ -10,4 +10,4 @@ done
sleep 10
echo "Activating collabora config..."
php /var/www/html/occ richdocuments:activate-config
sleep 365d
sleep inf

View file

@ -0,0 +1,9 @@
#!/bin/bash
if [ "$FULLTEXTSEARCH_ENABLED" != yes ]; then
# Basically sleep for forever if fulltextsearch is not enabled
sleep inf
fi
echo "Activating fulltextsearch..."
php /var/www/html/occ fulltextsearch:live -q
sleep inf

View file

@ -434,5 +434,47 @@ if version_greater "$installed_version" "24.0.0.0"; then
fi
fi
# Fulltextsearch
if [ "$FULLTEXTSEARCH_ENABLED" = 'yes' ]; then
while ! nc -z "$FULLTEXTSEARCH_HOST" 9200; do
echo "waiting for Fulltextsearch to become available..."
sleep 5
done
if ! [ -d "/var/www/html/custom_apps/fulltextsearch" ]; then
php /var/www/html/occ app:install fulltextsearch
elif [ "$(php /var/www/html/occ config:app:get fulltextsearch enabled)" = "no" ]; then
php /var/www/html/occ app:enable fulltextsearch
else
php /var/www/html/occ app:update fulltextsearch
fi
if ! [ -d "/var/www/html/custom_apps/fulltextsearch_elasticsearch" ]; then
php /var/www/html/occ app:install fulltextsearch_elasticsearch
elif [ "$(php /var/www/html/occ config:app:get fulltextsearch_elasticsearch enabled)" = "no" ]; then
php /var/www/html/occ app:enable fulltextsearch_elasticsearch
else
php /var/www/html/occ app:update fulltextsearch_elasticsearch
fi
if ! [ -d "/var/www/html/custom_apps/files_fulltextsearch" ]; then
php /var/www/html/occ app:install files_fulltextsearch
elif [ "$(php /var/www/html/occ config:app:get files_fulltextsearch enabled)" = "no" ]; then
php /var/www/html/occ app:enable files_fulltextsearch
else
php /var/www/html/occ app:update files_fulltextsearch
fi
php /var/www/html/occ fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_Elasticsearch\\Platform\\ElasticSearchPlatform"}'
php /var/www/html/occ fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://$FULLTEXTSEARCH_HOST:9200\"}"
php /var/www/html/occ files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}"
else
if [ -d "/var/www/html/custom_apps/fulltextsearch" ]; then
php /var/www/html/occ app:remove fulltextsearch
fi
if [ -d "/var/www/html/custom_apps/fulltextsearch_elasticsearch" ]; then
php /var/www/html/occ app:remove fulltextsearch_elasticsearch
fi
if [ -d "/var/www/html/custom_apps/files_fulltextsearch" ]; then
php /var/www/html/occ app:remove files_fulltextsearch
fi
fi
# Remove the update skip file always
rm -f /mnt/ncdata/skip.update

View file

@ -35,3 +35,10 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/activate-collabora.sh
[program:activate-fulltextsearch]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/activate-fulltextsearch.sh