Skip to content

Commit f94b82f

Browse files
authored
Readme search first draft (#52)
1 parent fa88f5d commit f94b82f

File tree

2 files changed

+97
-13
lines changed

2 files changed

+97
-13
lines changed

README.md

Lines changed: 97 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,105 @@
1-
# The nodezoo microservice demonstration architecture
1+
# nodezoo-search
2+
3+
[![Build Status](https://travis-ci.org/nodezoo/nodezoo-search.svg?branch=master)](https://travis-ci.org/nodezoo/nodezoo-search)
4+
[![Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nodezoo/nodezoo-org)
25

36
This is a repository in the microservice demonstration system for
47
the [Tao of Microservices](//bit.ly/rmtaomicro) book (chapter 9). This
5-
code is live at [nodezoo.com](//nodezoo.com).
8+
code is live at [nodezoo.com](http://nodezoo.com). To get started,
9+
visit the [nodezoo/tao](//github.com/nodezoo/tao) repository.
10+
11+
__This microservice provides the search functionality.__
12+
13+
14+
## Running
15+
16+
To run this microservice normally, use the tooling describing in
17+
the [nodezoo/tao](//github.com/nodezoo/tao) repository, which shows you how to run
18+
the entire system of microservices (of which this is only one of many) in
19+
production ([Kubernetes](//kubernetes.io)), staging
20+
([Docker](//docker.com)), and development
21+
([fuge](//github.com/apparatus/fuge)) modes.
22+
23+
To run from the terminal for testing and debugging, see
24+
the [Running from the terminal](#running-from-the-terminal) section
25+
below.
26+
27+
28+
## Message flows
29+
30+
The table shows how this microservice acts on the `Accepted` message
31+
patterns and performs appropriate business `Actions`, as a result of
32+
which, new messages are possibly `Sent`.
33+
34+
|Accepted |Actions |Sent
35+
|--|--|--
36+
|`role:search,cmd:insert (AO)` |Insert an entry into the search engine | cmd:add,role:search
37+
|`role:search,cmd:search (SC)` |Provide a list of results |
38+
39+
(KEY: A: asynchronous, S: synchronous, O: observed, C: consumed)
40+
41+
### Service interactions
42+
43+
![search](search.png?raw=true "search")
44+
45+
46+
## Testing
47+
48+
Unit tests are in the [test](test) folder. To run, use:
49+
50+
```sh
51+
$ npm test
52+
```
53+
54+
Note that this is a learning system, and the tests are not intended to
55+
be high coverage.
56+
57+
58+
## Running from the terminal
59+
60+
This microservice is written in [node.js](//nodejs.org), which you
61+
will need to download and install. Fork and checkout this repository,
62+
and then run `npm` inside the repository folder to install its dependencies:
63+
64+
```sh
65+
$ npm install
66+
```
67+
68+
To run this microservice separately, for development, debug, or
69+
testing purposes, use the service scripts in the [`srv`](srv) folder:
70+
71+
* [`search-dev.js`](srv/search-dev.js) : run the development configuration
72+
with hard-coded network ports.
73+
74+
```sh
75+
$ node srv/search-dev.js
76+
```
77+
78+
This script listens for messages on port 9020 and provides a REPL on
79+
port 10020 (try `$ telnet localhost 10020`).
680

7-
This system shows you how to construct a full microservice
8-
architecture. It is MIT licensed so that you can cut-and-paste to
9-
build your own system with minimal effort. The system consists of
10-
multiple repositories, and runs ten or so microservices in production
11-
([Kubernetes](//kubernetes.io)), staging ([Docker](//docker.com)), and
12-
development ([fuge](//github.com/apparatus/fuge)) modes.
81+
A [seneca-mesh](//github.com/senecajs/seneca-mesh) version, for
82+
testing purposes, is also shown in the
83+
script [`search-dev-mesh.js`](srv/search-dev-mesh.js). For more on
84+
this, see the [nodezoo-repl](//github.com/nodezoo/nodezoo-repl)
85+
repository.
1386

14-
The best place to get started is
15-
the [nodezoo/tao](//github.com/nodezoo/tao) repository, which links to
16-
everything else, and has the _Getting Started_ guide.
87+
* [`search-stage.js`](srv/search-stage.js) : run the staging
88+
configuration. This configuration is intended to run in a Docker
89+
container so listens on port 9000 by default, but you can change
90+
that by providing an optional argument to the script.
1791

18-
## nodezoo-search
92+
```sh
93+
$ node srv/search-stage.js [PORT]
94+
```
1995

20-
_TODO_
96+
* [`search-prod.js`](srv/search-prod.js) : run the production
97+
configuration. This configuration is intended to run under
98+
Kubernetes in a [seneca-mesh](//github.com/senecajs/seneca-mesh)
99+
network. If running in a terminal (only do this for testing), you'll
100+
need to provide the mesh base nodes in the `BASES` environment
101+
variable.
21102

103+
```sh
104+
$ BASES=x.x.x.x:port node srv/search-prod.js
105+
```

search.png

22.8 KB
Loading

0 commit comments

Comments
 (0)