Skip to content

Commit d8a5ba0

Browse files
committed
feat: rework submissions with RabbitMQ
1 parent 8b3c09d commit d8a5ba0

10 files changed

+597
-425
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ REDIS_PORT=6378
77
#REDIS_PASS=
88
#REDIS_PORT=
99
REDIS_TLS=false
10+
RABBITMQ_URL=amqp://admin:admin@localhost:5672/

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,26 @@ Prod:
2121
npm start
2222
```
2323

24-
## Manage database with TypeORM
24+
## Architecture
25+
26+
### Submission jobs
27+
28+
| Component | Action |
29+
| --------- | ------------------------------------------------------------------------------------------------------------------- |
30+
| `Worker` | Launch and maintain pool of X prebooted microVMs in the background |
31+
| `Worker` | Bind to RabbitMQ queue `jobs_q` on `jobs_ex` exchange and `jobs_rk` routing key |
32+
| `API` | Bind to RabbitMQ queue `jobs_status_q` on `jobs_status_ex` exchange and `jobs_status_rk` routing key |
33+
| `Front` | `POST /submissions` |
34+
| `Front` | poll `GET /submissions/:id` every 500 ms |
35+
| `API` | Send job to RabbitMQ on `jobs_ex` direct exchange with `jobs_rk` routing key. |
36+
| `Worker` | Receive job, get ready microVM from pool, send job to agent in microVM |
37+
| `Agent` | Compile/Run code, return result |
38+
| `Worker` | During two previous steips, send status of jobs on `jobs_status_ex` exchange with `jobs_status_rk` routing key |
39+
| `API` | Receive each new status on `jobs_status_q`, and insert them into DB, so that the polling can get the latest status. |
40+
41+
## Contribute
42+
43+
### Manage database with TypeORM
2544

2645
Delete schema:
2746

@@ -52,11 +71,11 @@ Create migration:
5271
npm run typeorm migration:generate -- -n AddNewEntity
5372
```
5473

55-
## Style
74+
### Code Style
5675

5776
Available commands for eslint/prettier:
5877

59-
```
78+
```sh
6079
npm run lint:check
6180
npm run lint:fix
6281
npm run format:check

0 commit comments

Comments
 (0)