You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then add a route handler for all incoming requests:
56
-
```js
57
-
app.use('/',
58
-
cmd.microCom(
59
-
'microserviceName',
60
-
'databaseType',
61
-
'databaseURL',
62
-
'wantMicroHealth',
63
-
'queryFrequency',
64
-
'isDockerized'
65
-
)
66
-
)
67
-
```
68
133
69
134
The cmd.microCom handler function logs communication and health data to a user-provided database. This is to ensure that your private data stays private. We currently support MongoDB and SQL/PostgreSQL databases.
70
135
71
136
cmd.microCom takes six parameters. You can enter the arguments as individual strings or as an array.
72
137
73
138
The parameters are:
74
-
*[1] microserviceName: To identify the microservice (i.e. "payments").
139
+
140
+
-[1] microserviceName: To identify the microservice (i.e. "payments").
75
141
- Make sure this name matches your container name. More details more below (param #6).
76
142
- Your input name for the microservice will be turned to an all-lowercase string.
77
-
*[2] databaseType: Enter either "mongo" or "sql".
78
-
*[3] databaseURL: Enter the URL of your database.
79
-
*[4] wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no".
143
+
-[2] databaseType: Enter either "mongo" or "sql".
144
+
-[3] databaseURL: Enter the URL of your database.
145
+
-[4] wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no".
80
146
- Note: If you choose "yes" for this param, the middleware will NOT log container stats. In other words, if you want container stats instead, input "no" here and "yes" for param #6.
81
-
*[5] queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose:
147
+
-[5] queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose:
82
148
- "s" : every second
83
149
- "m" : every minute (default)
84
150
- "h" : every hour
85
151
- "d" : once per day
86
152
- "w" : once per week
87
-
*[6] isDockerized: Is this microservice running in a Docker container? Enter "yes" or "no". (Defaults to "no".)
153
+
-[6] isDockerized: Is this microservice running in a Docker container? Enter "yes" or "no". (Defaults to "no".)
88
154
- IMPORTANT: When starting up the container, give it the same name that you used for the microservice, because the middleware finds the correct container ID of your container by matching the container name to the microservice name you input as 1st argument.
89
155
- Don't forget to bind mount to Docker socket. See NEW FEATURE section above.
Additionally, the repo includes a test suite of microservices utilizing the Chronos node module so that their communication, health, and container data can be logged. You can then visualize the data with the Electron app.
190
+
Additionally, the repo includes a test suite of microservices utilizing the Chronos node module so that their communication, health, and container data can be logged. You can then visualize the data with the Electron app.
112
191
113
-
The microservices include individual Dockerfiles in their respective directories. A docker-compose.yml is in the root directory in case you'd like to deploy all services together.
192
+
The microservices include individual Dockerfiles in their respective directories. A docker-compose.yml is in the root directory in case you'd like to deploy all services together.
114
193
115
194
Refer to the [README](https://github.com/oslabs-beta/Chronos/tree/docker/microservice) of that branch for more details.
116
195
@@ -127,19 +206,19 @@ Chronos hopes to inspire an active community of both users and developers. For q
0 commit comments