Enable search and background tasks in a cluster

    In the seafile cluster, only one server should run the background tasks, including:

    • indexing files for search
    • email notification
    • office documents converts service
    • LDAP sync
    • virus scan

    Let’s assume you have three nodes in your cluster: A, B, and C.

    • Node A is backend node that run background tasks.
    • Node B and C are frontend nodes that serving requests from clients.

    If you following the steps on settings up a cluster, node B and node C should have already be configed as frontend node. You can copy the configuration of node B as a base for node A. Then do the following steps:

    On Ubuntu/Debian:

    On CentOS/Red Hat:

    1. sudo yum install libreoffice libreoffice-headless libreoffice-pyuno
    2. sudo yum install poppler-utils

    Edit seafevents.conf and ensure this line does NOT exist:

    1. external_es_server = true
    1. OFFICE_CONVERTOR_NODE = True

    Edit seafile.conf to enable virus scan according to virus scan document

    Edit the firewall rules

    In your firewall rules for node A, you should open the port 9200 (for search requests). For versions older than 6.1, es_port was 9500.

    On nodes B and C, you need to:

    Edit seahub_settings.py and add a line:

    Make sure requests to http:// is also handled by Seahub. For example, you may need to add this Nginx configuration in the background node:

    1. server {
    2. listen 80;
    3. server_name <IP of node A>;
    4. location / {
    5. ...
    6. }

    As a simple test, you can use this command to test if you set it up correctly.

    1. curl -v http://<IP of node A>/office-convert/internal/status/

    It should say “400 Bad Request” when you have Nginx config updated.

    1. ./seafile.sh start
    2. ./seahub.sh start # or "./seahub.sh start-fastcgi" if you're using fastcgi
    3. ./seafile-background-tasks.sh start

    To stop the background node, type:

    1. ./seafile-background-tasks.sh stop
    2. ./seafile.sh stop
    3. ./seahub.sh stop

    You should also configure Seafile background tasks to start on system bootup. For systemd based OS, you can add /etc/systemd/system/seafile-background-tasks.service:

    Then enable this task in systemd:

      Here is the summary of configurations at the background node that related to clustering setup.

      For seafile.conf:

      1. [cluster]
      2. enabled = true

      For seahub_settings.py:

      1. OFFICE_CONVERTOR_NODE = True
      2. AVATAR_FILE_STORAGE = 'seahub.base.database_storage.DatabaseStorage'
      3. COMPRESS_CACHE_BACKEND = 'django.core.cache.backends.locmem.LocMemCache'

      For seafevents.conf:

      1. [INDEX FILES]
      2. enabled = true
      3. interval = 10m
      4. [OFFICE CONVERTER]
      5. enabled = true
      6. workers = 1
      7. ## how many pages are allowed to be previewed online. Default is 50 pages
      8. max-pages = 50
      9. ## the max size of documents allowed to be previewed online, in MB. Default is 10 MB