https://github.com/vshn/embedded-search-engine
Search engine meant to be embedded inside a Kubernetes / OpenShift pod running an Antora-generated website.
https://github.com/vshn/embedded-search-engine
vshn-project-ignore
Last synced: 6 months ago
JSON representation
Search engine meant to be embedded inside a Kubernetes / OpenShift pod running an Antora-generated website.
- Host: GitHub
- URL: https://github.com/vshn/embedded-search-engine
- Owner: vshn
- License: bsd-3-clause
- Created: 2019-07-03T11:08:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-21T01:58:43.000Z (6 months ago)
- Last Synced: 2024-11-21T02:30:13.284Z (6 months ago)
- Topics: vshn-project-ignore
- Language: TypeScript
- Homepage:
- Size: 631 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.adoc
- Changelog: CHANGELOG.adoc
- License: LICENSE.adoc
Awesome Lists containing this project
README
= Embedded Search Engine
Search engine meant to be embedded inside a Kubernetes / OpenShift pod running an Antora-generated website. Written using https://www.typescriptlang.org/[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 https://stedolan.github.io/jq/[jq]:
`curl http://localhost:8081/search?q=backup&c=20 --silent | 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 https://github.com/vshn/antora-indexer-cli[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:
[source]
----
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;
}
}
----