Using Docker with Full-Text Search

This guide assumes you have Docker (with Docker Compose) installed on a server with at least 2GB of RAM memory.

Create a text file named docker-compose.yml and paste the following inside:

 1services:
 2  db:
 3    image: mariadb:10.1
 4    environment:
 5      MYSQL_ROOT_PASSWORD: your_mysql_root_password
 6      MYSQL_USER: your_filerun_username
 7      MYSQL_PASSWORD: your_filerun_password
 8      MYSQL_DATABASE: your_filerun_database
 9    volumes:
10      - /filerun/db:/var/lib/mysql
11  web:
12    image: filerun/filerun:8.1
13    environment:
14      FR_DB_HOST: db
15      FR_DB_PORT: 3306
16      FR_DB_NAME: your_filerun_database
17      FR_DB_USER: your_filerun_username
18      FR_DB_PASS: your_filerun_password
19      APACHE_RUN_USER: www-data
20      APACHE_RUN_USER_ID: 33
21      APACHE_RUN_GROUP: www-data
22      APACHE_RUN_GROUP_ID: 33
23    depends_on:
24      - db
25    links:
26      - db
27      - tika
28      - elasticsearch
29    ports:
30      - "80:80"
31    volumes:
32      - /filerun/html:/var/www/html
33      - /filerun/user-files:/user-files
34  tika:
35    image: logicalspark/docker-tikaserver
36  elasticsearch:
37    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.24
38    container_name: elasticsearch
39    environment:
40      - cluster.name=docker-cluster
41      - bootstrap.memory_lock=true
42      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
43    ulimits:
44      memlock:
45        soft: -1
46        hard: -1
47    mem_limit: 1g
48    volumes:
49      - /filerun/esearch:/usr/share/elasticsearch/data

Please note the above volumes configuration. There are four folders you need to configure:

You can use the following command with the docker-compose file above:

 1    mkdir /filerun /filerun/html /filerun/user-files /filerun/db /filerun/esearch

Download and place the FileRun application files

Login to your FileRun client account by using this link: https://my.filerun.com/client-area-orders

It will take you to "Your Licenses". That is where you will be able to download the FileRun application files in a zip archive.

Upload the zip archive to your server, inside where you mounted /var/www/html (for our above example, that would be /filerun/html).

Extract the zip in the same folder.

Adjust the folder permissions to be writable by FileRun:

 1chown www-data:www-data -R /filerun/html/system/data

And start FileRun up using the following command:

 1docker compose up -d

FileRun should be now up and running, and you can access it with your browser.

After completing the web-based installation

You will want to set the home folder path of the FileRun Superuser account to /user-files

Enable full-text file indexing

This step is optional and needed only if you will be using the full text indexing to search files based on their textual contents.

To configure the file indexing feature please follow this guide.

The Elasticsearch Host URL that needs to be configured is http://elasticsearch:9200.

The Apache Tika server hostname should be configured with tika and the port number 9998.

Setup the cron indexing process

From the server's command line, open a console inside the FileRun Docker container:

 1docker exec -it filerun bash

filerun is the container name. You can use the ID if a name is not given. To check the Docker containers ID, you can use the docker ps command.

Create the indexation script file which will run periodically:

 1vim /var/www/html/cron/process_search_index_queue.sh

and paste (press "i" and then "CTRL+V") the following inside:

 1php /var/www/html/cron/process_search_index_queue.php

Press "Esc" then ":wq" and "Enter" to save the changes and close the editor.

Adjust the script file permissions by making it executable:

 1chmod 755 /var/www/html/cron/process_search_index_queue.sh

Open the crontab:

 1vim /etc/crontab

and paste (press "i" and then "CTRL+V") the following at its end (leaving the empty line at the bottom of the file):

 1* * * * * root /var/www/html/cron/process_search_index_queue.sh

Press "Esc" then ":wq" and "Enter" to save the changes and close the editor.

You should now have FileRun automatically index inside Elasticsearch the contents of all the file types supported by Apache Tika. Note that the above cronjob runs once every minute, and it may take a minute or two for a file to be found by its content after uploading.

Important note: If your FileRun Docker container ever gets stopped for some reason, you will need to redo the "Setup the indexing process" section.