Skip to content

Commit 6ab33dd

Browse files
committed
readme
1 parent a6b4afa commit 6ab33dd

File tree

4 files changed

+97
-18
lines changed

4 files changed

+97
-18
lines changed

.dockerignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

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-npm
2+
3+
[![Build Status](https://travis-ci.org/nodezoo/nodezoo-npm.svg?branch=master)](https://travis-ci.org/nodezoo/nodezoo-npm)
24

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

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.
86+
* [`npm-stage.js`](srv/npm-stage.js) : run the staging
87+
configuration. This configuration is intended to run in a Docker
88+
container so listens on port 9000 by default, but you can change
89+
that by providing an optional argument to the script.
1390

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.
91+
```sh
92+
$ node srv/npm-stage.js [PORT]
93+
```
1794

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

20-
_TODO_
102+
```sh
103+
$ BASES=x.x.x.x:port node srv/npm-prod.js
104+
```
21105

npm.png

36.7 KB
Loading

0 commit comments

Comments
 (0)