Skip to content

Commit e5f8bd1

Browse files
committed
Huly Network
Signed-off-by: Andrey Sobolev <[email protected]>
1 parent cdceb8c commit e5f8bd1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4894
-1
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
env:
2424
CacheFolders: |
2525
communication
26+
network
2627
common
2728
desktop
2829
desktop-package

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,25 @@ If you want to interact with Huly programmatically, check out our [API Client](.
2828

2929
You can find API usage examples in the [Huly examples](https://github.com/hcengineering/huly-examples) repository.
3030

31+
## Huly Virtual Network
32+
33+
The platform features a distributed network architecture that enables scalable, fault-tolerant communication between accounts, workspaces, and nodes. The [Huly Virtual Network](./network/README.md) provides:
34+
35+
- **Distributed Load Balancing**: Intelligent routing across multiple nodes using consistent hashing
36+
- **Multi-Tenant Architecture**: Secure workspace isolation with role-based access control
37+
- **Fault Tolerance**: Automatic failover and recovery mechanisms
38+
- **Real-time Communication**: Event-driven architecture with broadcast capabilities
39+
40+
For detailed information about the network architecture, deployment, and API reference, see the [Network Documentation](./network/README.md).
41+
3142
## Table of Contents
3243

3344
- [Huly Platform](#huly-platform)
3445
- [About](#about)
3546
- [Self-Hosting](#self-hosting)
3647
- [Activity](#activity)
3748
- [API Client](#api-client)
49+
- [Huly Virtual Network](#huly-virtual-network)
3850
- [Table of Contents](#table-of-contents)
3951
- [Pre-requisites](#pre-requisites)
4052
- [Verification](#verification)
@@ -106,20 +118,21 @@ This project uses GitHub Packages for dependency management. To successfully dow
106118
Follow these steps:
107119

108120
1. Generate a GitHub Token:
121+
109122
- Log in to your GitHub account
110123
- Go to **Settings** > **Developer settings** > **Personal access tokens** (https://github.com/settings/personal-access-tokens)
111124
- Click **Generate new token**
112125
- Select the required scopes (at least `read:packages`)
113126
- Generate the token and copy it
114127

115128
2. Authenticate with npm:
129+
116130
```bash
117131
npm login --registry=https://npm.pkg.github.com
118132
```
119133

120134
When prompted, enter your GitHub username, use the generated token as your password
121135

122-
123136
## Fast start
124137

125138
```bash
@@ -280,6 +293,7 @@ This guide describes the nuances of building and running the application from so
280293
#### Disk Space Requirements
281294

282295
Ensure you have sufficient disk space available:
296+
283297
- A fully deployed local application in clean Docker will consume slightly more than **35 GB** of WSL virtual disk space
284298
- The application folder after build (sources + artifacts) will occupy **4.5 GB**
285299

@@ -303,6 +317,7 @@ Make sure Docker is accessible from WSL:
303317
Windows Git often automatically replaces line endings. Since most build scripts are `.sh` files, ensure your Windows checkout doesn't break them.
304318

305319
**Solution options:**
320+
306321
- Checkout from WSL instead of Windows
307322
- Configure Git on Windows to disable auto-replacement:
308323
```bash
@@ -343,6 +358,7 @@ After these preparations, the build instructions should work without issues.
343358
When starting the application (`rush docker:up`), some network ports in Windows might be occupied. You can fix port mapping in the `\dev\docker-compose.yaml` file.
344359

345360
**Important:** Depending on which port you change, you'll need to:
361+
346362
1. Find what's using that port
347363
2. Update the new address in the corresponding service configuration
348364

common/config/rush/pnpm-lock.yaml

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

network/README.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Huly Virtual Network
2+
3+
A distributed, scalable virtual network architecture for the Huly that enables fault-tolerant performance communication.
4+
5+
## 🚀 Overview
6+
7+
The Huly Virtual Network is a sophisticated distributed system designed to handle enterprise-scale workloads with the following key capabilities:
8+
9+
- **Distributed Load Balancing**: Intelligent routing to key components across multiple phytsical nodes.
10+
- **Multi-Tenant Architecture**: Secure isolation of containers for user sessions/search engines/transaction processors.
11+
- **Fault Tolerance**: Automatic failover and recovery mechanisms
12+
- **Scaling**: Horizontal and vertical service scalling.
13+
- **Real-time Communication**: Event-driven architecture with broadcast capabilities between containers.
14+
15+
## Network Architecture Components
16+
17+
### Agents & Containers
18+
19+
Agent is a top of the rock for containers. Containers are work horses for any application build on top of Huly Network, they could be started, located and used.
20+
Every container could be located by its {kind + uuid} or using a labeling system. After being found anyone could send a message to container and ask for some activity.
21+
22+
Container's could be communicated two ways:
23+
24+
1. Anyone could send a message to container using network.
25+
2. A request/response connection could be established to container using network.
26+
27+
Network provide a references to containers, if container is references it will be active until reference is exists. If there is no references to contaienr, it will be keept for some timeout and closed.
28+
29+
Agents provide a list of container kinds they support to be started to Huly Network, manage them and provide live/monitoring and networking capabilities.
30+
Communication to containers are managed by Huly Network.
31+
32+
```mermaid
33+
flowchart BT
34+
subgraph Agent["Agent"]
35+
subgraph _TX["Transactor"]
36+
TX1["ws1"]
37+
TX2["ws2"]
38+
end
39+
subgraph _VMM["Virtual Machine"]
40+
AG1["Hulia Agent"]
41+
AG2["James Agent"]
42+
end
43+
subgraph _Sessions["Session"]
44+
S1["user1"]
45+
S2["user2"]
46+
end
47+
subgraph _Query["Query Engine"]
48+
Q1["Europe"]
49+
Q3["ws3"]
50+
end
51+
end
52+
subgraph Agent2["Agent2"]
53+
subgraph _TX_2["Transactor"]
54+
TX3["ws3"]
55+
TX4["ws4"]
56+
end
57+
subgraph _Query_2["Query Engine"]
58+
Q1_2["Europe"]
59+
Q2_2["America"]
60+
end
61+
end
62+
63+
subgraph NET["Huly Network"]
64+
Containers["Containers"]
65+
Agents["Agents"]
66+
end
67+
68+
69+
S1 -.-> TX1 & Q1 & Q2_2 & TX4
70+
Agent --> NET
71+
Agent2 --> NET
72+
AG1@{ shape: stored-data}
73+
AG2@{ shape: stored-data}
74+
S1@{ shape: h-cyl}
75+
S2@{ shape: h-cyl}
76+
style Agent stroke:#00C853
77+
```
78+
79+
## Building Huly on top of Huly Network
80+
81+
Huly could be managed by following set of container kinds, `session`, `query`, `transactor`.
82+
83+
- session -> a map/reduce/find executor for queries and transactions from client.
84+
- query -> a DB query engine, execute `find` requests from session and pass them to DB, allow to search for all data per region. Should have access to tables of account -> workspace mapping for security.
85+
- transactor -> modification archestrator for all edit operations, do them one by one.
86+
87+
```mermaid
88+
flowchart
89+
Endpoint -.->|
90+
connect
91+
session/user1
92+
|HulyNetwork[Huly Network]
93+
94+
Endpoint <-->|find,tx| sesion:user1
95+
96+
sesion:user1 -..->|list-workspaces| Account
97+
98+
sesion:user1 -..->|find| query:europe
99+
sesion:user1 -..->|find| transactor:ws1
100+
101+
sesion:user1 -..->|cnt:1| query:europe
102+
query:europe -..->|resp:1/1| sesion:user1
103+
query:europe -..->|resp:1/2:fin| sesion:user1
104+
105+
sesion:user1 -..->|response chunks| Endpoint
106+
107+
sesion:user1 -..->|tx| transactor:ws1
108+
109+
transactor:ws1 -..->|resp| sesion:user1
110+
111+
query:europe -..->|"select"| DB[DB]
112+
transactor:ws1 -..->|select/update| DB
113+
114+
DB@{shape: database}
115+
116+
```
117+
118+
## ZeroMQ network implementation

network/core/.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: ['./node_modules/@hcengineering/platform-rig/profiles/node/eslint.config.json'],
3+
parserOptions: {
4+
tsconfigRootDir: __dirname,
5+
project: './tsconfig.json'
6+
}
7+
}

network/core/config/rig.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
3+
"rigPackageName": "@hcengineering/platform-rig",
4+
"rigProfile": "node"
5+
}

network/core/docs/alive-checkins.md

Whitespace-only changes.

network/core/jest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
5+
roots: ["./src"],
6+
coverageReporters: ["text-summary", "html"]
7+
}

0 commit comments

Comments
 (0)