Overview
PhiloLogic5 runs as a Gunicorn WSGI application. On Linux it typically runs behind a reverse proxy (Apache or Nginx); on macOS it can bind directly to a TCP port. The installer handles Python, Node.js, and all Python dependencies automatically via uv.
Installation steps:
install.sh/etc/philologic/philologic5.cfgFor step-by-step guides tailored to your platform, see:
/var/lib/philologic5/sudo apt-get update
sudo apt-get install -y \
libxml2-dev libxslt-dev zlib1g-dev \
libicu-dev pkg-config g++ \
liblz4-tool ripgrep curl
sudo dnf install -y \
libxml2-devel libxslt-devel zlib-devel \
libicu-devel pkgconf-pkg-config gcc-c++ \
lz4 ripgrep curl
brew install lz4 ripgrep pkg-config icu4c
Xcode Command Line Tools are also required (for the C and C++ compilers used to build lxml and PyICU):
xcode-select --install
Homebrew doesn’t link icu4c into its standard paths, so tell pkg-config where it is, in the shell you run install.sh from (with sudo, use sudo -E so that it is kept):
export PKG_CONFIG_PATH="$(brew --prefix)/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"
Notes:
libxml2-dev/libxslt-dev/zlib1g-dev: required for building lxml (XML parsing). On macOS these are provided by Xcode Command Line Tools.libicu-dev/pkg-config/g++: required for building PyICU, which PyPI only distributes as source.liblz4-tool/lz4: used at database load time for compressing word indexesripgrep: used at database load time for filtering parser outputcurl: used by the installer to download uv and nvm. Pre-installed on macOS.Download the latest release from GitHub, extract it, and run the install script:
cd PhiloLogic5-*/ # or PhiloLogic5/ if you cloned via git
./install.sh
| Flag | Description |
|---|---|
-t |
Install transformer support: spacy-transformers, and on Linux torch and cupy for CUDA 13 (see below) |
Example:
# Install with transformer support
./install.sh -t
On Linux, -t installs torch for CUDA 13 and cupy, with which spaCy runs models on the GPU: they need an NVIDIA
driver from 580 on.
The installer:
/var/lib/philologic5/philologic_env//var/lib/philologic5/web_app/philoload5 command to /usr/local/bin//etc/philologic/philologic5.cfg (if it doesn’t exist)/var/lib/philologic5/
├── philologic_env/ # Python virtual environment
├── web_app/ # Web application (Falcon + JS frontend)
│ ├── app.py # WSGI entry point
│ ├── gunicorn.conf.py # Gunicorn configuration
│ └── scripts/ # API endpoint scripts
├── nvm/ # Node.js (used at load time for building the frontend)
├── bin/
│ └── philoload5 # Database loading command
└── numba_cache/ # JIT compilation cache
/etc/philologic/
└── philologic5.cfg # Global configuration
/usr/local/bin/
└── philoload5 # Symlink to loader script
Edit /etc/philologic/philologic5.cfg to set the required path:
# Filesystem path where databases will be stored
database_root = "/var/www/html/philologic5/"
On macOS, a typical value would be:
database_root = "/Library/WebServer/Documents/philologic/"
There is no URL to set: a database is served under whatever host and URL prefix your web server passes to Gunicorn
(/philologic5/ in the examples below), so it can also be copied to another machine and served there as it is.
At the end of a load, philoload5 prints the first of the usual URLs on this machine (its host name or localhost under /philologic5/, or Gunicorn’s own port) that answers with the database.
Make sure the database_root directory exists and is writable by your user:
sudo mkdir -p /var/www/html/philologic5 # Linux
# or
sudo mkdir -p /Library/WebServer/Documents/philologic # macOS
sudo chown -R $USER:$USER <database_root>
The web app caches search results (hitlists) as files, and they are the only files it writes, so databases can be read-only. They go in hitlist_dir, set in /etc/philologic/philologic5.cfg:
hitlist_dir = "/var/cache/philologic5/hitlists/"
This is also the default when it isn’t set (/Library/Caches/philologic5/hitlists/ on macOS). install.sh creates it for the web server’s user (www-data on Linux); if you change it, create the new directory for that user too (or rerun install.sh), and restart the web app. Each database’s hitlists go in a subdirectory named after the database, created when first needed, with one subdirectory for each load of the database, so that a reload never gets results cached for the database it replaced (the web app removes the old ones). Don’t point two PhiloLogic installs that could have databases with the same name at the same hitlist_dir.
A database can also set hitlist_dir in its own data/db.locals.py, which then comes first for that database (its hitlists go in a subdirectory named after it there too). Reloading the database rewrites db.locals.py, so set it again after a reload.
Scripts that run searches themselves (with philologic.runtime.DB) write hitlists too: run as another user than the web server’s, they need a hitlist_dir they can write to, in a global config of their own (PHILOLOGIC_CONFIG=/path/to/config.cfg). The test suite uses its own. Databases loaded before hitlists moved out of them have a data/hitlists/ directory which is no longer used and can be deleted.
The results of one co-occurrence search (words in the same sentence, or within n words of each other) may take 10 GB at most, about 150 to 230 million results depending on the number of words: past that, the search stops and the user is asked to narrow it down. Set cooccurrence_hitlist_limit (in bytes, or None for no limit) in /etc/philologic/philologic5.cfg to change it, then restart the web app. Any search also stops before its results would take more disk space than is left.
install.sh also sets up philologic5-webui-loader, the web UI to load databases: set webui_loader = False in /etc/philologic/philologic5.cfg to turn it off.
On Linux, PhiloLogic5 runs behind Gunicorn, which listens on a Unix socket. You need a reverse proxy (Apache or Nginx) to forward HTTP requests to Gunicorn.
On systems running systemd, install.sh installs the philologic5-gunicorn service, enables it so that it starts at boot, and (re)starts it. To control it yourself:
sudo systemctl enable philologic5-gunicorn # start at boot
sudo systemctl restart philologic5-gunicorn
Where systemd isn’t running (in a container, for instance), no service is installed; start Gunicorn directly with /var/lib/philologic5/philologic_env/bin/gunicorn --config /var/lib/philologic5/web_app/gunicorn.conf.py app:application, as the Docker image’s entrypoint does.
Check status:
sudo systemctl status philologic5-gunicorn
journalctl -u philologic5-gunicorn -f # follow logs
On macOS, the simplest setup is to bind Gunicorn directly to a TCP port (no reverse proxy needed). Edit /var/lib/philologic5/web_app/gunicorn.conf.py and change the bind setting:
bind = "127.0.0.1:8080"
Databases are then served at http://127.0.0.1:8080/<database name>/.
You can then start Gunicorn manually:
/var/lib/philologic5/philologic_env/bin/gunicorn \
--config /var/lib/philologic5/web_app/gunicorn.conf.py \
app:application
Or use the installed launchd plist for automatic startup:
sudo cp /var/lib/philologic5/com.philologic5.gunicorn.plist /Library/LaunchDaemons/
sudo launchctl bootstrap system /Library/LaunchDaemons/com.philologic5.gunicorn.plist
To stop or restart:
# Restart (launchd will relaunch automatically since KeepAlive is set)
sudo launchctl kill SIGTERM system/com.philologic5.gunicorn
# Stop completely
sudo launchctl bootout system/com.philologic5.gunicorn
Enable the required modules:
sudo a2enmod proxy proxy_http
sudo systemctl restart apache2
Add to your <VirtualHost> block:
ProxyTimeout 300
<Location "/philologic5">
ProxyPass unix:/var/run/philologic/gunicorn.sock|http://localhost/philologic5 flushpackets=on
ProxyPassReverse unix:/var/run/philologic/gunicorn.sock|http://localhost/philologic5
SetEnv no-gzip 1
SetEnv force-no-buffering 1
</Location>
Add to your server block:
location /philologic5/ {
proxy_pass http://unix:/var/run/philologic/gunicorn.sock;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s;
proxy_buffering off;
}
The URL prefix (/philologic5) is yours to choose: databases are served under whatever prefix the proxy passes.
A Dockerfile is included for containerized deployment:
docker build -t philologic5 .
docker run -p 8000:8000 -v /path/to/databases:/var/www/html/philologic philologic5
In the container, Gunicorn binds directly to port 8000 (no reverse proxy needed inside the container).
The default configuration is in /var/lib/philologic5/web_app/gunicorn.conf.py. Key settings:
| Setting | Default | Description |
|---|---|---|
workers |
min(cpu_count, 4) |
Number of worker processes |
threads |
4 |
Threads per worker |
timeout |
300 |
Request timeout (seconds) |
max_requests |
1000 |
Requests before worker recycling |
preload_app |
True |
Preload app for memory efficiency |
The installer preserves any customizations to gunicorn.conf.py across reinstalls.
To upgrade an existing installation, download the latest release and rerun the installer:
cd PhiloLogic5-*/
sudo ./install.sh
The installer will remove and recreate /var/lib/philologic5/ but preserves your gunicorn.conf.py customizations and /etc/philologic/philologic5.cfg. Existing databases are not affected (they live under database_root).
After upgrading, restart Gunicorn:
# Linux
sudo systemctl restart philologic5-gunicorn
# macOS (launchd restarts automatically via KeepAlive)
sudo launchctl kill SIGTERM system/com.philologic5.gunicorn