Skip to content

Commit dff7008

Browse files
committed
docs: Init architecture diagrams README.md
1 parent c856fbe commit dff7008

File tree

4 files changed

+3086
-0
lines changed

4 files changed

+3086
-0
lines changed

docs/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Architecture
2+
3+
The Security tracker consists of a server process that's responsible for
4+
handling HTTP requests and a worker process that's doing all the background
5+
processing.
6+
7+
![Overall Architecture](./svg/architecture.svg)
8+
9+
# Database Schema
10+
![Database Schema](./svg/models.svg)

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

docs/svg/architecture.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)