Search engine meant to be embedded inside a Kubernetes / OpenShift pod running an Antora-generated website. Written using TypeScript, compiled and run upon start.
After cloning the repo, run npm install
to install all the dependencies.
The server runs with this command:
npm run dev
Use the following command to build the production version of the application (in the dist
folder):
npm run build
Run the following command:
podman build -t embedded-search-engine .
A prebuilt container image is available as a package in this project.
Use the following command:
podman run --detach --publish 8081:3000 ghcr.io/vshn/embedded-search-engine
Test the search engine with a curl command piped to jq:
curl https://localhost:8081/search?q=backup&c=20 --silent | jq
The c
optional parameter specifies the number of results to return (by default, 10.)
For each specific applications, the files index/files.json
and index/lunr.json
must be replaced with ad-hoc content extracted from other projects, using the tool in the Antora Indexer CLI Tool.
It can be used in a Kubernetes pod, as a secondary container providing search services. The nginx configuration of the main container should redirect all requests beginning with /search
to this container, for example:
server {
# users are not allowed to listen on privileged ports
listen 8080;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
# Redirect all searches to the Node.js app
# in the other container of the same pod.
location /search {
proxy_pass https://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}