From f8017a0a021831e149c0b3967d0b15bd8747eb67 Mon Sep 17 00:00:00 2001 From: szaimen Date: Fri, 26 Aug 2022 13:59:04 +0200 Subject: [PATCH] fix FTS Signed-off-by: szaimen --- Containers/nextcloud/Dockerfile | 3 +-- Containers/nextcloud/activate-fulltextsearch.sh | 9 --------- Containers/nextcloud/entrypoint.sh | 14 +++++++++++++- Containers/nextcloud/supervisord.conf | 7 ------- 4 files changed, 14 insertions(+), 19 deletions(-) delete mode 100644 Containers/nextcloud/activate-fulltextsearch.sh diff --git a/Containers/nextcloud/Dockerfile b/Containers/nextcloud/Dockerfile index e2aa264b..02267c1b 100644 --- a/Containers/nextcloud/Dockerfile +++ b/Containers/nextcloud/Dockerfile @@ -238,8 +238,7 @@ RUN set -ex; \ chmod +r /upgrade.exclude && \ chmod +x /cron.sh && \ chmod +x /notify.sh && \ - chmod +x /activate-collabora.sh && \ - chmod +x /activate-fulltextsearch.sh + chmod +x /activate-collabora.sh RUN set -ex; \ mkdir /mnt/ncdata; \ diff --git a/Containers/nextcloud/activate-fulltextsearch.sh b/Containers/nextcloud/activate-fulltextsearch.sh deleted file mode 100644 index a1bf3c06..00000000 --- a/Containers/nextcloud/activate-fulltextsearch.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/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 diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index f12cfaf0..afa6bb4b 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -462,8 +462,20 @@ if [ "$FULLTEXTSEARCH_ENABLED" = 'yes' ]; then 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 fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://$FULLTEXTSEARCH_HOST:9200\",\"elastic_index\":\"nextcloud-aio\"}" php /var/www/html/occ files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" + + # Do the index + if ! [ -f "/mnt/ncdata/fts-index.done" ]; then + echo "Waiting 10s before activating FTS..." + sleep 10 + echo "Activating fulltextsearch..." + if php /var/www/html/occ fulltextsearch:test && php /var/www/html/occ fulltextsearch:index; then + touch "/mnt/ncdata/fts-index.done" + else + echo "Fulltextsearch failed. Could not index." + fi + fi else if [ -d "/var/www/html/custom_apps/fulltextsearch" ]; then php /var/www/html/occ app:remove fulltextsearch diff --git a/Containers/nextcloud/supervisord.conf b/Containers/nextcloud/supervisord.conf index 76f47a70..f411e59b 100644 --- a/Containers/nextcloud/supervisord.conf +++ b/Containers/nextcloud/supervisord.conf @@ -35,10 +35,3 @@ 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