Ejemplo n.º 1
0
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 #6", show=True, direction="TB"):
    # definice uzlu - konzument
    consumer = Kafka("input stream")

    # definice uzlu - databaze
    db = 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
    db >> workersA
    producer >> db
Ejemplo n.º 2
0
        with Cluster("API Fetchers"):
            api_fetchers = [
                TypeScript("fetcher"),
                TypeScript("user"),
                TypeScript("post")
            ]

        for i in range(len(pages)):
            for j in range(len(api_fetchers)):
                pages[i] >> api_fetchers[j]

        for i in range(len(pages)):
            pages[i] >> models_index

    with Cluster("Server"):
        main = Rust("main.rs")

        with Cluster("Routes"):
            routes = [Rust("route"), Rust("user"), Rust("post")]
            main >> routes

        with Cluster("Services"):
            services = [Rust("service"), Rust("user"), Rust("post")]
            for i in range(min(len(routes), len(services))):
                routes[i] >> services[i]

        with Cluster("Models"):
            models = [Rust("model"), Rust("user"), Rust("post")]
            for i in range(len(services)):
                for j in range(len(models)):
                    services[i] >> models[j]
Ejemplo n.º 3
0
from diagrams import Diagram, Cluster, Edge
from diagrams.aws.compute import Lambda
from diagrams.aws.network import APIGateway
from diagrams.aws.storage import S3
from diagrams.onprem.client import User
from diagrams.onprem.ci import TravisCI
from diagrams.onprem.vcs import Git
from diagrams.onprem.compute import Server
from diagrams.programming.language import Rust

with Diagram("Lambda Rust Test", show=False):
    developer = User("Developer")
    travis = TravisCI("TravisCI")
    codecov = Server("Codecov")
    rust = Rust("Rust")

    with Cluster("Serverless Offline (Local)"):
        local_api_gateway = APIGateway("API Gateway (Virtual)")
        local_lambda = Lambda("Lambda (Virtual)")
        local_s3 = S3("S3 (Virtual)")
        local_api_gateway >> local_lambda >> local_s3

    with Cluster("Github"):
        master_branch = Git("branch (master)")
        release_branch = Git("branch (release)")

    with Cluster("AWS (release)"):
        release_lambda = Lambda("Lambda")
        release_api_gateway = APIGateway("API Gateway")
        release_s3 = S3("S3")
        release_api_gateway >> release_lambda >> release_s3
Ejemplo n.º 4
0
from diagrams.onprem.compute import Server
from diagrams.onprem.database import PostgreSQL

graph_attr = {"bgcolor": "transparent"}

with Diagram("Basic Architecture", outformat="png", graph_attr=graph_attr):

    with Cluster("Docker Swarm"):
        host = [Server("Cloud Host")]

    with Cluster("Frontend"):
        frontend = Vue("Nuxt + Vuetify")
        host << frontend

    with Cluster("Search Engine"):
        search = Rust("MeiliSearch")
        frontend << search

    with Cluster("API"):
        api = Python("FastAPI")
        search >> api
        api >> search

    with Cluster("Database"):
        db = PostgreSQL("Recipes")
        api >> db
        db >> api

    with Cluster("Web Scraper"):
        scraper = Python("Scrapy")
        scraper >> api
Ejemplo n.º 5
0
            # definice clusteru uvnitr cluster
            with Cluster("Worker group A"):
                # rozvetveni
                workersA = [Go("worker #1"), Go("worker #2"), Go("worker #3")]

            # definice uzlu
            db = RDS("storage")

        # definice uzlu mimo cluster
        buffer = ActiveMQ("buffer")

        # definice clusteru
        with Cluster("Output processor"):
            # definice clusteru uvnitr cluster
            with Cluster("Worker group B"):
                # rozvetveni
                workersB = [
                    Rust("worker #1"),
                    Rust("worker #2"),
                    Rust("worker #3")
                ]

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

    # propojeni uzlu grafu orientovanymi hranami
    consumer >> workersA >> buffer >> workersB >> producer

    # dalsi propojeni orientovanymi hranami
    db >> workersA