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:

version: '2'

services:
  db:
    image: mariadb:10.1
    environment:
      MYSQL_ROOT_PASSWORD: your_mysql_root_password
      MYSQL_USER: your_filerun_username
      MYSQL_PASSWORD: your_filerun_password
      MYSQL_DATABASE: your_filerun_database
    volumes:
      - /filerun/db:/var/lib/mysql
  web:
    image: filerun/filerun
    environment:
      FR_DB_HOST: db
      FR_DB_PORT: 3306
      FR_DB_NAME: your_filerun_database
      FR_DB_USER: your_filerun_username
      FR_DB_PASS: your_filerun_password
      APACHE_RUN_USER: www-data
      APACHE_RUN_USER_ID: 33
      APACHE_RUN_GROUP: www-data
      APACHE_RUN_GROUP_ID: 33
    depends_on:
      - db
    links:
      - db
      - tika
      - elasticsearch
    ports:
      - "80:80"
    volumes:
      - /filerun/html:/var/www/html
      - /filerun/user-files:/user-files
  tika:
    image: logicalspark/docker-tikaserver
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
    container_name: elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 1g
    volumes:
      - /filerun/esearch:/usr/share/elasticsearch/data

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

  • For the FileRun application files: It can be located in any empty folder and must have the mount path set to /var/www/html
  • For the FileRun user files, with the mount path set to /user-files
  • For the MariaDB data, with the mount path set to /var/lib/mysql
  • For the Elasticsearch index data, with the mount path set to /usr/share/elasticsearch/data

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

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

And start FileRun up using the following command:

docker-compose up -d

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

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.

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

docker 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:

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

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

php /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:

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

Open the crontab:

vim /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):

* * * * * 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.