GithubHelp home page GithubHelp logo

nodezoo-search's Introduction

Logo

nodezoo-search

A micro-service that provides search for NodeZoo. This micro-service requires an instance of elastic-search running in order to correctly function. If elastic-search cannot be reached the service will self terminate.

If you're using this microservice, and need help, you can:

Running

This micro-service can be ran as part of a complete system or as a single isolated unit.

As a complete system

A special system repository is available that runs the complete system using Docker and Fuge.

Isolated mode

To make testing easier this micro-service can be ran in 'isolated' mode. This mode allows testing over http using a well defined port. Please note isolated mode means patterns are not exposed via mesh.

To run in isolated mode,

  • Clone this repository locally,
  • Run npm install,
  • Run SEARCH_ELASTIC_HOST=YOUR_HOST npm start isolated,

Note: You will need to know the cost of your vm if using Docker.

A simple http service is supported and can be called using Curl or other Rest client. The default port is 8060. It can be changed using the SEARCH_PORT environment variable.

curl -d '{"role":"search","cmd":"search","query":"hapi"}' http://localhost:8060/act

Configuration

Running Elastic

A running instance of elastic search is required to use this service. Assuming you have docker installed.

  • Start your docker machine if required
  • Run eval $(docker-machine env default) to enable docker in your shell.
  • Run docker-compose -f test/elastic.yml up to start elastic

Please note, in isolation mode you need to pass the host ip of your docker-machine if you are on an OS other than linux, obtain with docker-machine ip default.

Environment Variables

Various settings can be changed using environment variables, see the list below for all available variable names.

SEARCH_HOST

  • The host to listen on in isolated mode.
  • Defaults to localhost

SEARCH_PORT

  • The port to listen on in isolated mode.
  • Defaults to 8060 .

SEARCH_ELASTIC_HOST

  • The host elastic will listen on.
  • Defaults to localhost

SEARCH_ELASTIC_PORT

  • The port elastic will listen on.
  • Defaults to 9200 .

SEARCH_ISOLATED

  • Starts isolated mode.
  • Defaults to false.

Messages Handled

This micro-service emits the following messages.

role:search,cmd:upsert

Adds or inserts a record into elastic search

seneca.act(`role:search,cmd:upsert`, {data: {name:'seneca', ...}})

role:search,cmd:search

Applies the provided query to elastic-search and returns the results.

seneca.act(`role:search,cmd:search`, {query: 'seneca'}, (err, reply) => {})

role:info,info:updated

Aliases upsert, this pattern is an integration point for the nodezoo system. It allows the info micro-service to upsert without specifically calling nodezoo-search.

seneca.act(`role:info,info:updated`, {data: {name:'seneca', ...}})

Messages Emitted

This micro-service emits no messages.

Contributing

The NodeZoo org encourages open and safe participation.

If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.

License

Copyright (c) 2014 - 2016, Richard Rodger and other contributors. Licensed under MIT.

nodezoo-search's People

Contributors

adrianrossouw avatar andrewcashmore avatar matt-oc avatar mcdonnelldean avatar mirceaalexandru avatar rjrodger avatar shanel262 avatar vislamov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.