def workflow_final(): with Diagram("", outformat='png', filename='images/diagrams/workflow_final', show=False, graph_attr=DIAGRAM_ATTR, node_attr={ 'margin': "5", } # direction="TB", ): Users(f'"{random.randrange(0,1000)} Hackers"', **COMMON_NODE_ATTR) \ >> get_diagram_edge() \ >> [ EC2("server", **COMMON_NODE_ATTR), EC2("server", **COMMON_NODE_ATTR), EC2("server", **COMMON_NODE_ATTR), ] \ >> get_diagram_edge() \ >> Splunk("", **COMMON_NODE_ATTR) \ >> get_diagram_edge() \ >> SimpleStorageServiceS3("Public S3 Bucket", **COMMON_NODE_ATTR) \ >> get_diagram_edge() \ << EC2("server", **COMMON_NODE_ATTR) \ >> get_diagram_edge() \ >> Firewall("IPTables", fillcolor='red', **COMMON_NODE_ATTR)
from diagrams.aws.analytics import Kinesis from diagrams.aws.database import Dynamodb from pathlib import Path with Diagram( "CC3 AWS Connect High Level Architecture", filename="architecture", outformat="png", show=False, direction="BT", ): connect = Connect("Connect") connectLambda = Lambda("awsConnect") web = Vue("CCU3 Web") api = Django("CCU3 Api") users = [Users("Users"), Users("Agents")] with Cluster("CCU3 awsconnect"): gateway = APIGateway("Websocket Gateway") database = Dynamodb("ConnectClientsDB") with Cluster("Websocket Handler"): with Cluster("Connection"): connectionHandlers = [Lambda("$connect" + str(i)) for i in range(3)] gateway - connectionHandlers connectionHandlers >> database with Cluster("Messaging"): wsHandlers = [Lambda("$default" + str(i)) for i in range(3)] gateway - wsHandlers
from diagrams.aws.compute import Lambda from diagrams.aws.network import Route53, APIGateway, CF from diagrams.aws.security import Cognito, IAM, WAF from diagrams.aws.storage import S3 from diagrams.aws.engagement import SES from diagrams.aws.database import DDB from diagrams.aws.management import Cloudwatch graph_attr = {"fontsize": "40"} with Diagram("Static Website on Amazon S3 ", filename="diagram", show=False, graph_attr=graph_attr): users = Users() with Cluster("AWS"): security = Cognito("Cognito") gateway = APIGateway("Gateway") route = Route53("Route53") db = DDB("DynamoDB") email_service = SES("SES") monitoring = Cloudwatch("AWS CloudWatch ") firewall = WAF("AWS WAF") identity = IAM("AWS IAM") with Cluster("CDN"): cdn = S3("S3") >> CF("CloudFront CDN")
from diagrams import Cluster, Diagram, Edge from diagrams.aws.compute import EC2 from diagrams.aws.database import RDS from diagrams.aws.network import ELB, VPC, NATGateway, InternetGateway from diagrams.aws.management import SystemsManager as SSM from diagrams.onprem.client import Users from diagrams.onprem.network import Internet with Diagram("3 Tier Web Module", show=False): users = Users("Users") internet = Internet("Internet") with Cluster("Region Sa-East-1"): ssm = SSM("SSM Management") with Cluster("VPC"): with Cluster("subnet/public"): igw = InternetGateway("InternetGateway") lb = ELB("lb") with Cluster("subnet/private"): with Cluster("App"): auto_scaling_group = [EC2("app1"), EC2("app2")] with Cluster("Database"): database = RDS("app_db") natgw = NATGateway("NATGW") users >> internet >> lb >> auto_scaling_group natgw - auto_scaling_group auto_scaling_group - Edge(style="dotted") - database ssm >> Cluster("subnet/private")
"fontsize": "20", "bgcolor": "white" #transparent } with Diagram("Application Architecture", graph_attr=graph_attr, outformat="png", filename="application_architecture"): ELB("lb") >> EC2("web") >> RDS("userdb") >> S3("store") ELB("lb") >> EC2("web") >> RDS("userdb") << EC2("stat") (ELB("lb") >> EC2("web")) - EC2("web") >> RDS("userdb") with Cluster("Application Context"): app = EC2("Spring Boot") ELB("lb") >> app metrics = Prometheus("metric") metrics << Edge(color="firebrick", style="dashed") << Grafana("monitoring") Jenkins("CI") client = Client("A") client >> User("B") >> Users("S") client >> PostgreSQL("Database") client >> Internet("Remote API") client >> Docker("Docker") client >> Server("Server") client >> SQS("Sync Books") client >> Spring("Backend") client >> React("React")
from diagrams.onprem.network import Nginx from diagrams.oci.connectivity import Backbone # aws from diagrams.aws.database import RDS from diagrams.aws.storage import S3 from diagrams.aws.compute import AutoScaling, EC2 from diagrams.aws.analytics import Glue from diagrams.aws.network import CF, ELB, Route53, SiteToSiteVpn as s2s_vpn from diagrams.aws.compute import Batch from diagrams.aws.management import Cloudwatch as cw with Diagram("On-prem web application", show=False): dns = onprDns('Round-robin DNS ') users = Users('website/mobile users') nfs = nfs('Shared filesystem') with Cluster("Application Servers"): app_servers = [ onprServer("app_srv1"), onprServer("app_srv2"), onprServer("app_srv3") ] Backbone = Backbone("Network") with Cluster("WebProxy Servers"): web_servers = [Nginx("web_srv1"), Nginx("web_srv2"), Nginx("web_srv3")] with Cluster("Mysql active-active cluster"): db_master = onprMysql("userdb")
# diagram.py from diagrams import Diagram from diagrams.onprem.iac import Terraform from diagrams.onprem.client import User, Users with Diagram("Terraform Cloud Organization", show=False, direction="RL"): Terraform("tfe organization") << [User("admin"), Users("membership")]
# kubeflow architecture diagram from diagrams import Cluster, Diagram, Edge from diagrams.onprem.client import Users from diagrams.k8s.network import Ingress, Service with Diagram("Kubeflow Networking Architecture", show=False): user = Users("Users") with Cluster("API gateway"): ingress_gateway = Ingress("Ingress") user >> Edge(color="darkgreen") >> ingress_gateway ingress_gateway >> [ Service("Central Dashboard Virtual Service"), Service("Notebooks App Virtual Service") ]
from diagrams.onprem.database import Postgresql from diagrams.gcp.network import LoadBalancing from diagrams.onprem.monitoring import Prometheus, Grafana from diagrams.onprem.client import Users, Client from diagrams.k8s.compute import Pod from diagrams.k8s.infra import Master from diagrams.k8s.controlplane import API from diagrams.k8s.network import Ingress, Service from diagrams.onprem.network import Traefik from diagrams.programming.language import Python with Diagram("Simplified Orchestra Architecture Diagram", show=False): dns = Route53("Wildcard DNS\n*.bioc.cancerdatasci.org") lb = LoadBalancing("Load Balancer") pg = Postgresql("AWS Aurora PostgreSQL") users = Users("Workshop\nParticipants") web = Client("Standard Web Browser") with Cluster("Kubernetes Cluster"): app = Python("Orchestra") master = Master("Kubernetes Master\nRunning on GKE") k8api = API("Kubernetes Control API") s = [] w = [] ing = Traefik("Router & Proxy") ing >> app app >> pg app >> k8api k8api >> master pg >> app prom = Prometheus("Prometheus\nMonitoring") graf = Grafana("Grafana\nVisualization")
from diagrams import Diagram, Cluster, Edge from diagrams.aws.compute import ECS from diagrams.aws.database import RDS from diagrams.aws.network import Route53, ELB, InternetGateway from diagrams.onprem.network import Internet from diagrams.onprem.client import Users from diagrams.aws.network import CloudFront from diagrams.aws.storage import S3 from diagrams.aws.security import ACM with Diagram("LogOrg", show=False): with Cluster("Internet"): internet = Internet("internet") users = Users("User") with Cluster("AWS"): dns = Route53("DNS") acm = ACM("Certificate Manager") with Cluster("CDN/cdn.logorg.work"): cdn_front = CloudFront("CDN Front") cdn_storage = S3("Logorg Bucket") with Cluster("APP/VPC 10.0.0.0/www.logorg.work"): elb = ELB("LB") igw = InternetGateway("Internet Gateway") with Cluster("subnet-private"):
from diagrams import Cluster, Diagram, Edge from diagrams.onprem.client import Users from diagrams.gcp.analytics import BigQuery, Dataflow, PubSub, DataCatalog from diagrams.gcp.compute import AppEngine, Functions, GPU, ComputeEngine, GKE from diagrams.gcp.database import BigTable, Spanner, Firestore, SQL, Datastore from diagrams.gcp.storage import GCS with Diagram("Референсная архитектура робота сервисного центра"): users = Users("Пользователи") analytics = Users("Аналитики заказчика") modellers = Users("Модельеры исполнителя") with Cluster("Корпоративные сиcтемы"): itsm = GCS("ITSM") exchange = GCS("Exchange") teams = GCS("Teams") msad = GCS("AD") confluence = GCS("Confluence") with Cluster("Кластер с компонентами робота"): with Cluster("Основной бизнес-процесс"): with Cluster("Обработка входящего трафика"): emailmod = GKE("Обработка писем") msgmod = GKE("Обработка сообщений") with Cluster("Общие компоненты"): ocr = GKE("OCR") s2t = GKE("Speech to Text") t2s = GKE("Text to Speech") cls = GKE("Text Classifiers") ceph = GCS("Object Storage") with Cluster("База знаний"):
from diagrams import Diagram from diagrams.onprem.client import Users from diagrams.onprem.container import Docker from diagrams.programming.framework import Spring graph_attr = { "fontsize": "20", "bgcolor": "white" # transparent } with Diagram("", direction="LR", graph_attr=graph_attr, outformat="png", filename="testing_architecture"): users = Users("Integration Tests") backend = Spring("Application") database = Docker("PostgreSQL database") backend >> database users >> backend
from diagrams.onprem.compute import Server os.chdir(os.path.dirname(__file__)) graph_attr = { "label": "", } with Diagram( "IDM", show=False, filename="architecture", outformat="png", graph_attr=graph_attr, ): users = Users("End Users") with Cluster("NCSA"): cilogon = Server("CILogon") comanage = Server("COmanage") ldap = Server("LDAP") users >> cilogon >> comanage >> ldap users >> comanage with Cluster("Science Platform"): ingress = LoadBalancing("NGINX Ingress") notebook = KubernetesEngine("Notebook") vo = KubernetesEngine("VO Services") redis = KubernetesEngine("Redis")
from diagrams import Cluster, Diagram from diagrams.onprem.database import Mssql from diagrams.onprem.network import Apache from diagrams.onprem.logging import Logstash from diagrams.onprem.client import Users from diagrams.aws.compute import ECS, EKS, Lambda from diagrams.aws.database import Redshift from diagrams.aws.integration import SQS from diagrams.aws.storage import S3 with Diagram("", show=False): source = Mssql("SQL Server") website = Apache("Web Server") logstash = Logstash("Network share for Logs") users = Users("Excel Users") source >> website >> logstash source >> users
with Cluster("ASP"): aws_asp_app = Server("application") aws_asp_db = Dynamodb("database") aws_asp_web_server = Nginx("web server") with Cluster("Azure"): azure_balancer = Server("balancer") azure_jenkins = Jenkins("deploy worker") with Cluster("ASP"): azure_asp_app = Server("application") azure_asp_db = CosmosDb("database") azure_asp_web_server = Nginx("web server") consumers = Users("consumers") # on-premises git >> on_premises_deploy_worker developer >> on_premises_deploy_worker on_premises_asp_app >> on_premises_asp_db on_premises_asp_web_server << on_premises_balancer on_premises_asp_web_server >> on_premises_asp_app on_premises_balancer << consumers on_premises_deploy_worker >> on_premises_asp_app # AWS git >> aws_jenkins developer >> aws_jenkins aws_asp_app >> aws_asp_db aws_asp_web_server << aws_balancer
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
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)') disk_2 = EBS('EBS Disk 2\n(gp2)') instance_1 - disk_1 instance_2 - disk_2
with Diagram("./custom_resources/Workflow", direction="TB"): with Cluster("Local"): # local_development = Custom("macOS", "https://download.logo.wine/logo/MacOS/MacOS-Logo.wine.png") local_development = Custom("", "MacOS-Logo.png") with Cluster("GitHub"): github_actions = GithubActions("GitHub Actions") github = Github("GitHub") local_development >> github >> github_actions with Cluster("Digital Ocean", direction="LR"): server = Ubuntu("Ubuntu 18.04") github_actions >> server with Diagram("./custom_resources/Internal Working"): with Cluster("Internet"): users = Users("Site Visitors") with Cluster("Digital Ocean", direction="LR"): server = Ubuntu("Ubuntu 18.04") nginx = Nginx("Nginx") static_assets = Custom("Static", "static.png") with Cluster("Gunicorn Workers", direction="LR"): worker1 = Gunicorn("worker1") worker2 = Gunicorn("worker2") worker3 = Gunicorn("worker3") workers = [worker3, worker2, worker1] with Cluster("Django Stack", direction="LR"): django_app = Django("Django") sqlite = Custom("SQLite", "SQLite.svg") django_app - sqlite
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