nextcloud / nextcloud/fulltextsearch

Find a place for example with fulltextsearch:live in Docker

Open
#671 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
PHP
Stars
234
Forks
64
Avg merge
6h 18m
Merged PRs (30d)
10

Description

I created a setup with Nextcloud in a docker container with fulltextsearch. As already mentioned in #436 and #534 new files and other entities will not be indexed after fulltextsearch:index with cron, even not with manual execution of php cron.php. To achieve this without cron, I used supervisor like described in https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/cron/apache/supervisord.conf to create an all-in-one self containing container which handles cron and fulltextsearch:live.

I believe others would like to use this to get an idea of how to handle fulltextsearch:live in a docker container, but I did not find a suitable place for this.

Here is my setup, improvement suggestions are welcome!

Dockerfile:

FROM nextcloud:23.0.1-apache

# Install tesseract and ocrmypdf for OCR
# Install supervisor to start multiple processes on container startup
RUN apt-get update \
    && apt-get install -y  \
      tesseract-ocr \
      tesseract-ocr-deu \
      tesseract-ocr-eng \
      ocrmypdf \
      supervisor \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

RUN mkdir "/var/log/supervisord"
RUN mkdir "/var/run/supervisord"

COPY supervisord.conf /
COPY start_fulltextsearch_live.sh /

# The install and update script is only triggered when a default command is used (apache-foreground or php-fpm).
# If you use a custom command you have to enable the install / update
# See https://github.com/nextcloud/docker
ENV NEXTCLOUD_UPDATE=1

CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]

start_fulltextsearch_live.sh

#!/bin/sh
# Stop all running indexes
php /var/www/html/occ fulltextsearch:stop
# Start live index
php /var/www/html/occ fulltextsearch:live

# More information: https://github.com/nextcloud/fulltextsearch/wiki/Commands

supervisord.conf

; Inspired by https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/cron/apache/supervisord.conf
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisord/supervisord.log
pidfile=/var/run/supervisord/supervisord.pid
childlogdir=/var/log/supervisord/
logfile_maxbytes=50MB                           ; maximum size of logfile before rotation
logfile_backups=10                              ; number of backed up logfiles
loglevel=error

[program:apache2]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=root
command=apache2-foreground  ; Has to be the same command as CMD in original Dockerfile, see https://github.com/nextcloud/docker/blob/master/23/apache/Dockerfile#L158

[program:cron]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=root
command=/cron.sh

[program:fulltextsearch_index_live]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
user=www-data
command=/bin/sh /start_fulltextsearch_live.sh

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed Dockerfile, start_fulltextsearch_live.sh, and supervisord.conf, then compare the referenced Nextcloud Docker supervisor example. Document the fulltextsearch:live setup in an appropriate repository location, with enough context for others to reproduce it.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php, shell
Domain
devops, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.