Skip to content

About

Document Search on Fess

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

37 Commits

Folders and files

Repository files navigation

Document Search on Fess

Fess is an Enterprise Search Server. This Docker environment provides a Document/Source Code Search Server on Fess, using the DocSearch theme from fess-themes.

  • Fess: 15.10 (ghcr.io/codelibs/fess:snapshot, the in-development build; to run a release such as 15.9.0, pin it in compose.override.yaml as shown in Pin a Fess version)
  • Search engine: OpenSearch (fess-opensearch:3.10.0)

Upgrading from an earlier version? See UPGRADING.md.

Public Site

Getting Started

Setup

$ git clone https://github.com/codelibs/docker-docsearch.git
$ cd docker-docsearch
$ bash ./bin/setup.sh

setup.sh creates the data directories and syncs the docsearch theme from the fess-themes repository into data/fess/usr/share/fess/app/themes/docsearch.

The theme source is resolved in this order:

Variable Default Notes
FESS_THEMES_DIR (unset) Path to a local fess-themes checkout root; the script reads $FESS_THEMES_DIR/themes/docsearch/theme.yml. When set, FESS_THEMES_REF is ignored.
FESS_THEMES_REPO https://github.com/codelibs/fess-themes.git Clone source when FESS_THEMES_DIR is unset.
FESS_THEMES_REF main Branch or tag to clone.

The theme is staged in a temporary directory first and only swapped in once it has been fetched and validated, so a failed run leaves the currently deployed theme untouched.

On Linux the script also runs sudo chown -R over the data directories so the container users (UID 1001 for Fess, 1000 for OpenSearch) can write to them. Expect a sudo password prompt; the script aborts if sudo fails.

Start Server

docker compose up -d

Run the docker compose commands in this README from this directory without -f: Compose then reads compose.yaml and, when there is one, compose.override.yaml (see Cipher key and Plugins). With -f compose.yaml Compose reads only the named files, so your override is skipped without a message and the stack starts without its cipher key and plugins.

The web UI is on http://localhost:8080/, but it is not reachable the instant up -d returns — Fess waits for OpenSearch and then boots. Wait for the health endpoint instead of the root path:

curl -s http://localhost:8080/api/v2/health
{"response":{"status":0,"engine":{"status":"GREEN","ping_status":0}}}

On Linux, ensure vm.max_map_count is at least 262144 (sudo sysctl -w vm.max_map_count=262144) for OpenSearch. Docker Desktop handles this automatically.

The search engine deliberately publishes no host port. It runs with the security plugin disabled, so exposing 9200 would put an unauthenticated OpenSearch on the network. Fess reaches it over the compose network; to inspect it yourself, go through the container:

docker compose exec search01 \
  curl -s http://localhost:9200/_cluster/health

Configure Crawling

A fresh checkout has no crawl configuration — data/ is git-ignored, so the index starts empty and running a crawler job would do nothing. Create at least one crawl config first.

  1. Open http://localhost:8080/admin/ and sign in. The initial credentials are admin / admin; change the password on first login. (The search UI has no login link because login.link.enabled=false is set in system.properties.template, so go to /admin/ directly.)
  2. Go to Crawler > Web, create a config, and set at least Name, URLs and Included URLs For Crawling. Leave Available enabled.

To group results under a label, create the label under Crawler > Label and set its Included Paths to a regular expression matching the URLs, for example https://example.com/docs/.*. Labels are attached to documents by that pattern only.

Start Crawler

Run Default Crawler from the Admin Scheduler page (http://localhost:8080/admin/scheduler/). Data store jobs named Data Crawler - ... appear only after you create a data store config.

Search

You can check search results on http://localhost:8080/.

Stop Server

docker compose down

If you started the stack with the production overlay, pass the same files, otherwise https-portal keeps running and the network cannot be removed (add -f compose.override.yaml if you have one, since naming files with -f turns off its automatic loading):

docker compose -f compose.yaml -f compose-production.yaml down

Update

To update an existing deployment:

git pull
bash ./bin/setup.sh
docker compose pull
docker compose up -d

setup.sh re-syncs the docsearch theme by replacing the directory contents in place, so any local edits under data/fess/usr/share/fess/app/themes/docsearch are lost. The directory itself is kept, so a running fess01 keeps its mount and serves the new files right away. setup.sh never overwrites an existing data/fess/opt/fess/system.properties. That file is git-ignored, so git pull does not touch it and your runtime settings (and any changes made under Admin > General) are preserved across updates.

Saving Admin > General writes the effective defaults into that file, for example crawling.user.agent=Mozilla/5.0 (compatible; Fess/<version>; ...), and the line stays after an upgrade, so the crawler keeps reporting the old version. After upgrading, delete the crawling.user.agent line to get the default again and restart fess01.

docker compose up -d only recreates a container when its image or configuration changed, so it does not notice a theme update by itself. Fess reads the theme's theme.yml (for example the theme version reported by /api/v2/ui/config) only when it starts, so restart Fess after a theme update:

docker compose restart fess01

Fess 15.10 serves theme assets with Cache-Control: no-cache and an ETag, so a browser checks for a newer file on every load and picks up a theme update without a hard reload (Fess 15.9 cached them for a day).

Pin a Fess version

Put the image tag in compose.override.yaml, not in compose.yaml. git pull refuses to update a tracked file you edited once the upstream changes the same file, so a pin written into compose.yaml stops the Update above. For example:

services:
  fess01:
    image: ghcr.io/codelibs/fess:15.9.0

To move from an older Fess version (for example 15.8), see UPGRADING.md.

Configuration

Fess configuration is split into two layers:

  • fess_config.properties overrides are set as -Dfess.config.<key>=<value> JVM flags in FESS_JAVA_OPTS in compose.yaml. Changing them requires a container restart.
  • Dynamic system settings (the values managed under Admin > General, e.g. the active theme theme.default=docsearch) live in data/fess/opt/fess/system.properties.

data/fess/opt/fess is bind-mounted as a directory at /opt/fess, which the image puts first on the Fess classpath. Any configuration file placed there overrides the one shipped in the image — system.properties is simply the file this repository uses. The mounted system.properties is generated on first setup.sh run from the tracked system.properties.template. The live file is git-ignored, so Fess may rewrite it at runtime (e.g. when you save settings in Admin > General) and git pull will not conflict with your local changes. Note that saving Admin > General rewrites the whole file and materialises the defaults of every managed key, so it will grow well beyond the template. To reset it to the defaults, delete data/fess/opt/fess/system.properties and re-run bash ./bin/setup.sh.

Cipher key

Fess 15.10 logs a WARN, app.cipher.key is still the default value, at every start of the Fess web application (the child JVMs of the scheduled jobs, such as Thumbnail Generator, do not log it). The key encrypts the passwords stored in crawl and data store configurations and its default is public, so set your own value before you save a configuration that has credentials. Fess 15.10 reads it from the environment variable FESS_CONFIG_APP_CIPHER_KEY, for example in a compose.override.yaml:

services:
  fess01:
    environment:
      FESS_CONFIG_APP_CIPHER_KEY: "<your own value>"

The value must be 16, 24 or 32 printable ASCII characters without spaces (AES). Any other length is accepted at start-up and removes the WARN, but saving a configuration with a password then fails with Failed to initialize the cipher by the invalid key. For example, openssl rand -hex 16 prints 32 characters.

Do not pass it as -Dfess.config.app.cipher.key in FESS_JAVA_OPTS: Fess 15.10 then logs a WARN at every start (The secret app.cipher.key is given as the JVM option ...), because a JVM option is visible on the command line of Fess and of its crawler processes. When both are set, the JVM option wins. Fess 15.9 does not read the variable: on a 15.9.0 pin the variable is ignored without a message and the default key stays in use, so give the key as -Dfess.config.app.cipher.key in a FESS_JAVA_OPTS of compose.override.yaml that repeats the flags of compose.yaml (the override replaces the whole value). Keep the value out of git (compose.override.yaml is not ignored by this repository). Changing the key later makes the values encrypted with the old key undecryptable.

Plugins

data/fess/usr/share/fess/app/WEB-INF/plugin is mounted as the plugin directory of Fess, so plugins placed there survive a container recreate. Put the jar there, or list it in FESS_PLUGINS on fess01 (space-separated <name>:<version> entries, with the version matching Fess; the example below matches a Fess 15.9.0 pin), for example in a compose.override.yaml:

services:
  fess01:
    environment:
      FESS_PLUGINS: "fess-ds-git:15.9.0"

and start with docker compose up -d, which reads compose.override.yaml next to compose.yaml. The image downloads the listed plugins into that directory when the container starts. When upgrading Fess, replace the plugins there with the versions that match the new Fess.

Known behaviour

system.properties.template sets result.collapsed=true so that near-identical pages (for example https://example.com/ and https://example.com/index.html) are folded into a single result. Fess reports the pre-collapse total in record_count, so the reported number of hits — and therefore the page count — can exceed the number of results that are actually returned, and the last page of a result set may come up empty. Set result.collapsed=false under Admin > General if a consistent pager matters more than folding duplicates.

For Production

The base compose.yaml runs Fess locally on http://localhost:8080/ without a TLS proxy. SSL termination is handled by https-portal, which is defined only in the compose-production.yaml overlay so that local runs do not require ports 80/443. The overlay also raises the OpenSearch heap to 3g.

To use your own domain, replace docsearch.codelibs.org in both places:

  • the DOMAINS value in compose-production.yaml, and
  • the file name of data/https-portal/conf/docsearch.codelibs.org.ssl.conf.erb and the volume line that mounts it. https-portal picks the custom server config up by domain name, so renaming only one of the two silently drops the TLS settings, the return 444 host guard and the cookie handling in that file.

Start with the production overlay to bring up https-portal (Let's Encrypt, STAGE: production) and the larger OpenSearch heap:

docker compose -f compose.yaml -f compose-production.yaml up -d

Add -f compose.override.yaml to that command if you keep one: with -f Compose no longer loads it on its own.

About

Document Search on Fess

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Contributors

Languages