Exemplo n.º 1
0
def main():
    with Diagram("Home Network",
                 show=False,
                 filename="output/home_network",
                 outformat="png"):
        internet = Internet("internet")

        with Cluster("192.168.0.1/24"):
            router = Router("Synology RT2600ac")  # SynologyRouter
            switch = Switch("Netgear R7000")
            raspberrypi = Server("Raspberry Pi 4 8GB")  # raspberrypi
            raspberrypi_docker = Docker("Docker")

            devices = Client("Devices")

            internet >> router
            internet << router

            router >> raspberrypi
            router >> switch

            router >> devices
            switch >> devices

            with Cluster("10.0.0.0/28"):
                service_nginx_proxy = Nginx("nginx-proxy")
                service_grafana = Grafana("Grafana")
                service_pi_hole = DNS("Pi-hole")
                service_portainer = LinuxGeneral("Portainer")
                service_telegraf = LinuxGeneral("Telegraf")
                service_prometheus = Prometheus("Prometheus")
                service_loki = Loki("Loki")
                service_promtail = Loki("Promtail")

                raspberrypi >> raspberrypi_docker

                raspberrypi_docker >> service_nginx_proxy

                service_nginx_proxy >> service_grafana
                service_nginx_proxy >> service_pi_hole
                service_nginx_proxy >> service_portainer
                service_nginx_proxy >> service_telegraf
                service_nginx_proxy >> service_prometheus
                service_nginx_proxy >> service_loki
                service_nginx_proxy >> service_promtail

                service_prometheus >> Edge(label="collect metrics",
                                           color="firebrick",
                                           style="dashed") >> service_telegraf

                service_promtail >> Edge(label="push logs",
                                         color="firebrick",
                                         style="dashed") >> service_loki

                service_grafana >> Edge(label="query",
                                        color="firebrick",
                                        style="dashed") >> service_prometheus
                service_grafana >> Edge(label="query",
                                        color="firebrick",
                                        style="dashed") >> service_loki
Exemplo n.º 2
0
from diagrams import Cluster, Diagram
from diagrams.gcp.network import DNS
from diagrams.azure.web import AppServices
from diagrams.azure.database import DatabaseForMysqlServers
from diagrams.azure.compute import FunctionApps
from diagrams.azure.database import CosmosDb

with Diagram("", show=False):
    dns = DNS("dns (GCP)")

    with Cluster("azure_virtual_network internal-it"):
        with Cluster("azurerm_subnet public"):
            snipe_it_web = AppServices("snipe-it")
            stns_api = FunctionApps("stns-api")

        with Cluster("azurerm_subnet db"):
            rdb = DatabaseForMysqlServers("snipe-it-db")
            cosmos_db = CosmosDb("stnd-db")

    dns >> snipe_it_web >> rdb
    dns >> stns_api >> cosmos_db
Exemplo n.º 3
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
Exemplo n.º 4
0
from diagrams import Cluster, Diagram
from diagrams.gcp.network import Router, LoadBalancing, DNS
from diagrams.k8s.compute import Pod
from diagrams.k8s.network import Ingress
from diagrams.generic.blank import Blank

graph_attr = {
    # "splines": "curved"
}

with Diagram("OCP4 Default Ingress",
             show=False,
             direction="LR",
             graph_attr=graph_attr):
    dns = DNS("*.apps.dta.my.lab")
    lbint = LoadBalancing("HAProxy")

    with Cluster("OpenShift Cluster"):
        routerext = Ingress("default")

        with Cluster("Workers"):
            with Cluster("Projects"):
                with Cluster("proj-app-01"):
                    workersint = [Pod("myApp")]

                with Cluster("proj-app-02"):
                    workersext = [Pod("myApp")]

    dns >> lbint
    lbint >> routerext
    routerext >> workersint
Exemplo n.º 5
0
from diagrams import Diagram, Cluster
from diagrams.gcp.database import Firestore
from diagrams.gcp.network import CDN, DNS, LoadBalancing
from diagrams.gcp.storage import GCS
from diagrams.gcp.compute import GKE
from diagrams.onprem.compute import Server
from diagrams.oci.network import Internetgateway

with Diagram("Gran - GCP Design", show=False):
    server = Server("Client (Nuxt.js)")

    with Cluster("Google Cloud Platform"):
        firestore = Firestore("Firebase Firestore")
        cdn = CDN("Cloud CDN")
        dns = DNS("Cloud DNS")
        lb = LoadBalancing("Cloud Load Balancing")
        gcs = GCS("Cloud Storage")
        gke = GKE("Kubernetes Engine")
        net = Internetgateway("Gateway")

        dns >> cdn >> gcs
        dns >> lb >> gke >> firestore

    server >> net
    net >> dns
Exemplo n.º 6
0
        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'):
            kube = EKS('Elastic Kubernetes\nService')
            instance_1 = EC2('EC2 Instance 1\n(m5.xlarge)')
            disk_1 = EBS('EBS Disk 1\n(gp2)')
            instance_2 = EC2('EC2 Instance 2\n(m5.xlarge)')
Exemplo n.º 7
0
from diagrams import Diagram
from diagrams import Cluster
from diagrams.gcp.network import LoadBalancing, DNS
from diagrams.gcp.database import BigTable, Memorystore
from diagrams.gcp.storage import Storage
from diagrams.gcp.compute import ComputeEngine
from diagrams.onprem.monitoring import Prometheus, Grafana

with Diagram("Pastebin architecture", show=False):
    dns = DNS("dns")
    elb = LoadBalancing("loadbalancer")
    with Cluster("REST"):
        gces = [ComputeEngine("gce") for _ in range(3)]
        cache_m = Memorystore("cache")

    with Cluster("NoSQL"):
        db = BigTable("bigtable1")
    store = Storage("filestore")
    with Cluster("monitoring"):
        prom = Prometheus("prometheus")
        graf = Grafana("grafana")

    dns >> elb
    elb >> gces
    elb >> graf
    gces >> cache_m >> db
    gces >> store >> gces
    gces - prom
    graf >> prom
Exemplo n.º 8
0
from diagrams import Diagram, Cluster
from diagrams.aws.compute import EC2
from diagrams.aws.general import User
from diagrams.gcp.network import DNS
from diagrams.onprem.ci import Jenkins
from diagrams.onprem.container import Docker
from diagrams.onprem.database import MySQL, MongoDB
from diagrams.onprem.network import Nginx
from diagrams.onprem.vcs import Github
from diagrams.programming.framework import Django, Backbone

with Diagram("CFO-Architecture", show=False):
    user = User('User')
    dns = DNS("DNS")

    with Cluster('Toast Single Instance'):
        web_server = Nginx('Nginx')

        with Cluster('Docker'):
            was = Docker('Docker Container')
            was - Django('Django')

        with Cluster('Database'):
            database = MySQL('MySQL 8.0')

    with Cluster('CI/CD'):
        with Cluster('NHN'):
            nhn_jenkins = Github('NHN Github')
            nhn_jenkins - Jenkins('NHN Jenkins')
        with Cluster('Accommate'):
            acm_jenkins = Jenkins('Accommate Jenkins')
from diagrams import Cluster, Diagram
from diagrams.gcp.network import Router, LoadBalancing, DNS
from diagrams.k8s.compute import Pod
from diagrams.k8s.network import Ingress
from diagrams.generic.blank import Blank

graph_attr = { 
	"splines": "curved"
}

with Diagram("OCP4 Route Sharding ", show=False, direction="LR", graph_attr=graph_attr):
	dnsint = DNS("*.apps.dta.my.lab")
	dnsext = DNS("*.apps.uat.my.lab")
	lbint = LoadBalancing("HAProxy")

	with Cluster("OpenShift Cluster"):
		routerext = Ingress("router-default") 
		routerint = Ingress("router-external")

		with Cluster("Workers"):
			with Cluster("Projects"):
				with Cluster("proj-ext-app-01"):
					workersint = [Pod("myApp")]
            
				with Cluster("proj-int-app-01"):
					workersext = [Pod("myApp")]


	dnsint >> lbint
	dnsext >> lbint 
	lbint >> routerint >> workersint