Skip to content

Commit b438369

Browse files
author
a-tylenda
committed
Add healtch check def
1 parent 7b4326c commit b438369

File tree

3 files changed

+91
-76
lines changed

3 files changed

+91
-76
lines changed

README.md

+28-31
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* [Prepare environment](#21-prepare-environment)
3838
* [Install STH](#22-install-sth)
3939
3. [Run your first Sequence](#3-run-your-first-sequence)
40-
* [Review the package](#31-review-the-package)
40+
* [Review the Sequence package](#31-review-the-sequence-package)
4141
* [Run the Sequence](#32-run-the-sequence)
4242
4. [Where to go next](#4-where-to-go-next)
4343
5. [User's dictionary](#5-users-dictionary)
@@ -61,22 +61,22 @@ We named our apps "Sequences" and that term describes well its nature, as they p
6161
</details>
6262
<br>
6363

64-
The core part of our STH engine is called the "host".
64+
The core part of our STH engine is called the "Hub".
6565

6666
<details>
6767
<summary>
68-
<strong>Host</strong>
68+
<strong>Hub</strong>
6969
</summary>
7070

71-
**Host** is responsible for maintaining and deploying Sequences, keeping them running and managing its lifecycle.
71+
**Hub** is responsible for maintaining and deploying Sequences, keeping them running and managing its lifecycle.
7272

73-
Host exposes also its own REST API to provide and receive data and manage Sequences and host itself.
73+
Hub exposes also its own REST API to provide and receive data and manage Sequences and Hub itself.
7474

75-
What we also do on the host level is that we apply a set of algorithms to optimize and speed up data processing execution in Sequences.
75+
What we also do on the Hub level is that we apply a set of algorithms to optimize and speed up data processing execution in Sequences.
7676

7777
> We call our processing optimization algorithms **"IFCA"** meaning "Intelligent Function Composition Algorithms".
7878
79-
You can interact with host using our dedicated STH CLI that will help you with Sequences deployment, running and monitoring.
79+
You can interact with Hub using our dedicated STH CLI that will help you with Sequences deployment, running and monitoring.
8080
</details>
8181
<br>
8282
Our vanilla STH engine is based on Node.js and thus allows developers to benefit from its rich ecosystem, numerous packages and solutions provided by this vibrant community.
@@ -103,16 +103,17 @@ Our vanilla STH engine is based on Node.js and thus allows developers to benefit
103103

104104
<details>
105105
<summary>
106-
<strong>Host</strong>
106+
<strong>Hub</strong>
107107
</summary>
108108

109109
This is a solution for the central processing and management unit with the following major components:
110110

111-
1. **Sequences** - these are the actual "STH" apps. It is a package containing at least two files:
112-
* **package.json** - JSON manifest file describing the app and its configuration; such as main file to run
113-
* **main file** - file such as `index.js` or `index.ts` that contains a lightweight application business logic.
114-
2. **Instance** - once a Sequence is run, the host will create a separate runtime environment for it and will execute Sequence code inside this runtime entity. This is an Instance.
115-
3. **API & CLI** - our Application Programming Interface and CLI connecting to it allows both for **Data operations** (sending input data and receiving output data) and **Management operations** (manage host itself and its entities: Sequences or Instances)
111+
1. **Sequence** - a user's program to be executed on the Hub, that contains a developer's code that consists of one or more functions with a lightweight application business logic. It needs to be packed into a package together with its dependencies (compressed into `tar.gz` format) before sending it to STH.
112+
2. **Instance** - once a Sequence is run, the Hub will create a separate runtime environment for it and will execute Sequence code inside this runtime entity. This is an Instance.
113+
3. **API & CLI** - our Application Programming Interface and Command Line Interface that allow for:
114+
115+
* **Data operations** - sending input data and receiving output data
116+
* **Management operations** - manage Hub itself and its entities: Sequences or Instances
116117

117118
</details>
118119

@@ -158,21 +159,17 @@ npm i -g @scramjet/sth @scramjet/cli
158159
scramjet-transform-hub
159160
```
160161

161-
> 💡 **HINT:** There is also an alias for running STH:
162-
>
163-
>```bash
164-
>sth
165-
>```
162+
> 💡 **HINT:** There is also an alias for running STH: `sth`
166163
167164
More detailed installation instructions can be found in our [STH GitHub repository](https://github.com/scramjetorg/transform-hub//HEAD/#installation-clamp).
168165

169166
## **3. Run your first Sequence**
170167

171-
### **3.1 Review the package**
168+
### **3.1 Review the Sequence package**
172169

173-
Before running your first Sequence let's have a quick look what's inside the Sequence package.
170+
Before running the Sequence let's have a quick look what's inside the Sequence package.
174171

175-
We have prepared for you a simple JavaScript sample Sequence "hello-snowman". This Sequence is available in the directory `samples/hello-snowman` in this repository. In this directory you will find two files:
172+
We have prepared for you a simple JavaScript sample Sequence "hello-snowman". This Sequence is available in the directory [samples/hello-snowman](./samples/hello-snowman/) in this repository. In this directory you will find two files:
176173

177174
* `package.json` - manifest file that describes this particular Sequence
178175
* `index.js` - file containing main application logic.
@@ -185,16 +182,16 @@ There is no need to change anything in our `hello-snowman` Sequence for a first
185182

186183
### **3.2 Run the Sequence**
187184

188-
There are 4 steps to follow in order to run the example Sequence:
185+
There are 5 steps to follow in order to run the example Sequence:
189186

190187
<details>
191188
<summary>
192-
<strong>1. Pack your Sequence into a package</strong>
189+
<strong>1. Pack your Sequence into a <code>*.tar.gz</code> package</strong>
193190
</summary>
194191

195-
Every "Sequence" app needs to be packaged (compressed) before sending to the Transform Hub. Package is a simple TAR archive and our STH CLI has a special command to pack an app directory into a Sequence tarball.
192+
Every Sequence app needs to be packaged (compressed) before sending to the Transform Hub. Package is a simple TAR archive and our STH CLI has a special command to pack an app directory into a Sequence tarball.
196193

197-
> 💡 **Note:** any time, you can display STH CLI help by issuing terminal command `si help` (for general help) or `si <command> help` for specific command (ie. `si sequence help`)
194+
> 💡 **Note:** any time, you can display STH CLI help by issuing terminal command `si help` (for general help). For more information on a specific command, type help + command-name (ie. `si sequence help`)
198195
199196
Please open new terminal window (and keep the first one open with STH running). Then issue following commands in the root directory of this repository:
200197

@@ -213,15 +210,15 @@ There is no output shown in the terminal but you can verify with `ls` that tarba
213210
<strong>2. Send the Sequence package</strong>
214211
</summary>
215212

216-
Send `hello-snowman.tar.gz` to the running host (default localhost API endpoint will be used by the CLI send command) by issuing following command:
213+
Send `hello-snowman.tar.gz` to the running Hub (default localhost API endpoint will be used by the CLI send command) by issuing following command:
217214

218215
```bash
219216
si sequence send ./samples/hello-snowman.tar.gz
220217
```
221218

222219
> 💡 **Note:** if you receive reply: **Request ok: <http://127.0.0.1:8000/api/v1/sequence> status: 422 Unprocessable Entity**, it means that STH Docker images are not yet pulled from DockerHub. Please wait 2-3 minutes and try to issue `si sequence send` command again. We are working on fixing this issue in the next STH release. Also, if you keep receiving docker errors you can start STH without docker: `scramjet-transform-hub --no-docker`
223220
224-
> If you encounter any problems or issues while using our platform, please visit our **[Troubleshooting](https://github.com/scramjetorg/transform-hub#troubleshooting-collision)** section, where some of the problems are already known and described. You can also log an issue/bug there.
221+
> If you encounter any problems or issues while using our platform, please visit our **[Troubleshooting](https://github.com/scramjetorg/transform-hub#troubleshooting-collision)** section, where some of the problems are already known and described. You are also very welcome to [log an issue/bug](https://github.com/scramjetorg/transform-hub/issues/new/choose) on GitHub any time.
225222
226223
The output will look similar to this one:
227224

@@ -240,11 +237,11 @@ SequenceClient {
240237
}
241238
```
242239

243-
Now we have uploaded Sequence to the host and host assigned to it a random ID (GUID), in this case our Sequence ID is:
240+
Now we have uploaded Sequence to the Hub. Each time a Sequence is loaded into the Hub, a random ID (GUID) number is assigned to it, in this case our Sequence ID is:
244241

245242
`_id: 'cf775cc1-105b-473d-b929-6885a0c2182c'`
246243

247-
Host also exposes REST API endpoint for each Sequence and this is also described in this response.
244+
Hub also exposes REST API endpoint for each Sequence and this is also described in this response.
248245

249246
Exposed Sequence ID allows us to move to the next step where we will start the Sequence.
250247

@@ -288,7 +285,7 @@ InstanceClient {
288285
}
289286
```
290287

291-
Sequence is an app template. Once it is up and running, it will become a new Instance. The Instance also receives its own ID (GUID). In this case the Instance ID is:
288+
Once Sequence is up and running, it becomes an Instance. The Instance also receives its own unique ID (GUID). In this case the Instance ID is:
292289

293290
`_id: 'e70222d1-acfc-4e00-b046-4a3a9481c53b'`
294291

@@ -344,7 +341,7 @@ OUTPUT| Snowman ⛄ is freezing 🥶 Winter is coming ❄️ ❄️ ❄️ ❄
344341
Our Sequence generator app does two things here:
345342

346343
* Sends stream of messages; each one containing number with temperature value
347-
* Reads output from Host API that is generated by our `hello-snowman` Sequence
344+
* Reads output from the Hub API that is generated by our `hello-snowman` Sequence
348345

349346
Separately, you can also open a new terminal window and see log of this particular Instance with command `si instance log <instance_id>` or by using alias `si instance log -`. In our case this would be:
350347

dictionary.md

+42-22
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,45 @@ Gherkin is a domain-specific programming language created to write behavior desc
148148

149149
### Health Check
150150

151-
<!-- TODO -->
151+
Information about the health of Instance. It informs whether an Instance is running and what is its resource consumption.
152+
153+
It can be accessed directly through Instance API, in the CLI or Panel.
154+
155+
The Instance API health check endpoint is /health. The following is an example health check from the Instance obtained with curl:
156+
157+
```bash
158+
$ curl http://127.0.0.1:8000/api/v1/instance/e9432a4f-2a64-41a2-82f1-39503a2a18df/health |jq
159+
% Total % Received % Xferd Average Speed Time Time Time Current
160+
Dload Upload Total Spent Left Speed
161+
100 226 0 226 0 0 220k 0 --:--:-- --:--:-- --:--:-- 220k
162+
{
163+
"cpuTotalUsage": 223212751,
164+
"healthy": true,
165+
"limit": 536870912,
166+
"memoryMaxUsage": 14352384,
167+
"memoryUsage": 12136448,
168+
"networkRx": 19852,
169+
"networkTx": 20174,
170+
"containerId": "df0aa7adf027465da1dfb08edd0a66dc8ffc8e0bd1f5d0fc7fafecbefdac72c6"
171+
}
172+
```
173+
174+
While the below is an example of health check from the same Instance but executed using the CLI interface:
175+
176+
```bash
177+
$ si inst health e9432a4f-2a64-41a2-82f1-39503a2a18df
178+
Request ok: http://127.0.0.1:8000/api/v1/instance/e9432a4f-2a64-41a2-82f1-39503a2a18df/health status: 200 OK
179+
{
180+
cpuTotalUsage: 203802417,
181+
healthy: true,
182+
limit: 536870912,
183+
memoryMaxUsage: 14352384,
184+
memoryUsage: 11980800,
185+
networkRx: 16266,
186+
networkTx: 15358,
187+
containerId: 'df0aa7adf027465da1dfb08edd0a66dc8ffc8e0bd1f5d0fc7fafecbefdac72c6'
188+
}
189+
```
152190

153191
### Host
154192

@@ -158,12 +196,6 @@ A set of instances installed on the single operating system (host) together with
158196

159197
- host program - software/program that runs in a computer that provides the source of information or signals.
160198

161-
### Hub
162-
163-
<!-- TODO - what is the difference between Hub and Host, we still use both terms.
164-
Maybe "Host" should be described in general context and "Hub" as a host in scramjet cloud platform's context?
165-
-->
166-
167199
## I
168200

169201
### ILifeCycle (ILC)
@@ -240,16 +272,7 @@ One of the [supervisor's](#supervisor) components, which is responsible for coll
240272

241273
## M
242274

243-
### Manager
244-
245-
<!-- TODO - do we want the user to know that? It will reveal the structure of our platform -->
246-
in the context of the Scramjet platform, Cloud Platform Manager is a host management software that provides service-discovery, controls the scaling of individual instances in accordance with the programmed logic and client configuration, providing [API](#api)
247-
248-
### MultiHost
249-
<!-- TODO - do we want the user to know that? It will reveal the structure of our platform -->
250-
251-
### MultiManager
252-
<!--TODO DO WE WANT OUR USER TO KNOW THAT????-->
275+
<!--### Manager- in the context of the Scramjet platform, Cloud Platform Manager is a host management software that provides service-discovery, controls the scaling of individual instances in accordance with the programmed logic and client configuration, providing [API](#api)-->
253276

254277
## N
255278

@@ -299,10 +322,8 @@ An executable written in one of the supported programming languages that starts
299322

300323
## S
301324

302-
### Scalability
303-
<!-- TODO -->
304-
305325
### Scope
326+
306327
A scope is a handy organization unit that lets a user switch between the currently used spaces and hubs. It is a named pair consisting of one space and one hub. This named pair is saved in the session config, which lets user work with different spaces and hubs sessions simultaneously. There can be multiple scopes, but only one can be used at once in a given session.
307328

308329
### Scramjet
@@ -334,8 +355,7 @@ standard input/standard output/standard error. Application communication channel
334355

335356
### STH
336357

337-
<!--TODO-->
338-
shortcut for Scramjet Transform Hub
358+
shortcut for Scramjet Transform Hub. It is a data processing engine for our Scramjet Cloud Platform
339359

340360
### Synchronous
341361

0 commit comments

Comments
 (0)