Skip to content

Commit f0e78cc

Browse files
docs: service architecture diagram
1 parent 8e00269 commit f0e78cc

File tree

2 files changed

+88
-3
lines changed

2 files changed

+88
-3
lines changed

docs/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1-
# Storage space considerations
1+
# Architecture
2+
3+
The Nixpkgs vulnerability tracker consists of
4+
- a server process for handling HTTP requests
5+
- worker processes for recurring data ingestion
6+
7+
![Service architecture diagram](./architecture.mermaid)
8+
9+
## External services
10+
11+
The tracker needs to communicate with third party services, namely:
12+
13+
- The GitHub API for user authentication, team permissions, creating issues, etc.
14+
- GitHub repositories:
15+
- https://github.com/nixos/nixpkgs to pull the latest changes from Nixpkgs
16+
- https://github.com/CVEProject/cvelistV5 to pull CVE data
17+
- https://prometheus.nixos.org/ to get information about the latest channels
18+
19+
## Storage space considerations
220

321
The tracker requires significant storage space to run properly.
422
In particular, there are two different areas you'll need storage for, the database and the Nix store.
523

6-
## Database
24+
### Database
725

826
In order to store three diffent Nixpkgs releases, you'll need around 80GB of space for the Postgresql database.
927

1028
As the number of CVEs and packages increases, the storage space requirement will most likely increase as well.
1129

12-
## Nix store and filesystem
30+
### Nix store and filesystem
1331

1432
Since the tracker instantiates derivations for all packages, it creates a lot of small files in the filesystem.
1533
You need to make sure you have both enough space for this and enough inodes on your filesystem.

docs/architecture.mermaid

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
graph TB
2+
Users["**👥 Users**"]
3+
4+
subgraph External["**External Services**"]
5+
GitHub["**GitHub API**"]
6+
GitHubNixos["**GitHub Repository**<br/>*nixos/nixpkgs*"]
7+
GitHubCVEs["**GitHub Repository**<br/>*CVEProject/cvelistV5*"]
8+
NixMonitoring["**NixOS Monitoring**<br/>*Channel Status*"]
9+
end
10+
11+
subgraph SecurityTracker ["**Security Tracker Host**"]
12+
subgraph Web["**Web**"]
13+
Nginx["**Nginx HTTP**"]
14+
WSGI["**WSGI Django**<br/>*Django Views*"]
15+
end
16+
17+
subgraph ManageCommands["**Management Commands**"]
18+
FetchAllChannels["**fetch_all_channels**"]
19+
IngestCVEs["**ingest_delta_cve**"]
20+
end
21+
22+
subgraph Background["**Background Tasks**"]
23+
SystemdTimerChannels["**Systemd Timer Fetch Channels**"]
24+
SystemdTimerCVEs["**Systemd Timer Ingest CVEs**"]
25+
NixEval["**Evaluate Nix**"]
26+
DjangoWorker["**Django worker**"]
27+
end
28+
29+
subgraph Storage["**Storage**"]
30+
PostgreSQL["**PostgreSQL**<br/>*CVE Records<br/>Channels<br/>Users<br/>Issues*"]
31+
LocalGitCheckout["**Local Git Repo**<br/>*nixpkgs clone /var/lib/web-security-tracker/nixpkgs-repo*"]
32+
NixStore["**Nix store**"]
33+
end
34+
35+
end
36+
37+
%% User interactions
38+
Users -->|HTTP Request| Nginx -->|Forward| WSGI -->|Queries| PostgreSQL
39+
WSGI --> GitHub
40+
41+
%% Timers
42+
SystemdTimerChannels -.->|**Triggers Daily**| FetchAllChannels
43+
FetchAllChannels -->|1 Fetch Channels| NixMonitoring
44+
FetchAllChannels -->|2 Git pull| GitHubNixos
45+
FetchAllChannels -->|3 Update Repo| LocalGitCheckout
46+
FetchAllChannels -->|4 Evaluate Nix| NixEval --> NixStore
47+
48+
SystemdTimerCVEs -.->|**Triggers Daily**| IngestCVEs
49+
IngestCVEs -->|1 Fetch CVEs| GitHubCVEs
50+
IngestCVEs -->|2 Update Database| PostgreSQL
51+
IngestCVEs -->|3 PgTrigger Suggestions| DjangoWorker
52+
53+
classDef userClass fill:#e1f5fe,stroke:#01579b,stroke-width:3px,color:#000
54+
classDef externalClass fill:#f3e5f5,stroke:#4a148c,stroke-width:3px,color:#000
55+
classDef webClass fill:#e8f5e8,stroke:#2e7d32,stroke-width:3px,color:#000
56+
classDef commandClass fill:#fff3e0,stroke:#e65100,stroke-width:3px,color:#000
57+
classDef backgroundClass fill:#fce4ec,stroke:#c2185b,stroke-width:3px,color:#000
58+
classDef storageClass fill:#f1f8e9,stroke:#33691e,stroke-width:3px,color:#000
59+
classDef subgraphClass fill:#fafafa,stroke:#424242,stroke-width:3px
60+
61+
class Users userClass
62+
class GitHub,GitHubNixos,GitHubCVEs,NixMonitoring externalClass
63+
class Nginx,WSGI webClass
64+
class FetchAllChannels,IngestCVEs commandClass
65+
class SystemdTimerChannels,SystemdTimerCVEs,NixEval,DjangoWorker backgroundClass
66+
class PostgreSQL,LocalGitCheckout,NixStore storageClass
67+
class Storage,Background,ManageCommands,Web subgraphClass

0 commit comments

Comments
 (0)