Code Search on Fess
Fess is an Enterprise Search Server. This Docker environment provides a Source Code Search Server using Fess.
Upgrading from an earlier version? See UPGRADING.md.
Public Site
Architecture / Theme Model
- Theme: Fess 15.8 theme system —
theme.default=codesearch in system.properties selects the codesearch theme. No virtual-host routing is needed for theme activation.
- Fess config (
fess_config.properties): setup.sh generates data/fess/opt/fess/fess_config.properties from the upstream base for the pinned Fess version plus the codesearch overlay (conf/fess_config.overlay.properties) and an optional local override (conf/fess_config.local.properties). It is mounted at /opt/fess, which the image places ahead of its /etc/fess default on the classpath, so the generated file takes effect. Only the delta is tracked in git; the base auto-tracks the pinned version. See Configuration.
- Version pins (
.env): FESS_VERSION / OPENSEARCH_VERSION are the single source of truth for the image tags (compose.yaml) and the fess_config.properties base.
- system.properties: The live file (
data/fess/opt/fess/system.properties) is generated from data/fess/opt/fess/system.properties.template by setup.sh on first run. The live file is git-ignored.
- Theme files: The codesearch theme is fetched from the fess-themes repository by
setup.sh (from its main branch, which follows Fess 15.10; for a released Fess version, check out the matching branch of this repository, for example 15.9.x, or set FESS_THEMES_BRANCH to the matching fess-themes branch. Re-fetched on every run; set FESS_THEMES_SKIP_FETCH=1 to keep the local copy) and stored in data/fess/themes/codesearch/. This directory is mounted into the container at /usr/share/fess/app/themes/codesearch. The theme requires the facet fields configured in the overlay — see Troubleshooting.
- index.filetype: Source-code aware mimetype→label map, maintained in
conf/fess_config.overlay.properties (a multi-line value, so it lives in the file rather than a -D flag). The filetype value behind the language facet and the filetype: filter comes from this map, so .js / .mjs files are labelled javascript and .yml / .yaml files yaml. Rust (.rs) files are labelled rust: Tika 4.2 detects them as text/x-rust and earlier versions as application/rls-services+xml, so both types are mapped to the label. TypeScript (.ts / .tsx), .jsx, .cjs, Vue, SCSS and TOML files are detected as text/plain and are therefore labelled txt, so filetype: cannot tell them apart.
- Management CLI (
fessctl): Repositories are registered and crawls are triggered with fessctl, the official Fess admin-API CLI (see Install fessctl).
- Verification (
bin/verify.sh): Checks at runtime that the generated config is in effect and that the live index has the codesearch fields mapped. Run it after setup.sh and after any version bump (see Verify the Setup).
Getting Started
Setup
First, clone the repository and navigate into the directory:
$ git clone https://github.com/codelibs/docker-codesearch.git
$ cd docker-codesearch
$ bash ./bin/setup.sh
setup.sh will:
- Create required data directories
- Download the Fess data store plugin (fess-ds-git)
- Fetch the codesearch theme from fess-themes
- Generate
data/fess/opt/fess/system.properties from the template (if not already present)
- Generate
data/fess/opt/fess/fess_config.properties from the pinned base + codesearch overlay
setup.sh aborts on the first failure and exits non-zero. Do not start the stack after a failed run: a missing fess_config.properties boots a Fess that looks healthy but returns 0 hits for every search (see Troubleshooting).
Start the Server
To start the server, use Docker Compose:
docker compose -f compose.yaml up -d
Once the server is running, access it at http://localhost:8080/.
The first start initializes the search indices in OpenSearch (this can take a minute or two). The site has no documents until you register a repository and run a crawler (see below).
Verify the Setup
The first start is also the only chance to get the index mapping right, so check it before crawling:
bash ./bin/verify.sh
It confirms that the generated fess_config.properties is in effect (including the facet allowlist the theme depends on) and that the live index really has the codesearch fields mapped. It prints the remedy for whatever it finds and exits non-zero on failure.
Once documents are indexed, it also probes the search API by comparing the theme's faceted request against the same query without facets — a rejected facet field makes only the faceted count collapse to 0. Set VERIFY_QUERY if test matches nothing in your repositories.
Create an Access Token
fessctl (used in the next steps) authenticates to Fess with an access token. Create one with the {role}admin-api permission on the Admin Access Token page (http://localhost:8080/admin/accesstoken/).
For more details, see the Admin Access Token Guide.
Install fessctl
Repositories are registered and crawls are triggered with fessctl, the official CLI for the Fess Admin API:
pipx install fessctl # or: uv tool install fessctl
fessctl requires Python 3.13+ (pipx / uv provide it automatically). Point it at the server and the access token created above:
export FESS_ENDPOINT=http://localhost:8080
export FESS_ACCESS_TOKEN=<your-access-token>
export FESS_VERSION=15.9.0 # or snapshot for the development build
fessctl ping # reports the search engine status (GREEN when ready)
fessctl can also be run from its container image (ghcr.io/codelibs/fessctl); see the fessctl README for details.
Register a Repository
Create a Git data store config for each repository you want to index. The handler-script maps Git metadata to the codesearch fields (organization, repository, filetype, …) that power the search facets. Replace codelibs / fess-suggest / master with your own organization, repository, and branch. commit_id keeps the crawled ref on the same branch base_url links to; left out, GitDataStore resolves the remote's default branch on its own:
fessctl dataconfig create \
--name "github.com/codelibs/fess-suggest" \
--handler-name GitDataStore \
--handler-parameter 'uri=https://github.com/codelibs/fess-suggest.git
base_url=https://github.com/codelibs/fess-suggest/blob/master/
commit_id=master
extractors=text/.*:textExtractor,application/xml:textExtractor,application/javascript:textExtractor,application/json:textExtractor,application/x-sh:textExtractor,application/x-bat:textExtractor,audio/.*:filenameExtractor,chemical/.*:filenameExtractor,image/.*:filenameExtractor,model/.*:filenameExtractor,video/.*:filenameExtractor,
delete_old_docs=false
repository_path=/home/fess/workspace/fess-suggest' \
--handler-script 'url=url
host="github.com"
site="github.com/codelibs/fess-suggest/" + path
title=name
content=container.getComponent("documentHelper").appendLineNumber("L", content)
digest=author.toExternalString()
content_length=contentLength
last_modified=timestamp
timestamp=timestamp
filename=name
mimetype=mimetype
domain="github.com"
organization="codelibs"
repository="fess-suggest"
path=path
repository_url="https://github.com/codelibs/fess-suggest"
filetype=container.getComponent("fileTypeHelper").get(mimetype)' \
--permission "{role}guest"
Review the registered repositories on the DataConfig page.
Run the Crawler
Trigger the built-in Default Crawler, which crawls every registered data store config:
fessctl scheduler start default_crawler
It also runs daily on its own schedule, so newly registered repositories are picked up automatically. Follow progress on the Scheduler page (Job Log), or watch results appear on the search page.
Search
You can view search results at http://localhost:8080/.
Stop the Server
To stop the server, use the following command:
docker compose -f compose.yaml down
Configuration
Fess settings (fess_config.properties)
Codesearch-specific fess_config.properties settings are maintained as a small delta in conf/fess_config.overlay.properties. setup.sh (via bin/render-fess-config.sh) fetches the upstream base for the pinned FESS_VERSION and overlays this delta to generate data/fess/opt/fess/fess_config.properties. After editing the overlay, re-run setup.sh (or bash ./bin/render-fess-config.sh).
Secrets / per-deployment values (e.g. the cipher key, the initial admin password) must not go in the tracked overlay. Create conf/fess_config.local.properties (git-ignored) — its keys are applied last and win:
app.cipher.key=your-secret-key-here
index.user.initial_password=your-admin-password
The cipher key encrypts stored credentials; set it before first boot, because changing it later invalidates already-encrypted data.
system.properties
To modify system-level Fess settings, edit data/fess/opt/fess/system.properties.template and re-run setup.sh, or edit the live data/fess/opt/fess/system.properties directly. The live file is git-ignored.
Optional: AI Chat (RAG)
To enable AI-powered chat on search results, add the following to conf/fess_config.local.properties (or the overlay) and install an LLM plugin, then re-run setup.sh:
rag.chat.enabled=true
AI chat is disabled by default. See Fess LLM plugins for available LLM integrations.
Updating
To update to the latest code, use plain git pull:
git pull
Live/generated files (system.properties, fess_config.properties, theme assets) are git-ignored and will not be overwritten by git pull.
To upgrade the Fess / OpenSearch version, edit the pins in .env (FESS_VERSION, OPENSEARCH_VERSION) and re-run setup.sh. The fess_config.properties base is re-fetched for the new version and the codesearch overlay is re-applied automatically:
bash ./bin/setup.sh
bash ./bin/verify.sh
docker compose -f compose.yaml up -d
FESS_VERSION is a ghcr.io/codelibs/fess image tag, and render-fess-config.sh maps it to the codelibs/fess git ref that holds the matching base config:
FESS_VERSION |
base ref |
15.9.0, 15.8.0, … |
fess-<version> (the release tag) |
15.9.0-noble, 15.9.0-al2023 |
fess-<version> (the OS suffix is dropped) |
snapshot, snapshot-noble, snapshot-al2023, 15.10.0-SNAPSHOT |
main |
anything else (latest, 15.8, …) |
rejected — pin an explicit release, or set FESS_CONFIG_BASE_REF |
An exported FESS_VERSION takes precedence over .env in render-fess-config.sh, register_github.sh and migrate-to-javascript.sh, just as it does for docker compose, so a one-off run against another image needs no edit to .env: FESS_VERSION=snapshot bash ./bin/setup.sh. fessctl only accepts a numeric version, so the two fessctl wrappers drop an image-tag suffix (15.9.0-noble → 15.9.0) and map every snapshot tag to the development line (15.10.0); to target a release, run them with an explicit version such as FESS_VERSION=15.9.0.
Floating tags are rejected on purpose: latest has no matching source ref, so there is no way to render a base config that is guaranteed to match the running image. For a ref this mapping does not cover — an unreleased version, or a maintenance branch — name it explicitly:
FESS_CONFIG_BASE_REF=15.9.x bash ./bin/render-fess-config.sh
Plugin versions are not derived from FESS_VERSION