|
1 | | - |
2 | | -## Chronos |
3 | | -Microservice communication, health, and Docker container visualizer. |
4 | | -Comes with a middleware and an Electron app. |
| 1 | +<p align="center"> |
| 2 | + <img src="./app/assets/chronos-v4.png" height=300/> |
| 3 | +</p> |
5 | 4 |
|
6 | | -## Features |
| 5 | +[](https://github.com/open-source-labs/Chronos) |
| 6 | + |
| 7 | + |
7 | 8 |
|
8 | | - * NEW (3.0+): Docker container stats (e.g. ID, memory usage %, CPU usage %, running processes, etc.) (New middleware compiled from TypeScript.) |
9 | | - * HTTP request tracing |
10 | | - * Speed and latency tracking |
11 | | - * Process monitoring |
12 | | - * Memory usage |
| 9 | +# Chronos |
13 | 10 |
|
14 | | -## NEW FEATURE FOR 3.0+ - Logging Docker Container Stats |
| 11 | +> A developer tool that monitors the health and web traffic of servers, microservices, and containers. |
15 | 12 |
|
16 | | -IMPORTANT: Give your containers the same names you use for arguments for microservice names. Read more about it under the INSTALLATION section below. |
| 13 | +## NEW FEATURES FOR 4.0+ - Real-time Data and Docker Container Stats |
17 | 14 |
|
18 | | -IMPORTANT: In order to have container stats saved to your database along with other health info, when starting up the containers, bind volumes to this path: |
19 | | -`/var/run/docker.sock` |
| 15 | +- Improved user interface & experience |
| 16 | +- Real-time data monitoring |
| 17 | +- Decreased loading times |
| 18 | +- Automated notifications(Slack, email) |
| 19 | +- Easier to use configuration file |
| 20 | +- Now works on Linux, Mac, and Windows |
| 21 | +- Previous versions(less than 4.0) of Chronos are no longer supported |
20 | 22 |
|
21 | | -For example, you can type the following when starting up a container: |
22 | | -`docker run -v /var/run/docker.sock:/var/run/docker.sock [your-image-tag]` |
23 | 23 |
|
24 | | -If you're using docker-compose to start up multiple containers at once, you can add a `volumes` key for each of your services in the YAML file: |
| 24 | +## Core Features |
| 25 | + <!-- * HTTP request tracing --> |
| 26 | +- Docker container stats (e.g. ID, memory usage %, CPU usage %, running processes, etc.) |
| 27 | +- Temperature, speed, latency, and memory tracking |
| 28 | +- Process monitoring |
| 29 | + |
| 30 | +# Quick start |
| 31 | + |
| 32 | +Install dependencies |
| 33 | + |
25 | 34 | ``` |
26 | | -volumes: |
27 | | - - "/var/run/docker.sock:/var/run/docker.sock" |
| 35 | +npm install chronos-tracker |
28 | 36 | ``` |
29 | 37 |
|
30 | | -*Note: This module leverages the features of [systeminformation](https://systeminformation.io/). |
| 38 | +Create `chronos-config.js` within the **same directory** as your `server.js` |
31 | 39 |
|
32 | | -## Installation |
| 40 | +```js |
| 41 | +const chronos = require('chronos-tracker'); |
| 42 | + |
| 43 | +cmd.use({ |
| 44 | + microservice: 'chronos-mon-2', |
| 45 | + interval: 3000, |
| 46 | + dockerized: true, |
| 47 | + database: { |
| 48 | + type: 'MongoDB', |
| 49 | + URI: /* NEW DATABASE URI */, |
| 50 | + }, |
| 51 | + notifications: [ |
| 52 | + { |
| 53 | + type: 'slack', |
| 54 | + settings: { |
| 55 | + slackurl: /* YOUR SLACK WEBHOOK URL*/, |
| 56 | + }, |
| 57 | + }, |
| 58 | + { |
| 59 | + type: 'email', |
| 60 | + settings: { |
| 61 | + emails: /* EMAIL RECIPIENT LIST */, |
| 62 | + emailHost: /* EMAIL HOST */, |
| 63 | + emailPort: /* EMAIL PORT */, |
| 64 | + user: /* SENDER EMAIL ADDRESS */, |
| 65 | + password: process.env.EMAIL_PASSWORD, |
| 66 | + }, |
| 67 | + }, |
| 68 | + ], |
| 69 | +}); |
| 70 | +``` |
33 | 71 |
|
34 | | -Chronos consists of a [Node](https://nodejs.org/en/) module available through the |
35 | | -[npm registry](https://www.npmjs.com/) and a lightweight [Electron](https://electronjs.org/) desktop application. |
| 72 | +Refer to section setup for more information on these properties |
36 | 73 |
|
37 | | -#### Node module |
38 | 74 |
|
39 | | -To begin, install the [Chronos](https://www.npmjs.com/package/chronos-microservice-debugger4) node module within each microservice of your application using the |
40 | | -[`npm install`](https://docs.npmjs.com/getting-started/installing-npm-packages-locally)command: |
| 75 | +_NOTE: Email notification settings may require alternative security settings to work_ |
41 | 76 |
|
42 | | -``` |
43 | | -npm install chronos-microservice-debugger4 |
44 | | -``` |
| 77 | +Initialize chronos |
| 78 | + |
| 79 | +```js |
| 80 | +const cmd = require('chronos-tracker'); |
| 81 | +require('./cmd-config'); // Bring in config file |
45 | 82 |
|
46 | | -Once installed, write the following two lines at the top of each microservice's server file: |
47 | | -```javascript |
48 | | -const cmd = require('chronos-microservice-debugger4'); |
49 | 83 | cmd.propagate(); |
| 84 | +app.use('/', cmd.track()); |
50 | 85 | ``` |
51 | 86 |
|
52 | | -Then add a route handler for all incoming requests: |
53 | | -```js |
54 | | -app.use('/', |
55 | | - cmd.microCom( |
56 | | - 'microserviceName', |
57 | | - 'databaseType', |
58 | | - 'databaseURL', |
59 | | - 'wantMicroHealth', |
60 | | - 'queryFrequency', |
61 | | - 'isDockerized' |
62 | | - ) |
63 | | -) |
| 87 | +Download Chronos to view your application data [here]() |
| 88 | + |
| 89 | +<!-- # Installation |
| 90 | +
|
| 91 | +Chronos consists of a [Node](https://nodejs.org/en/) module available through the |
| 92 | +[npm registry](https://www.npmjs.com/) and a lightweight [Electron](https://electronjs.org/) desktop application. --> |
| 93 | + |
| 94 | +# Containerized Applications Using Docker |
| 95 | + |
| 96 | +IMPORTANT: Give your containers the same names you use for arguments for microservice names. Read more about it under the INSTALLATION section below. |
| 97 | + |
| 98 | +IMPORTANT: In order to have container stats saved to your database along with other health info, when starting up the containers, bind volumes to this path: |
| 99 | +`/var/run/docker.sock` |
| 100 | + |
| 101 | +For example, you can type the following when starting up a container: |
| 102 | +`docker run -v /var/run/docker.sock:/var/run/docker.sock [your-image-tag]` |
| 103 | + |
| 104 | +If you're using docker-compose to start up multiple containers at once, you can add a `volumes` key for each of your services in the YAML file: |
| 105 | + |
| 106 | +``` |
| 107 | +volumes: |
| 108 | + - "/var/run/docker.sock:/var/run/docker.sock" |
64 | 109 | ``` |
65 | 110 |
|
66 | | -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. |
| 111 | +\*Note: This module leverages the features of [systeminformation](https://systeminformation.io/). |
| 112 | + |
67 | 113 |
|
68 | | -cmd.microCom takes six parameters. You can enter the arguments as individual strings or as an array. |
| 114 | +## Configuration Setup |
69 | 115 |
|
70 | | -The parameters are: |
71 | | -* [1] microserviceName: To identify the microservice (i.e. "payments"). |
| 116 | +- [1] microserviceName: To identify the microservice (i.e. "payments"). |
72 | 117 | - Make sure this name matches your container name. More details more below (param #6). |
73 | 118 | - Your input name for the microservice will be turned to an all-lowercase string. |
74 | | -* [2] databaseType: Enter either "mongo" or "sql". |
75 | | -* [3] databaseURL: Enter the URL of your database. |
76 | | -* [4] wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no". |
| 119 | +- [2] databaseType: Enter either "mongo" or "sql". |
| 120 | +- [3] databaseURL: Enter the URL of your database. |
| 121 | +- [4] wantMicroHealth: Do you want to monitor the health of this microservice? Enter "yes" or "no". |
77 | 122 | - 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. |
78 | | -* [5] queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose: |
| 123 | +- [5] queryFrequency (optional): How frequently do you want to log the health of this microservice? It defaults to every minute, but you can choose: |
79 | 124 | - "s" : every second |
80 | 125 | - "m" : every minute (default) |
81 | 126 | - "h" : every hour |
82 | 127 | - "d" : once per day |
83 | 128 | - "w" : once per week |
84 | | -* [6] isDockerized: Is this microservice running in a Docker container? Enter "yes" or "no". (Defaults to "no".) |
| 129 | +- [6] isDockerized: Is this microservice running in a Docker container? Enter "yes" or "no". (Defaults to "no".) |
85 | 130 | - 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. |
86 | 131 | - Don't forget to bind mount to Docker socket. See NEW FEATURE section above. |
87 | 132 |
|
88 | | -String parameter example: |
89 | | -```javascript |
90 | | -app.use('/', cmd.microCom('payments', 'mongo', 'mongodb+srv://user:password@cluster0-abc.mongodb.net/','yes','m','no')) |
91 | | -``` |
92 | 133 |
|
93 | | -Array parameter example: |
94 | | -```javascript |
95 | | -let values = [ |
96 | | - 'payments', |
97 | | - 'mongo', |
98 | | - 'mongodb+srv://user:password@cluster0-abc.mongodb.net/', |
99 | | - 'no', |
100 | | - 'h', |
101 | | - 'yes' |
102 | | -] |
103 | | - |
104 | | -app.use('/', cmd.microCom(values) |
105 | | -``` |
106 | | -#### Microservice Test Suite |
| 134 | +## Microservice Test Suite |
107 | 135 |
|
108 | | -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. |
| 136 | +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. |
109 | 137 |
|
110 | | -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. |
| 138 | +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. |
111 | 139 |
|
112 | 140 | Refer to the [README](https://github.com/oslabs-beta/Chronos/tree/docker/microservice) of that branch for more details. |
113 | 141 |
|
114 | 142 | #### Electron desktop application |
115 | 143 |
|
116 | | -After installing the node module in each microservice, download the Electron desktop application from the public [Chronos](https://github.com/oslabs-beta/Chronos) repo. |
| 144 | +After installing the node module in each microservice, download the Electron desktop application from the public [Chronos]() repo. |
117 | 145 |
|
118 | 146 | Inside the downloaded directory, install all dependencies using the `npm install` command followed by the `npm start` command to start the Electron desktop application. |
119 | 147 |
|
120 | 148 | ## Contributing |
121 | 149 |
|
122 | | -Chronos hopes to inspire an active community of both users and developers. For questions, comments, or contributions, please submit a pull request. |
| 150 | +Development of Chronos is open source on GitHub through the tech accelerator umbrella OS Labs, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving Chronos. |
| 151 | + |
| 152 | +- [Contributing Guide](https://github.com/oslabs-beta/Chronos/CONTRIBUTING.md) |
123 | 153 |
|
124 | 154 | ## People |
125 | 155 |
|
126 | 156 | [Tim Atapagra](https://github.com/timpagra), |
127 | | -[Brian Bui](https://github.com/Umius-Brian), |
| 157 | +[Todd Buckner](https://github.com/tdwolf6), |
| 158 | +[Brian Bui](https://github.com/Umius-Brian), |
| 159 | +[Ronelle Caguioa](https://github.com/ronellecaguioa), |
128 | 160 | [Mohtasim Chowdhury](https://github.com/mohtasim317), |
129 | 161 | [Ousman Diallo](https://github.com/Dialloousman), |
130 | 162 | [Michelle Herrera](https://github.com/mesherrera), |
131 | | -[Alan Lee](https://github.com/ajlee12/), |
| 163 | +[Alan Lee](https://github.com/ajlee12/), |
132 | 164 | [Duane McFarlane](https://github.com/Duane11003), |
133 | 165 | [Ben Mizel](https://github.com/ben-mizel), |
134 | | -[Alon Ofengart](https://github.com/alon25), |
| 166 | +[Alon Ofengart](https://github.com/alon25), |
| 167 | +[Greg Palasciano](https://github.com/gregpalace), |
135 | 168 | [Jenae Pennie](https://github.com/jenaepen), |
136 | 169 | [Chris Romano](https://github.com/robicano22), |
137 | 170 | [Brianna Sookhoo](https://github.com/briannasookhoo), |
138 | | -[Natalie Umanzor](https://github.com/nmczormick) |
| 171 | +[Natalie Umanzor](https://github.com/nmczormick), |
| 172 | +[Michael Wang](https://github.com/wang3101) |
139 | 173 |
|
140 | 174 | ## License |
141 | 175 |
|
142 | | -[MIT](https://github.com/oslabs-beta/Chronos/blob/master/LICENSE.md) |
| 176 | +Chronos is [MIT licensed.](https://github.com/oslabs-beta/Chronos/blob/master/LICENSE.md) |
0 commit comments