Skip to content

Commit 55a95cd

Browse files
committed
readme
1 parent 36f0cca commit 55a95cd

File tree

5 files changed

+103
-7
lines changed

5 files changed

+103
-7
lines changed

.dockerignore

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

.eslintrc

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

README.md

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

github.png

36.2 KB
Loading

test/github.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('npm', function () {
2929
// Load the github plugin
3030
.use('..')
3131

32+
// Subscribe to internal messages in order to count calls
3233
.sub('role:entity', function (msg) {
3334
seen[msg.cmd] = 1 + (seen[msg.cmd]||0)
3435
})
@@ -50,7 +51,6 @@ describe('npm', function () {
5051
expect(seen).to.equal({ load: 2, save: 1 })
5152
})
5253

53-
5454
.act('role:github,cmd:get,name:seneca', function (ignore, out) {
5555
expect(out.owner).equal('senecajs')
5656
expect(out.repo).equal('seneca')

0 commit comments

Comments
 (0)