You've already forked Curso-lenguaje-python
Add diagrams test
This commit is contained in:
39
catch-all/07_diagrams_as_code/07_web_onpremise.py
Normal file
39
catch-all/07_diagrams_as_code/07_web_onpremise.py
Normal file
@@ -0,0 +1,39 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
from diagrams import Cluster, Diagram
|
||||
from diagrams.onprem.analytics import Spark
|
||||
from diagrams.onprem.compute import Server
|
||||
from diagrams.onprem.database import PostgreSQL
|
||||
from diagrams.onprem.inmemory import Redis
|
||||
from diagrams.onprem.aggregator import Fluentd
|
||||
from diagrams.onprem.monitoring import Grafana, Prometheus
|
||||
from diagrams.onprem.network import Nginx
|
||||
from diagrams.onprem.queue import Kafka
|
||||
|
||||
with Diagram("Advanced Web Service with On-Premise", show=False):
|
||||
ingress = Nginx("ingress")
|
||||
|
||||
metrics = Prometheus("metric")
|
||||
metrics << Grafana("monitoring")
|
||||
|
||||
with Cluster("Service Cluster"):
|
||||
grpcsvc = [
|
||||
Server("grpc1"),
|
||||
Server("grpc2"),
|
||||
Server("grpc3")
|
||||
]
|
||||
|
||||
with Cluster("Sessions HA"):
|
||||
primary = Redis("session")
|
||||
primary - Redis("replica") << metrics
|
||||
grpcsvc >> primary
|
||||
|
||||
with Cluster("Database HA"):
|
||||
primary = PostgreSQL("users")
|
||||
primary - PostgreSQL("replica") << metrics
|
||||
grpcsvc >> primary
|
||||
|
||||
aggregator = Fluentd("logging")
|
||||
aggregator >> Kafka("stream") >> Spark("analytics")
|
||||
|
||||
ingress >> grpcsvc >> aggregator
|
||||
Reference in New Issue
Block a user