This repository builds a containerized utility that is used to configure the Elasticsearch database used by mentorHub for search services, and optionally load test data harvested from a MongoDB database.
Running the Elasticsearch and Kibana backing services as containers will cause you to download quite large docker images. If you are working in a capacity or performance constrained environment you should schedule the downloading of these images accordingly.
The ./src/configure.ts
script is the entrypoint for this utility.
The ./src/config
folder contains runtime configuration management code. The ./src/utils
folder contains mongodb and elasticsearch IO functions.
You should do all work in a feature branch, and when you are ready to have your code deployed to the cloud open a pull request against that feature branch. Do not open a pull request without first building and testing the containers locally.
To build code for production deployment
npm run build
To start the backing service and run the script locally use this script.
npm run start
NOTE: This command does a mh down
to initialize the docker environment before starting the elasticsearch database with kibana.
To run the script locally without starting any backing services use this script.
npm run local
Use the following command to build and run the container with backing services.
npm run container
Use this command to test the output
npm run test
The docker compose file always starts Kibana along with ElasticSearch. You can use the Kibana dashboard. Choose Dev Tools
from the hamburger menu, to run queries or review configurations of the Elasticsearch database. Here are a few handy elasticsearch queries to run in Kibana:
GET /_cat/indices
GET mentorhub/_search
DELETE /mentorhub
GET mentorhub/_search
GET mentorhub/_search
{
"query": {
"match": {
"collection_name": "curriculum"
}
}
}
GET mentorhub/_search
{
"query": {
"query_string": {
"query": "Inactive people"
}
}
}
this guide provides valuable configuration and troubleshooting guides for the elasticsearch container.