|
1 | 1 | from diagrams import Diagram, Cluster, Edge |
2 | 2 | from diagrams.aws.general import Client |
3 | 3 | from diagrams.onprem.compute import Server |
4 | | -from diagrams.aws.network import VPCRouter |
5 | | -from diagrams.generic.network import Firewall |
| 4 | +from diagrams.aws.network import NLB |
6 | 5 | from diagrams.aws.general import GenericDatabase |
7 | 6 |
|
8 | 7 | with Diagram("Horizons workflow", show=False, filename="mongodb_horizons_diagram"): |
9 | 8 | # External World |
10 | 9 | external_client = Client("MongoDB Client") |
11 | 10 |
|
12 | | - with Cluster("Cloud Provider / On-premise"): |
13 | | - with Cluster("Virtual Private Cloud (VPC)"): |
14 | | - with Cluster("Public subnet"): |
15 | | - dns = Firewall("DNS\nmongo.external.mycompany.com") |
16 | | - vpc = VPCRouter("VPC Router\n52.45.100.200") |
| 11 | + with Cluster("Virtual Private Cloud (VPC)"): |
| 12 | + nlb = NLB("Load Balancer\nmongo.external.mycompany.com") |
| 13 | + with Cluster("MongoDB Replica Set"): |
| 14 | + # Create nodes in horizontal alignment |
| 15 | + primary = GenericDatabase("Primary\npsmdb1.internal.net") |
| 16 | + secondary1 = GenericDatabase("Secondary\npsmdb2.internal.net") |
| 17 | + secondary2 = GenericDatabase("Secondary\npsmdb3.internal.net") |
17 | 18 |
|
18 | | - with Cluster("Private subnet"): |
19 | | - # MongoDB Replica Set cluster - aligned horizontally |
20 | | - with Cluster("MongoDB Replica Set"): |
21 | | - # Create nodes in horizontal alignment |
22 | | - primary = GenericDatabase("Primary\npsmdb1.internal.net") |
23 | | - secondary1 = GenericDatabase("Secondary\npsmdb2.internal.net") |
24 | | - secondary2 = GenericDatabase("Secondary\npsmdb3.internal.net") |
25 | | - |
26 | | - app_server = Server("Internal app\n10.0.1.100") |
| 19 | + app_server = Server("Internal app\n10.0.1.100") |
27 | 20 |
|
28 | 21 | # External client flow |
29 | | - external_client >> Edge(label="1 - SNI: mongo.external.mycompany.com") >> dns |
30 | | - dns >> vpc |
31 | | - vpc >> Edge(label="3 - Horizons Reply") >> primary |
32 | | - primary >> Edge(label="2 - Forwards to Primary" ) >> vpc |
33 | | - vpc >> Edge(label="4 - Routes Reply") >> external_client |
| 22 | + external_client >> Edge(label="4. Routes Reply") >> nlb |
| 23 | + nlb >> Edge(label="1. SNI: mongo.external.mycompany.com") >> external_client |
| 24 | + |
| 25 | + nlb >> Edge(label="2. Forwards to Primary") >> primary |
| 26 | + primary >> Edge(label="3. Horizons reply: external hostnames" ) >> nlb |
| 27 | + |
34 | 28 |
|
35 | 29 | # Internal app flow - positioned to avoid overlap with cluster label |
36 | 30 | app_server >> Edge(label="1 - Internal DNS (SNI: psmdb1.internal.net)") >> primary |
|
0 commit comments