示例#1
0
def draw():
    with Diagram("Example Microservice for EBA", show=False, graph_attr=graph_attr, direction="LR"):
        staff = Client('EBA Staff')
        organinzer = User("EBA Organinzer")
        users = Users("EBA Users")
        mobileApp = Flutter("EBA Mobile")
        dns = DNS('Cloud DNS')
        loadbalance = LoadBalancing('Cloud Loadbalancing')
        auth = Authentication("Firebase Auth")
        users >> Edge(color="darkgreen") >> mobileApp << Edge(
            color="darkgreen") >> auth
        [organinzer, staff] << Edge(color="darkgreen") >> dns
        dns << Edge(color="darkgreen") >> loadbalance

        with Cluster("Google Cloud Platform", graph_attr=graph_attr2):
            with Cluster("WEB Frontend", graph_attr=graph_attr2):
                with Cluster("Web Container1", graph_attr=graph_attr2):
                    web1 = Hosting("Firebase Hosting")
                    react1 = React("Frontend")
                    web1 - react1
                with Cluster("Web Container2", graph_attr=graph_attr2):
                    web2 = Hosting("Firebase Hosting")
                    react2 = React("Frontend")
                    web2 - react2
            with Cluster("WEB Backend", graph_attr=graph_attr2):
                with Cluster("Web Backend Container"):
                    web3 = Hosting("Firebase Hosting")
                    react3 = React("Backend")
                    web3 - react3
            loadbalance << Edge(color="darkgreen") >> [web1, web2, web3]
            with Cluster("APIs", graph_attr=graph_attr2):
                func = Functions("Cloud Functions")
                remoteCnf = RemoteConfig("RemoteConfig")
                [react1, react2, react3] << Edge(
                    color="darkgreen") >> remoteCnf << Edge(
                    color="darkgreen") >> func
                with Cluster("Feeds", graph_attr=graph_attr2):
                    apiFeeds = NodeJS("Express")
                with Cluster("Tournaments", graph_attr=graph_attr2):
                    apiTournament = NodeJS("Express")
                with Cluster("Badges", graph_attr=graph_attr2):
                    apiBadges = NodeJS("Express")
                with Cluster("User", graph_attr=graph_attr2):
                    apiUser = NodeJS("Express")
                with Cluster("Games", graph_attr=graph_attr2):
                    apiGames = NodeJS("Express")
                with Cluster("Notifications", graph_attr=graph_attr2):
                    apiNotifications = NodeJS("Express")
                auth << Edge(color="darkgreen") >> func >> Edge(color="darkorange") >> [apiBadges, apiUser, apiFeeds,
                                                                                        apiGames, apiNotifications, apiTournament]
            with Cluster("Database", graph_attr=graph_attr2):
                badgesSQL = SQL("Badges")
                userSQL = SQL("User")
                notificationSQL = SQL("Notifications")
                tournamentsSQL = SQL("Tournaments")
                gamesSQL = SQL("Games")
                feedsSQL = SQL("Feeds")

                apiBadges - Edge(color="darkorange") - badgesSQL
                apiUser - Edge(color="darkorange") - userSQL
                apiFeeds - Edge(color="darkorange") - feedsSQL
                apiGames - Edge(color="darkorange") - gamesSQL
                apiNotifications - Edge(color="darkorange") - notificationSQL
                apiTournament - Edge(color="darkorange") - tournamentsSQL

                firestore = Firestore("Firestore")

            with Cluster("Message Queue", graph_attr=graph_attr2):
                messageQueue = Pubsub("Pubsub")
            [badgesSQL, userSQL, notificationSQL, tournamentsSQL,
                gamesSQL, feedsSQL] >> Edge(color="darkorange") >> messageQueue

            messageQueue >> Edge(color="darkred") >> firestore >> Edge(color="darkred", style="dotted") >> [apiBadges, apiUser, apiFeeds,
                                                                                                            apiGames, apiNotifications, apiTournament]
            with Cluster("Storage", graph_attr=graph_attr2):
                badgesStorage = Storage("Badges")
                userStorage = Storage("User")
                gameStorage = Storage("Games")
                tournamentsStorage = Storage("Tournaments")
            apiBadges - Edge(color="blue") - badgesStorage
            apiUser - Edge(color="blue") - userStorage
            apiGames - Edge(color="blue") - gameStorage
            apiTournament - Edge(color="blue") - tournamentsStorage

            fcm = Messaging("Cloud Messaging")
            apiNotifications >> \
                Edge(color="darkorange") >> \
                fcm >> Edge(color="darkgreen") >> auth
示例#2
0
    user = User("End User")

    with Cluster("Kubernetes"):
        ingress = LoadBalancing("NGINX Ingress")

        with Cluster("Nublado"):
            hub = KubernetesEngine("Hub")
            proxy = KubernetesEngine("Proxy")
            notebook = KubernetesEngine("Notebook")
            proxy >> hub
            hub >> notebook
            proxy >> notebook

        with Cluster("TAP"):
            tap = KubernetesEngine("TAP")
            schema = SQL("MySQL Schema DB")
            uws = SQL("PostgreSQL UWS")

        with Cluster("Gafaelfawr"):
            gafaelfawr = KubernetesEngine("Gafaelfawr")
            redis = Memorystore("Redis")
            cloudsql = SQL("Cloud SQL")

    qserv = Datastore("qserv")

    user >> ingress >> proxy >> hub
    user >> ingress >> proxy >> notebook >> ingress
    ingress >> tap
    ingress >> Edge(label="auth subrequest") >> gafaelfawr
    tap >> Edge(label="token user-info") >> ingress
    ingress >> Edge(label="token user-info") >> gafaelfawr
示例#3
0
from diagrams import Diagram, Cluster
from diagrams.gcp.compute import Run
from diagrams.gcp.devtools import Build, GCR, SourceRepositories as GSR
from diagrams.gcp.database import SQL
from diagrams.onprem.vcs import Github
from diagrams.onprem.client import Client, User

with Diagram("Architecture", show=False):
    with Cluster("Apps"):
        with Cluster("CI/CD"):
            dev = GSR("source mirror")
            cicd = dev >> Build("build") >> GCR("container deploy")

        with Cluster("Services"):
            app = Run("Rails + React App")
            cicd >> app >> SQL("database")

    User("developer") >> Github("code push") >> dev
    Client("client") >> app
示例#4
0
from diagrams import Cluster, Diagram
from diagrams.gcp.compute import GKE, GCF
from diagrams.gcp.network import LoadBalancing
from diagrams.gcp.database import SQL
from diagrams.gcp.analytics import PubSub

with Diagram("GKE Cluster", show=True):
    lb = LoadBalancing("External Load Balancer")

    with Cluster("Default"):
        pubsub = PubSub("PubSub")
        with Cluster("Internal"):
            gke = GKE("GKE")
            lb >> gke >> pubsub
        with Cluster("Backend"):
            mysql = SQL("MYSQL")
            gcf = GCF("Functions")
            pubsub >> gcf >> mysql
from diagrams import Cluster, Diagram
from diagrams.gcp.network import ExternalIpAddresses
from diagrams.gcp.network import NAT
from diagrams.gcp.network import Router
from diagrams.gcp.network import VPC
from diagrams.gcp.compute import GKE
from diagrams.gcp.database import SQL

with Diagram("GCP Infrastructure", show=False):

    with Cluster("PRD Environment"):
        gke_clusters = GKE("GKE PRD")
        cloud_sql = SQL("SQL PRD")

        gke_clusters - cloud_sql

    with Cluster("QA Environment"):
        gke_clusters = GKE("GKE QA")
        cloud_sql = SQL("SQL QA")

        gke_clusters - cloud_sql

    with Cluster("DEV Environment"):
        gke_clusters = GKE("GKE DEV")
        cloud_sql = SQL("SQL DEV")

        gke_clusters - cloud_sql
示例#6
0
        disk_1 = PersistentDisk('OS Disk 1')
        instance_2 = ComputeEngine('Server 2')
        disk_2 = PersistentDisk('OS Disk 2')
        instance_3 = ComputeEngine('Server 3')
        disk_3 = PersistentDisk('OS Disk 3')

        pv_disk = PersistentDisk('SSD Disk 1')
        node_1 - instance_1
        node_2 - instance_2
        node_3 - instance_3
        instance_1 - disk_1
        instance_2 - disk_2
        instance_3 - disk_3
        instance_3 - pv_disk
        pv_workspace - pv_disk
        core - SQL('PostgreSQL')

        core - GCS('Object Storage')
        lb = LoadBalancing('Load Balancer')
        dns = DNS('DNS')
        lb >> ing
        dns >> lb

    [Client('SDKs'), Users('Users')] >> dns

with Diagram('Amazon Web Services resources',
             show=False,
             filename='aws',
             outformat='png'):
    with Cluster('Amazon Web Services'):
        with Cluster('Virtual Private Cloud'):
示例#7
0
with Diagram("GCP Architecture",
             show=False,
             outformat="png",
             graph_attr=graph_attr):

    with Cluster("Local") as local:
        local_machine = BareMetal("Local machine")

    with Cluster("Google Cloud") as gcp:

        tpu = TPU("Cloud TPU")

        with Cluster("Google Cloud Storage") as gcs:
            bucket_data = GCS("polyaxon data")
            bucket_outputs = GCS("polyaxon outputs")
            bucket_logs = GCS("polyaxon logs")

        with Cluster("Private VPC") as vpc:
            cloud_sql = SQL("CloudSQL\n(Postgres)")
            polyaxon_repos = Filestore("Google Filestore\n(polyaxon-repos)")
            redis = Memorystore("Cloud Memorystore\n(optional)")

            with Cluster("GKE") as gke:
                polyaxon = Polyaxon("polyaxon")

    local_machine - Edge(label="SSH tunnel", minlen="3.0") - polyaxon
    polyaxon - [
        cloud_sql, polyaxon_repos, redis, tpu, bucket_data, bucket_logs,
        bucket_outputs
    ]
示例#8
0
with Diagram(
        "A&A",
        show=False,
        filename="architecture",
        outformat="png",
        graph_attr=graph_attr,
):
    user = User("End User")

    with Cluster("Science Platform"):
        filestore = Filestore("POSIX Filesystem")

        with Cluster("Authentication"):
            auth_ingress = LoadBalancing("NGINX Ingress")
            auth_server = KubernetesEngine("Server")
            storage = SQL("Metadata Store")
            redis = KubernetesEngine("Redis")
            redis_storage = PersistentDisk("Redis Storage")

            user >> auth_ingress >> auth_server >> redis >> redis_storage
            auth_server >> storage

        with Cluster("Notebook Aspect"):
            notebook_ingress = LoadBalancing("NGINX Ingress")
            hub = KubernetesEngine("Hub")
            session_storage = SQL("Session Storage")
            notebook = KubernetesEngine("Notebook")

            auth_server << notebook_ingress
            user >> notebook_ingress >> hub >> session_storage
            notebook_ingress >> notebook >> filestore
示例#9
0
from diagrams.onprem.vcs import Github

graph_attr = {"bgcolor": "transparent", "pad": "0"}

with Diagram("Available Data",
             graph_attr=graph_attr,
             show=False,
             filename="images/available_data"):
    github_1 = Github("GitHub repo")

    with Cluster("Operational Data Hub Platform"):
        with Cluster("Operational Data Hub"):
            with Cluster("Pub/Sub Topic"):
                pubsub_1 = PubSub("Subscription")

        with Cluster("Ingest Project"):
            function_1 = Build("Cloud Build")

        with Cluster("Consume Project"):
            function_2 = Functions("Consume catalog")

            with Cluster("CKAN"):
                computeengine_1 = ComputeEngine("CKAN VM")
                sql_1 = SQL("PostgreSQL")

    github_1 >> Edge(
        label="Build Trigger",
        color="black") >> function_1 >> Edge(label="Publish") >> pubsub_1
    pubsub_1 >> Edge(label="Subscribe") >> function_2 >> sql_1
    sql_1 >> Edge(label="SSL") >> computeengine_1
示例#10
0
        show=False,
        filename="architecture",
        outformat="png",
        graph_attr=graph_attr,
        node_attr=node_attr,
):
    user = User("End User")
    frontend = React("Web UI")

    with Cluster("Kubernetes"):
        ingress = LoadBalancing("NGINX Ingress")
        kafka = KubernetesEngine("Kafka")

        with Cluster("Gafaelfawr"):
            server = KubernetesEngine("Server")
            postgresql = SQL("PostgreSQL")
            redis = Datastore("Redis")
            redis_storage = PersistentDisk("Redis Storage")

            user >> frontend >> ingress >> server >> redis >> redis_storage
            server >> postgresql

            kafka_listener = KubernetesEngine("Kafka Listener")

            server >> kafka >> kafka_listener >> postgresql

            housekeeping = KubernetesEngine("Housekeeping")

            postgresql << housekeeping
            redis << housekeeping
示例#11
0
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"):
            dispatcher1 = ReplicaSet("dispatchers")
            dispatcher2 = ReplicaSet("dispatchers")
            dispatcher3 = ReplicaSet("dispatchers")

        pubsub = PubSub("pubsub")

        go >> cloudflare >> api
        api >> Edge() << db
        api >> Edge() << cache
        db >> Edge() << consumer
        cache >> Edge() << producer