Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
akosma committed Jul 2, 2019
0 parents commit b9c0a8e
Show file tree
Hide file tree
Showing 11 changed files with 789 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.cache/
node_modules/
Dockerfile
Makefile
README.adoc
92 changes: 92 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
.vscode

# Created by https://www.gitignore.io/api/node
# Edit at https://www.gitignore.io/?templates=node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# End of https://www.gitignore.io/api/node
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:10.14.2-alpine

WORKDIR /site
COPY ["package.json", "package-lock.json", "./"]
RUN npm install
COPY . /site

EXPOSE 3000
CMD node_modules/.bin/ts-node src/index.ts

# Don't run as root even in plain docker
USER 1001:0
35 changes: 35 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
= Embeddable Search Engine

This search engine is meant to be embedded inside a pod running an Antora-generated website, such as the VSHN handbook or the K8up documentation.

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.

The search engine is 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:

`node_modules/.bin/ts-node src/index.ts`

== Building the Docker Image

Run the following command:

`docker build -t search .`

== Running the Search Engine

Use the following command:

`docker run -d -p 8081:3000 search`

Test the search engine with a curl command piped to https://stedolan.github.io/jq/[jq]:

`curl http://localhost:8081/search?q=backup --silent | jq`

== Note for Extending Docker Image

For specific applications, the files `index/files.json` and `index/lunr.json` must be replaced with ad-hoc content extracted from other projects.
1 change: 1 addition & 0 deletions index/files.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"/k8up/0.1.5/advanced-config.html":{"name":"Advanced Config Reference","href":"/k8up/0.1.5/advanced-config.html","excerpt":" The operator has two ways for configuration: Per namespace backups. Optimal for shared clusters Global settings with namespaced…"},"/k8up/0.1.5/getting-started.html":{"name":"Getting Started Tutorial","href":"/k8up/0.1.5/getting-started.html","excerpt":" This tutorial provides a quick introduction to K8up, how it works and how to use it. Prerequisites This…"},"/k8up/0.1.5/index.html":{"name":"K8up","href":"/k8up/0.1.5/index.html","excerpt":" K8up is a backup operator that will handle PVC and app backups on a k8s/OpenShift cluster. Just create a…"},"/k8up/0.1.5/object-specifications.html":{"name":"Object Specifications Reference","href":"/k8up/0.1.5/object-specifications.html","excerpt":" The K8up operator includes various CRDs which get added to the cluster. Here We’ll explain them in more detail.…"},"/k8up/0.1.5/restore.html":{"name":"How to Restore a Backup","href":"/k8up/0.1.5/restore.html","excerpt":" It is possible to tell the operator to perform restores either to a PVC or an S3 bucket. For…"}}
1 change: 1 addition & 0 deletions index/lunr.json

Large diffs are not rendered by default.

Loading

0 comments on commit b9c0a8e

Please sign in to comment.