Exemple #1
0
from diagrams.aws.compute import Lambda
from diagrams.k8s.compute import Pod, ReplicaSet
from diagrams.onprem.compute import Server as AuthProvider
from diagrams.programming.language import Go
from diagrams.onprem.client import Client
from PIL import Image, ImageChops
import io
import os

# find docs/ directory to save png to
docs_dir = os.path.dirname(os.path.realpath(__file__))
output = os.path.join(docs_dir, "architecture")

with Diagram("", filename=output, direction="LR", show=False) as diag:

    go = Go("operator")

    with Cluster("GCP Project"):

        with Cluster("Orchestrator"):
            api = Pod("api")
            cloudflare = IAP("cloudflared")

        with Cluster("Eventing"):
            producer = Pod("producer")
            consumer = Pod("consumer")
    
        db = SQL("db")
        cache = Memorystore("redis")

        with Cluster("Dispatchers"):
from diagrams import Diagram
from diagrams.onprem.queue import Kafka, ActiveMQ
from diagrams.programming.language import Go, Rust
from diagrams.aws.database import RDS

# definice diagramu se specifikaci jeho zakladnich vlastnosti
with Diagram("OnPrem #8", show=True, direction="TB"):
    # definice uzlu - konzument
    consumer = Kafka("input stream")

    # definice uzlu - databaze
    db1 = RDS("storage")
    db2 = RDS("storage")

    # rozvetveni - vetsi mnozstvi workeru
    workersA = [Go("worker #1"), Go("worker #2"), Go("worker #3")]

    # buffer vlozeny mezi skupiny workeru
    buffer = ActiveMQ("buffer")

    # rozvetveni - vetsi mnozstvi workeru
    workersB = [Rust("worker #1"), Rust("worker #2"), Rust("worker #3")]

    # definice uzlu - producent
    producer = Kafka("output stream")

    # propojeni uzlu grafu orientovanymi hranami
    consumer >> workersA >> buffer >> workersB >> producer
    db1 >> workersA
    workersB >> db2
Exemple #3
0
from diagrams import Cluster, Diagram
from diagrams.k8s.compute import Pod, Deploy
from diagrams.k8s.network import Service
from diagrams.k8s.infra import Master, Node
from diagrams.programming.language import Go
from diagrams.programming.framework import Vue
from diagrams.generic.database import SQL
from diagrams.generic.device import Tablet

print("hello world!\n")
with Diagram("", show=False):
    with Cluster("cluster"):
        Master("master") - Node("worker1") - Node("worker2")

    with Cluster("worker node"):
        with Cluster("deploy"):
            pod = [Pod("hello"), Pod("hello"), Pod("hello")]
        nodeport = Service("NodePort")
        nodeport >> pod
    Tablet("user") >> nodeport

    with Cluster("container in Pod, hello"):
        Vue("front end") - Go("back end") - SQL("db")