Ejemplo n.º 1
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
Ejemplo n.º 2
0
        random_demo = Server("Random demo")
        tic_tac_toe = Server("Tic tac toe")
        users_fastapi = Server("Users Fastapi")
        webservers = [
            fulltext_search,
            book_collection,
            geolocation_search,
            random_demo,
            users,
            users_fastapi,
        ]

    proxy = HAProxy("Krakend")
    mqtt_service = Server("MQTT service")
    mongo = MongoDB("MongoDb")
    mosquitto = IotMqtt("Mosquitto")
    grafana = Grafana("Grafana")
    influxdb = InfluxDB("InfluxDB")
    redis = Redis("Redis")

    webservers >> Edge(color="brown") >> mongo
    users >> Edge(color="brows") >> redis
    book_collection >> Edge(color="black") >> users
    mqtt_service >> Edge(color="brown") >> mosquitto
    mqtt_service >> Edge(color="brown") >> mongo
    mqtt_service >> Edge(color="brown") >> influxdb
    grafana >> Edge(color="brown") >> influxdb

    proxy >> Edge(color="black") >> random_demo
    proxy >> Edge(color="black") >> users
from diagrams import Diagram, Cluster, Edge
from diagrams.aws.network import ELB, Route53
from diagrams.aws.security import CertificateManager
from diagrams.aws.storage import S3
from diagrams.generic.blank import Blank

with Diagram("AWS Load Balancer", show=False, direction="TB"):

    logging = S3("logging bucket")

    endpoint = Route53("endpoint")

    tls = CertificateManager("tls certificate")

    with Cluster("vpc"):

        lb = ELB("load balancer")
        lb << Edge(label="tls certificate")

        listener = ELB("listener (*)")
        listener << tls

        lb - listener - ELB("target group (*)")

        endpoint >> lb >> Edge(label="access logs") >> logging

    Blank("* 0..n")
Ejemplo n.º 4
0
def get_diagram_edge():
    return Edge(color="white", penwidth="5")
Ejemplo n.º 5
0
from diagrams import Cluster, Diagram, Edge
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.logging import Fluentd
from diagrams.onprem.monitoring import Grafana, Prometheus
from diagrams.onprem.network import Nginx
from diagrams.onprem.queue import Kafka

with Diagram(name="Advanced Web Service with On-Premise (colored)", show=False):
    ingress = Nginx("ingress")

    metrics = Prometheus("metric")
    metrics << Edge(color="firebrick", style="dashed") << Grafana("monitoring")

    with Cluster("Service Cluster"):
        grpcsvc = [
            Server("grpc1"),
            Server("grpc2"),
            Server("grpc3")]

    with Cluster("Sessions HA"):
        master = Redis("session")
        master - Edge(color="brown", style="dashed") - Redis("replica") << Edge(label="collect") << metrics
        grpcsvc >> Edge(color="brown") >> master

    with Cluster("Database HA"):
        master = PostgreSQL("users")
        master - Edge(color="brown", style="dotted") - PostgreSQL("slave") << Edge(label="collect") << metrics
        grpcsvc >> Edge(color="black") >> master
from diagrams.k8s.compute import Pod
from diagrams.k8s.network import Service
from diagrams.k8s.podconfig import Secret, ConfigMap
from diagrams.oci.compute import Container
from diagrams.onprem.container import Docker
from diagrams.onprem.network import Gunicorn
from diagrams.programming.framework import Flask

with Diagram("Lorem Ipsum Cloud Native Books Service",
             show=True,
             filename='lorem_ipsum_cloud_native_books_service'):
    with Cluster("Kube"):
        svc = Service('svc')
        pod = Pod('pod')
        secrets = Secret('secrets')
        cm = ConfigMap('cm')

        with Cluster('Runtime'):
            stats = Custom('stats', './resources/statsd.png')
            app = Container('app')
            statsd = Container('statsd')
            docker = Docker('')
            web = Flask('web')
            wsgi = Gunicorn('wsgi')
            app >> Edge(label='runs_on') >> docker
            app >> Edge(label='runs') >> [wsgi]
            app >> Edge(label='uses') >> [web]
            wsgi >> stats
        svc >> pod >> [app, statsd]
        pod << [secrets, cm]
Ejemplo n.º 7
0
        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

        producer >> Edge(label="credentials") >> pubsub
        pubsub >> Edge(label="results") >> consumer

        pubsub >> Edge(label="results") << dispatcher1
        pubsub >> Edge(label="credentials") << dispatcher2
        pubsub >> Edge(label="results") << dispatcher3

    with Cluster("Executors"):

        with Cluster("Google Cloud Run"):
            worker_gcp = Run("worker")
Ejemplo n.º 8
0
             graph_attr=graph_attr,
             show=False,
             filename="images/data_science"):
    webshop_1 = Client("Webshop")

    with Cluster("Operational Data Hub Platform"):
        with Cluster("Ingest Project"):
            function_1 = Functions("Ingest")

        with Cluster("Operational Data Hub"):
            with Cluster("Pub/Sub Topic X"):
                pubsub_1_1 = PubSub("Subscription XA")

            with Cluster("Pub/Sub Topic Z"):
                pubsub_2_1 = PubSub("Subscription ZA")

        with Cluster("Consume Project"):
            dataflow_1 = Dataflow("Dataflow")

            with Cluster("Analyze"):
                bigquery_1 = Bigquery("BigQuery")
                aiplatform_1 = AIPlatform("AI Platform")
                firestore_2 = Firestore("Database")
                dataflow_2 = Dataflow("Backfill/reprocess")

    pubsub_1_1 >> dataflow_1
    dataflow_1 >> [bigquery_1, aiplatform_1, firestore_2] >> dataflow_2
    bigquery_1 >> Edge(label="Results", color="orange") >> function_1 >> Edge(
        color="orange") >> pubsub_2_1
    pubsub_2_1 >> Edge(label="Results", color="orange") >> webshop_1
Ejemplo n.º 9
0
        simpleEmailServiceSes = SimpleEmailServiceSes("Simple Email Service")

        with Cluster("Jira"):
            jELB = ElasticLoadBalancing("Load Balancer")
            jEC2 = EC2("EC2 Instance")
            jEBS = EBS("EBS Volume")
            jRDS = RDS("Relational Database Service for Postgres")

        with Cluster("Confluence"):
            cELB = ElasticLoadBalancing("Load Balancer")
            cECS = ECS("EC2 Instance")
            cEBS = EBS("EBS Volume")
            cRDS = RDS("Relational Database Service for Postgres")

    #format within Internet
    tepUser - Edge(color="transparent") - tepDevice
    #format within Dept
    dsUser - Edge(color="transparent") - dsDevice
    tradicionalServer - Edge(color="transparent") - genericSamlToken
    dsDevice >> Edge(color="#4472C4") >> tradicionalServer
    dsDevice >> Edge(color="#70AD47") >> genericSamlToken
    #format within Jira
    jELB >> Edge(color="#4472C4") >> jEC2 >> Edge(
        color="#4472C4",
        style="dashed",
        label="Issues and configuration \n stored in database") >> jRDS
    jEC2 >> Edge(
        color="#4472C4",
        style="dashed",
        label="Jira writes attachment data \n to a dedicated data store"
    ) >> jEBS
Ejemplo n.º 10
0
 def test_node_to_node(self):
     with Diagram(name=os.path.join(self.name, "node_to_node"), show=False):
         node1 = Node("node1")
         node2 = Node("node2")
         self.assertEqual(node1 - Edge(color="red") - node2, node2)
Ejemplo n.º 11
0
        backend_lb = Nginx("Backend-LB")

        with Cluster("Backend Cluster"):
            backend = [
                Server("be-server-01"),
                Server("be-server-02"),
                Server("be-server-03")
            ]

        Mysql_db = Mysql("MySQL-DB")

        with Cluster("Redis Cluster"):
            master = Redis("Master")
            master - Redis("Replica")

        with Cluster("Metrics"):
            metrics = Prometheus("Metric")
            metrics << Grafana("Monitoring")

        frontend_lb = Nginx("Frontend-LB")
    internet = Internet("Internet")
    webuser = Users("User")

    webuser >> Edge(color="black", label="TCP/443") >> internet >> Edge(color="black", label="TCP/443") >> \
    frontend_lb >> Edge(color="darkgreen", label="TCP/80") >> frontend >> Edge(color="darkgreen", label="TCP/80") >> \
    backend_lb >> Edge(color="darkgreen", label="TCP/80") >> backend >> Edge(color="red", label="TCP/3306",style="dashed") >> Mysql_db \
    >>  backend >>  Edge(color="orange", style="dotted") >>metrics
    backend >> Edge(color="blue", style="dotted") >> master
    frontend >> Edge(color="orange", style="dotted") >> metrics
Ejemplo n.º 12
0
node_attr = {
    "margin": "1000",
    "fontsize": "15",

}


with Diagram("VPC Public and Private Subnet", show=False, filename="VPC_public_Private", graph_attr=graph_attr, node_attr=node_attr):

    with Cluster("AWS"):
        with Cluster("VPC"):
            vpc = VPC('custom-vpc')
            out_inter = InternetAlt1('Internet')
            with Cluster("Public"):
                sub_public = PublicSubnet('Public Subnet')
                web = EC2("Bastion-Host")
                nat = NATGateway("NAT_Gateway")
                igw = InternetGateway('pubic-IGW')
                sub_public >> web
                out_inter >> igw >> sub_public >> nat
            with Cluster("Private"):
                sub_private = PrivateSubnet('Private Subnet')
                priv_ec2 = [EC2("app1"), EC2("app2")]

                out_inter >> igw >> sub_public >> nat >> priv_ec2
                sub_private >> priv_ec2
        web >> Edge(label='SSH') >> priv_ec2
        vpc >> sub_public
        vpc >> sub_private
    User('TOM') >> web
Ejemplo n.º 13
0
        git = Git("")
    git >> now

    ## -------------------------------------------------------
    ## FUTURE
    ## -------------------------------------------------------
    # Castle: Docker
    with Cluster("Docker"):
        docker = Docker("")
    now >> docker

    # Castle: Build Tools
    with Cluster("Build Tools Familiarity"):
        buildtools = ELB("")
        jenkins = Jenkins("Jenkins")
        buildtools << Edge(color="brown", style="dashed") << [
            jenkins,
            Gitlab("Gitlab runners"),
            Github("Github actions"),
            Circleci("Circle CI"),
            devops.Pipelines("Azure pipelines"),
        ]
    now >> buildtools

    # Castle: JCasC
    with Cluster("Jenkins (w/ JCasc)"):
        jenkinsjcasc = Jenkins("Jenkins (w/ JCasc)")
        trainingmaterial = EC2("Training material")
        jenkinsjcasc << Edge(color="brown", style="dashed") << [
            trainingmaterial,
        ]
Ejemplo n.º 14
0
graph_attr = {
    "pad" : "0"
}

with Diagram("Network Map", show=False):

    with Cluster("Internet"):
        internet=Internet("Internet")


    with Cluster("Local"):

        with Cluster("Hardware"):
            netgear = Router("Netgear")
            net_bridge = Edge(style="dashed",label="bridge")
            udmpro = Router("UDM-PRO")
            usw = Switch("USW-24-POE")
            ap = Custom("3 x Unifi AC Lite","unifi_ac.png")
            nanobeam = Custom("2 x Nanobeam Gen2 5AC","nanobeam.png")

        with Cluster("Trusted\n10.8.10.1/24"):
            android=Android("Smartphones")
            windows=Windows("Win Laptops")
            linux=LinuxGeneral("Linux laptops")

            # android - usw

        with Cluster("Lab\n10.8.20.1/24"):

            technocore=Custom("Technocore - Sidero", "k8s.png")
Ejemplo n.º 15
0
from urllib.request import urlretrieve

#Pterodactyl
pterodactyl_url = "https://avatars.githubusercontent.com/u/16179146"
pterodactyl_icon = "pterodactyl.png"
urlretrieve(pterodactyl_url, pterodactyl_icon)

with Diagram(filename="game_servers_ungrouped", show=True, direction="TB"):
    with Cluster("Dedicated Ubuntu Server"):

        pterodactyl = Custom("Pterodactyl", pterodactyl_icon)

        with Cluster("Game Servers"):
            proxy1 = Docker("Proxy 1")
            proxy2 = Docker("Proxy 2")
            survival = Docker("Survival")
            resource = Docker("Resource")
            creative = Docker("Creative")
            modded = Docker("Modded")
            minigames = Docker("Minigames")
            gamenight = Docker("Gamenight")
            snapshot = Docker("Snapshot")
            misc = Docker("Misc. Servers")

            servers = [
                misc, snapshot, gamenight, minigames, modded, creative,
                resource, survival, proxy2, proxy1
            ]

            pterodactyl >> Edge(color="#004da4") >> servers
Ejemplo n.º 16
0
from diagrams.onprem.network import Internet

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

with Diagram("template-12", show=False, direction="TB", filename="diagram-12", graph_attr=graph_attr):
    with Cluster("Vpc 10.0.0.0/16"):
        webSg = Firewall("SG in 8080/tcp")

        with Cluster("AZ1 (eu-central-1a)"):
            with Cluster("PublicSubnet 10.0.0.0/24"):
                publicSubnetRouter = VPCRouter("Router\n10.0.0.1")
                ec2 = EC2("ec2\n10.0.0.x")
                ec2 - Edge(style="dashed") - publicSubnetRouter
                ec2 - webSg - publicSubnetRouter
            with Cluster("PrivateSubnetA 10.0.8.0/24"):
                privateSubnetARouter = VPCRouter("Router\n10.0.8.1")
                dbPrimary = RDS("Database (Primary)")
                dbPrimary - Edge(style="dashed") - privateSubnetARouter

        dbClientSg = Firewall("SG out 3306/tcp")
        dbServerSg = Firewall("SG in 3306/tcp")

        with Cluster("AZ2 (eu-central-1b)"):
            with Cluster("PrivateSubnetB 10.0.9.0/24"):
                privateSubnetBRouter = VPCRouter("Router\n10.0.9.1")
                dbSecondary = RDS("Database (Secondary)")
                dbSecondary - Edge(style="dashed") - privateSubnetBRouter
Ejemplo n.º 17
0
from diagrams.aws.network import InternetGateway, RouteTable, VPCRouter
from diagrams.aws.security import KMS, IAMRole
from diagrams.generic.network import Firewall
from diagrams.onprem.network import Internet

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

with Diagram("template-09", show=False, direction="LR", filename="diagram-09", graph_attr=graph_attr):
    internet = Internet("Public Internet")
    with Cluster("Vpc 10.0.0.0/16"):
        internet_gateway = InternetGateway("Igw")
        internet - internet_gateway
        routeTable = RouteTable("RouteTable")
        routeTable >> Edge(label="0.0.0.0/0", style="dashed") >> internet_gateway
        with Cluster("Subnet 10.0.0.0/24"):
            router = VPCRouter("Router\n10.0.0.1")
            router - Edge(style="dashed") - routeTable
            router - internet_gateway
            ec2 = EC2("ec2\n10.0.0.x")
            ec2 - Edge(style="dashed") - router
            sg = Firewall("SG: 22/tcp")
            ec2 - sg - router
    KMS("KeyPair") - ec2
    ec2Role = IAMRole("Ec2InstanceRole") - ec2

    cw = Cloudwatch("CloudWatch")
    cw - internet
Ejemplo n.º 18
0
    # windows = Windows("OS")
    router1 = Router("localhost:3000")
    router2 = Router("localhost:5000")

    with Cluster("Model", ):
        mongo = MongoDB("MongoDB")

    with Cluster("Controller"):
        flask = Flask()
        python = Python()
        python - flask

    with Cluster("View"):
        react = React("React")
        js = Javascript()
        js - react

    mongo >> Edge() >> flask
    flask >> Edge() >> mongo

    react >> Edge(label="AJAX", color="darkgreen") >> flask
    flask >> Edge(label="REST API", color="darkgreen") >> react

    router2 - mongo
    router2 - flask
    router1 - react

    # windows - mongo
    # windows - flask
    # windows - react