from diagrams.oci.network import Firewall from diagrams.oci.devops import APIService from diagrams.oci.network import Drg from diagrams.oci.compute import Container from diagrams import Cluster, Diagram with Diagram("API Gateway Reference Architecture", show=False): dns = DNS("DNS") waf = WAF("WAF") dc = CustomerDatacenter("Customer DC") fc = FastConnect("Fast Connect") vpn = VPN("VPN") with Cluster("Tenancy"): ten_grp = [ Alarm("Alarm"), Events("Event"), Logging("Logging"), Telemetry("Monitoring") ] with Cluster("Compartment"): id = IDAccess("IAM") with Cluster("VCN"): ig = InternetGateway("Internet Gateway") lb = LoadBalancer("Load Balancer") api = APIService("API Gateway") fw = Firewall("Firewall") drg = Drg("DRG")
from diagrams import Cluster, Diagram, Edge from diagrams.generic.device import Tablet, Mobile from diagrams.generic.blank import Blank from diagrams.onprem.client import Client, User from diagrams.onprem.compute import Server # aws resources from diagrams.aws.compute import ECS from diagrams.aws.storage import S3 from diagrams.aws.general import TradicionalServer, GenericSamlToken from diagrams.aws.engagement import SimpleEmailServiceSes from diagrams.aws.network import ElasticLoadBalancing from diagrams.aws.database import RDS, Elasticache with Diagram("Graph-testing123", show=True, outformat="png", direction="TB"): with Cluster("apigatewaybase"): with Cluster("application-apigatewaybase"): appXapigatewaybase = Server( "mockedup-integration-application-apigatewaybase") with Cluster("filetransferbase"): with Cluster("application-filetransferbase"): appXfiletransferbase = Server( "mockedup-integration-application-filetransferbase") with Cluster("s3base"): with Cluster("application-s3base"): appXs3base = Server("mockedup-integration-application-s3base") with Cluster("postgresdbbase"): with Cluster("database-postgresdbbase"): dbXpostgresdbbase = Server( "mockedup-integration-database-postgresdbbase") with Cluster("postgresdbgenerated"): with Cluster("database-postgresdbgenerated"):
from diagrams.aws.general import User graph_attr = { "fontsize": "20", } 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
from diagrams.onprem.ci import Jenkins, Circleci from diagrams.onprem.container import Docker from diagrams.onprem.vcs import Git, Github, Gitlab from diagrams.azure import devops from diagrams.generic.storage import Storage from diagrams.alibabacloud.application import RdCloud with Diagram("Upskilling Malmö", show=True, direction="TB"): # Timeline now = Storage("Now") ## ------------------------------------------------------- ## PAST ## ------------------------------------------------------- # Castle: Git with Cluster("Git"): 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")
from diagrams import Cluster, Diagram 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 from diagrams.programming.language import Bash with Diagram("Falco For Security", show=False): source = EKS("Syscall Events") with Cluster("Falco"): with Cluster("Falco Processing"): workers = [ECS("Falco Daemon")] queue = SQS("Falco Sidekick") with Cluster("Sidekick outputs"): handlers = [Lambda("slack"), Lambda("logdna"), Lambda("loki")] store = S3("store") dw = Redshift("analytics") rules = Bash("Rules Definitions") source >> workers >> queue >> handlers rules >> workers handlers >> store handlers >> dw
from diagrams.onprem.inmemory import Memcached 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("Bloosa architecture", show=False): nginx = Nginx("nginx") metrics = Prometheus("metric") metrics << Grafana("monitoring") with Cluster("Apps Cluster"): grpcsvc = [Server("puma 1"), Server("puma 2"), Server("puma 3")] cache = Memcached('Cache') grpcsvc >> cache with Cluster("Sessions HA"): master = Redis("session") master - Redis("replica") << metrics grpcsvc >> master with Cluster("Database HA"): master = PostgreSQL("users") master - PostgreSQL("slave") << metrics grpcsvc >> master
graph_attr = { "fontsize": "30", "ranksep": "3", "nodesep": "3", "splines": "true", "dirtype": "foward", } with Diagram("Architecture", show=True, graph_attr=graph_attr): # 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
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 import Cluster, Diagram, Edge from diagrams.custom import Custom 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]
_icon = "MuPDF.png" class Peewee(Custom): _icon = "peewee.png" from diagrams import Cluster, Diagram from diagrams.aws.compute import ECS from diagrams.aws.integration import SQS from diagrams.elastic.elasticsearch import Elasticsearch from diagrams.onprem.database import PostgreSQL from diagrams.onprem.network import Nginx with Diagram("Web Service", show=True): with Cluster("Processing"): workers = [ECS("worker1"), ECS("worker2")] with Cluster("Extraction"): with Cluster("PDF"): pdf = Camelot("Table") - MuPDF("Text") with Cluster("database"): orm = Peewee("ORM") postgres = PostgreSQL("storage") queue = SQS("event queue") server = Flask() Nginx("Nginx") >> server >> queue >> workers >> pdf pdf >> orm >> postgres
from diagrams import Diagram, Cluster from diagrams.custom import Custom from diagrams.k8s.clusterconfig import HPA from diagrams.k8s.compute import Deployment, Pod, StatefulSet from diagrams.k8s.network import Ingress, Service globe_img = "resources/globe.png" graph_attr = {"pad": "0.5"} with Diagram(filename="jitsi_meet", direction='TB', show=False, outformat='png', graph_attr=graph_attr): with Cluster("Conference 1"): users_1 = [Custom("user", globe_img) for _ in range(3)] with Cluster("Conference 2"): users_2 = [Custom("user", globe_img) for _ in range(2)] all_users = Custom("all users", globe_img) with Cluster("Namespace 'jitsi'"): n_shards = 2 n_haproxy = 2 haproxy_sts = StatefulSet("haproxy") haproxy_pods = [Pod(f"haproxy-{j}") for j in range(n_haproxy)] haproxy_sts >> haproxy_pods web_service = Service("web") ingress = Ingress("jitsi.beyondcloud.com.br") ingress >> Service("haproxy") >> haproxy_pods >> web_service
# http://www.eclipse.org/legal/epl-v10.html # # Contributors: # Pavel Tisnovsky # from diagrams import Diagram from diagrams import Cluster 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("Clusters #4", show=True, direction="LR"): # definice clusteru with Cluster("Input processor"): # definice uzlu v clusteru consumer = Kafka("input stream") # 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
from diagrams import Diagram from diagrams import Cluster, Diagram from diagrams.aws.network import ELB from diagrams.programming.framework import React from diagrams.onprem.database import Mongodb from diagrams.programming.language import Nodejs with Diagram("Microservices", show=False): with Cluster("Service"): external_api = ELB("ExternalApi") with Cluster("Database\nMongoDB"): mongo = Mongodb("Contenedor-a") with Cluster("Service\nMongoExpress"): mongo_express = Nodejs("Contenedor-b") mongo_express >> mongo mongo >> mongo_express with Cluster("Service\nNodeJS\nScrapper"): scrapper = Nodejs("Contenedor-c") scrapper >> external_api external_api >> scrapper scrapper >> mongo with Cluster("Service\nNodeJS\nExpress\nAPI"): express_api = Nodejs("Contenedor-d") with Cluster("Service\nReactJS\nApacheServer"): react = React("Contenedor-f") react >> express_api express_api >> mongo mongo >> express_api express_api >> react
from diagrams.aws.management import Cloudwatch graph_attr = { # "fontsize": "45", # "bgcolor": "transparent" } with Diagram( "'Kitchen Sink' Sample on AWS", show=False, filename="diagram", graph_attr=graph_attr, direction="TB", ): with Cluster("Admin"): tf = Terraform("IAC") # docker = Docker("Docker") admin = User("Admin User") with Cluster("End Users"): users = Users("End Users") with Cluster("AWS"): with Cluster("VPC"): routetable = network.RouteTable("Route Tables") firewall = network.VPC("VPC Firewall Rules") with Cluster("Public Subnets") as public1:
from diagrams import Diagram, Cluster from diagrams.aws.compute import EC2 from diagrams.aws.network import ELB from diagrams.aws.network import Route53 from diagrams.aws.database import RDS from diagrams.onprem.inmemory import Redis with Diagram("Simple Website Diagram", direction='LR') as diag: # It's LR by default, but you have a few options with the orientation dns = Route53("dns") load_balancer = ELB("Load Balancer") database = RDS("User Database") cache = Redis("Cache") with Cluster("Webserver Cluster"): svc_group = [EC2("Webserver 1"), EC2("Webserver 2"), EC2("Webserver 3")] dns >> load_balancer >> svc_group svc_group >> cache svc_group >> database diag
from diagrams import Cluster, Diagram, Edge from diagrams.generic.network import Router, Switch from diagrams.onprem.network import Internet from diagrams.generic.os import Android, LinuxGeneral, Windows from diagrams.aws.iot import IotAlexaEcho, IotLightbulb, IotSensor from diagrams.custom import Custom 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")
def main(): graph_attr = { "fontsize": "45", 'overlap_scaling': '100', 'size': '24!', 'ratio': 'expand' } with Diagram(name='Automation Framework Kubernetes', direction='LR', graph_attr=graph_attr): with Cluster('Kafka Cluster'): with Cluster('Zookeeper'): Zookeeper('Zookeeper\ntcp:2181') with Cluster('REST Proxy'): rest_proxy = Custom('REST Proxy\ntcp:8082', 'custom_icons/REST-API.png') with Cluster('Control Center'): control_center = Kafka('Control Center\ntcp:9021') """ Removed for now not working right with Cluster('Schema Registry'): schema_registry = Storage('Schema Registry\ntcp:8081') """ with Cluster('Brokers'): broker_1 = Kafka('Broker 1\ntcp:9092') kafka_brokers = [ broker_1, Kafka('Broker 2\ntcp:9093'), Kafka('Broker 3\ntcp:9094') ] with Cluster('Docker Cluster'): docker = Docker('Docker') with Cluster('container1'): python_container = Python('APIs\nOther Microservices') with Cluster('Docker Registry'): docker_registry_container = Docker('Docker Registry\ntcp:5000') with Cluster('Docker Registry Browser'): docker_registry_browser_container = Python('Docker Registry Browser\ntcp:8088') with Cluster('BatFish'): batfish_container = Custom('BatFish\ntcp:8888\ntcp:9997\ntcp:9996', 'custom_icons/BatFish.png') with Cluster('Secrets Managers'): vault = Vault('HashiCorp Vault\ntcp:8200') secrets_managers = [ vault, ] with Cluster('Logging and Search'): with Cluster('ELK Stack'): elastic_search = Elasticsearch('Elastic Search\ntcp:9200') kibana = Kibana('Kibana\ntcp:5601') logstash = Logstash('Logstash\ntcp:5044') search_log = [ elastic_search, kibana, logstash ] with Cluster('Influxdb'): infulxdb = Influxdb('Influxdb\ntcp:8086') with Cluster('Grafana'): grafana = Grafana('Grafana\ntcp:3000') with Cluster('Database'): with Cluster('Mongo dB'): mongodb = Mongodb('MongoDb\ntcp:27017') mongodb_express = Mongodb('MongoDb Express\ntcp:8181') mongo_group = [ mongodb, mongodb_express ] with Cluster('CI/CD'): team_city = TC('TeamCity') kafka_brokers - python_container python_container - vault python_container - logstash python_container - infulxdb python_container - mongodb
# diagram.py from diagrams import Cluster, Diagram from diagrams.aws.compute import EC2 from diagrams.aws.database import RDS from diagrams.aws.network import ELB with Diagram("AIK web service", show=False): lb = ELB("lb") db = RDS("userdb") with Cluster("Service"): svc_group = EC2("web") lb >> svc_group >> db
from diagrams import Cluster, Diagram from diagrams.k8s.compute import Pod from diagrams.k8s.network import Service from diagrams.onprem.database import PostgreSQL from diagrams.onprem.network import Nginx from diagrams.programming.framework import React def kube_svc(name, replica_count, db): svc = Service(name) apps = [] for _ in range(replica_count): pod = Pod("pod") apps.append(svc >> pod >> db) return svc with Diagram("Lorem Ipsum Simple", show=True, filename='lorem_ipsum_simple'): ui = React("UI") with Cluster("Lorem Ipsum - Kube"): with Cluster("db") as cluster: db_books = PostgreSQL("books") db_auth = PostgreSQL("auth") net = Nginx("loremipsum.com") net >> kube_svc('books', 2, db_books) net >> kube_svc('auth', 2, db_auth) search_engine = Service("Search Engine") db_books - search_engine ui >> net
from urllib.request import urlretrieve from diagrams import Cluster, Diagram from diagrams.custom import Custom from diagrams.aws.compute import ECS, AutoScaling, EC2 from diagrams.aws.database import ElastiCache from diagrams.aws.network import ELB, Route53 kafka_icon = "assets/kafka.png" with Diagram("Infrastructure architecture", show=False): dns = Route53("Smart-Foodies-Shop.com") lb = ELB("Load Balancer") scaler = AutoScaling("Auto Scaling Group") with Cluster("VPC"): svc_group = [ECS("Frontend"), EC2("Redis"), EC2("Backend")] queue = Custom("Kafka", kafka_icon) db = EC2("MySQL") dns >> lb >> scaler scaler >> svc_group svc_group >> db svc_group >> queue