Skip to content

Search engine meant to be embedded inside a Kubernetes / OpenShift pod running an Antora-generated website.

License

Notifications You must be signed in to change notification settings

vshn/embedded-search-engine

Repository files navigation

Embedded Search Engine

Search engine meant to be embedded inside a Kubernetes / OpenShift pod running an Antora-generated website. Written using TypeScript, compiled and run upon start.

Running Locally

After cloning the repo, run npm install to install all the dependencies.

The server runs with this command:

npm run dev

Compiling the Express.js Application

Use the following command to build the production version of the application (in the dist folder):

npm run build

Starting the Production Application

Use the following command after compilation:

npm run start

Building the Container Image

Run the following command:

podman build -t embedded-search-engine .

A prebuilt container image is available as a package in this project.

Running the Search Engine Container Image

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:

The c optional parameter specifies the number of results to return (by default, 10.)

Indexing the Documentation

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.

nginx Configuration

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 http://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;
    }
}

About

Search engine meant to be embedded inside a Kubernetes / OpenShift pod running an Antora-generated website.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •