def webhooked_vault_agent_architecture(): with Diagram(name="Mutating Webhook", show=False): with Cluster("Control Plane"): apiserver = APIServer() with Cluster(""): webhook = SQS("Mutating Webhook") with Cluster(""): vault = Vault("Vault") with Cluster("Secure Pod"): with Cluster("Injected"): vault_init_agent = Custom("Init Vault Agent", crio_icon) vault_agent = Custom("Vault Agent", crio_icon) injected = [vault_init_agent, vault_agent] app_container = Custom("App", crio_icon) inMemory = Vol("In Memory") vault_init_agent >> inMemory app_container << inMemory vault >> Edge() << vault_agent >> Edge() << app_container apiserver >> Edge() << webhook apiserver >> Edge() << vault webhook >> vault_agent
def basic_vault_agent_architecture(): with Diagram(name="Vault Agent Architecture", show=False, direction="LR"): with Cluster("Control Plane"): apiserver = APIServer() with Cluster("Vault"): svc = Service(":8200") certs_secret = Secret("Certs Secret") vault_configmap = ConfigMap("Vault Config") vault = Vault("Vault") file_backend = PV("Encrypted Store") vault >> file_backend vault >> Edge() << svc vault << certs_secret vault << vault_configmap with Cluster("Secure Pod"): vault_agent = Custom("Vault Agent", crio_icon) vault_init_agent = Custom("Init Vault Agent", crio_icon) manual = [vault_init_agent, vault_agent] app_container = Custom("App", crio_icon) inMemory = Vol("In Memory") manual >> inMemory app_container << inMemory manual << svc << manual >> Edge() << app_container apiserver >> Edge() << vault
def render_transitions(dialogs: Union[List[Dialog], DialogRegistry], title: str = "Aiogram Dialog", filename: str = "aiogram_dialog", format: str = "png"): if isinstance(dialogs, DialogRegistry): dialogs = list(dialogs.dialogs.values()) with Diagram(title, filename=filename, outformat=format, show=False): nodes = {} for dialog in dialogs: with Cluster(dialog.states_group_name()): for window in dialog.windows.values(): nodes[window.get_state()] = Custom(icon_path=ICON_PATH, label=window.get_state().state) starts = [] for dialog in dialogs: for window in dialog.windows.values(): starts.extend(find_starts(window.get_state(), [window.keyboard])) for dialog in dialogs: for window in dialog.windows.values(): walk_keyboard(nodes, dialog, starts, window.get_state(), [window.keyboard]) preview_add_transitions = getattr(window, "preview_add_transitions", None) if preview_add_transitions: walk_keyboard(nodes, dialog, starts, window.get_state(), preview_add_transitions)
def ssh_server(c): with Diagram('SSH Server Pod', filename='ssh_server', show=False, graph_attr={'pad': '0.0'}): _ssh_server = Custom('OpenSSH Server', 'ssh.png') _polycube = Custom('Polycube', 'polycube.png') _cubebeat = Beats('Cubebeat') _metricbeat = Beats('Metricbeat') _heartbeat = Beats('Heartbeat') _logstash = Logstash('Logstash') with Cluster('cubebeat'): _cubebeat_file = [CM('cubebeat.yml')] _ = _cubebeat_file - _cubebeat with Cluster('cubebeat-config'): _cubebeat_cfg = [CM('synflood.yml')] _ = _cubebeat_cfg - _cubebeat with Cluster('heartbeat-config'): _heartbeat_cfg = [CM('hearbeat.yml')] _ = _heartbeat_cfg - _heartbeat with Cluster('heartbeat-monitor'): _heartbeat_monitor = [CM('host.yml'), CM('logstash.yml'), CM('server.yml')] _ = _heartbeat_monitor - _heartbeat with Cluster('logstash-config'): _logstash_cfg = [CM('logstash.yml'), CM('pipelines.yml'), CM('log4j2.properties')] _ = _logstash_cfg - _logstash with Cluster('logstash-pipeline'): _logstash_pipe = [CM('ssh-server.conf'), CM('system.conf')] _ = _logstash_pipe - _logstash with Cluster('metricbeat-config'): _metricbeat_cfg = [CM('metricbeat.yml')] _ = _metricbeat_cfg - _metricbeat with Cluster('metricbeat-modules'): _metricbeat_mod = [CM('system.yml')] _ = _metricbeat_mod - _metricbeat _ssh_server >> _polycube >> _cubebeat >> _logstash _logstash << _metricbeat _logstash << _heartbeat
bitnami_url = "https://avatars1.githubusercontent.com/u/34656521?s=280&v=4" bitnami_icon = "bitnami.png" urlretrieve(bitnami_url, bitnami_icon) concourse_url = "https://git.rrerr.net/uploads/-/system/project/avatar/434/concourse-black.png" concourse_icon = "concourse.png" urlretrieve(concourse_url, concourse_icon) metallb_url = "https://v0-3-0--metallb.netlify.com/images/logo.png" metallb_icon = "metallb.png" urlretrieve(metallb_url, metallb_icon) with Diagram("Terraform Kube"): cloudFlare = Custom("Cloudflare DNS", cloudflare_icon) wasabi = Custom("Wasabi S3 Storage", wasabi_icon) with Cluster("Concourse CI"): Custom("Concourse CI", concourse_icon) with Cluster("K8s Provisioning Pipeline"): createServersStage = Custom("Create Servers", terraform_icon) deployClusterStage = Custom("Deploy K8s Cluster", kubespray_icon) deployComponentsStage = Custom("Deploy K8s Components", kubernetes_icon) with Cluster("K8s Destroying Pipeline"): destroyServersStage = Custom("Destroy Servers", terraform_icon) with Cluster("Hetzner Cloud"): with Cluster("WireGuard VPN"): with Cluster("Kubernetes Cluster"):
def main(): graph_attr = { "fontsize": "45", 'overlap_scaling': '100', 'size': '24!', 'ratio': 'expand' } with Diagram(name='Automation Framework Swarm', direction='LR', graph_attr=graph_attr): with Cluster('Docker Cluster'): docker = Docker('Docker') with Cluster('container1'): python_container = Python('APIs\nOther Microservices') 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') 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('Secrets Managers'): vault = Vault('HashiCorp Vault\ntcp:8200') secrets_managers = [ vault, ] with Cluster('Logging and Search'): with Cluster('Search and Logging'): 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('Inventory and Connectivity'): with Cluster('Inventory'): nautobot = Custom('Nautobot\ntcp:8000', 'custom_icons/Nautobot.jpeg') kafka_brokers - python_container python_container - vault python_container - nautobot nautobot - logstash python_container - logstash
from diagrams import Cluster, Diagram, Edge from diagrams.custom import Custom from diagrams.generic.os import Ubuntu from diagrams.onprem.ci import GithubActions from diagrams.onprem.client import Users from diagrams.onprem.network import Gunicorn, Nginx from diagrams.onprem.vcs import Github from diagrams.programming.framework import Django 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")
# -*- coding: utf-8 -*- from diagrams import Diagram, Cluster, Edge from diagrams.custom import Custom from diagrams.k8s.compute import Pod globe_img = "resources/globe.png" graph_attr = {"pad": "0.5"} with Diagram(filename="shard", direction='TB', show=False, outformat='png', graph_attr=graph_attr): user_1 = [Custom("user", globe_img) for _ in range(1)] with Cluster("Shard"): web, jicofo, prosody = [Pod("web"), Pod("jicofo"), Pod("prosody")] user_1 >> web web >> prosody jicofo >> Edge() << prosody n_jvbs = 3 with Cluster("Jitsi Videobridge"): jvb_pods = [Pod(f"jvb-{i}") for i in range(n_jvbs)] [jvb_pods[i] >> Edge() << prosody for i in range(n_jvbs)] user_1 >> jvb_pods[0]
from diagrams.custom import Custom from diagrams.aws.storage import S3 from diagrams.k8s.compute import RS from diagrams.onprem.client import Client from diagrams.gcp.storage import GCS terraform_url = "https://www.terraform.io/assets/images/og-image-8b3e4f7d.png" terraform_icon = "terraform.png" urlretrieve(terraform_url, terraform_icon) dask_icon = "images/dask-icon.png" with Diagram("Multi-Cloud", show=False): terraform = Custom("Terraform", terraform_icon) client = Client("Client Notebook") with Cluster("AWS"): with Cluster("Kubernetes"): dask1 = Custom("\nDask", dask_icon) worker = RS("Dask Worker") worker >> Edge(color="orange") << dask1 s3 = S3("LENS") terraform >> worker worker >> s3 with Cluster("GCP"): with Cluster("Kubernetes"):
from diagrams.azure.compute import FunctionApps graph_attr = { "fontsize": "45" } react_url = "http://assets.stickpng.com/images/584830f5cef1014c0b5e4aa1.png" react_icon = "react.png" urlretrieve(react_url, react_icon) with Diagram("Marketplace", show=True, graph_attr=graph_attr): apiSupplier = APIConnections("Supplier Api") sapConnection = APIConnections("Order Creation") with Cluster("Azure"): checkSupplier = FunctionApps("Get Products") checkSAPStatus = FunctionApps("Order Status") apiRestFul = AppServices("ApiRestFul") sqlServerDataBase = SQLDatabases("Database") reactFrontend = Custom("WebApp", react_icon) checkSupplier >> apiRestFul reactFrontend >> apiRestFul apiRestFul << checkSAPStatus apiRestFul >> sqlServerDataBase apiSupplier << checkSupplier checkSAPStatus >> sapConnection apiRestFul >> sapConnection
# diagram.py from urllib.request import urlretrieve from diagrams import Cluster, Diagram from diagrams.custom import Custom from diagrams.k8s.network import Ingress, Service from diagrams.k8s.compute import Pod from diagrams.k8s.rbac import User quarkus_url = "https://github.com/openlab-red/quarkus-mtls-quickstart/raw/master/diagram/quarkus.png" quarkus_icon = "quarkus.png" urlretrieve(quarkus_url, quarkus_icon) with Diagram("Mutual TLS", show=False): with Cluster("Request"): users = [User("Users")] with Cluster("Mutual TLS"): client = Custom("http://client:8080/hello", quarkus_icon) server = Custom("https://server:8443/hello", quarkus_icon) client >> [server] server >> [client] users >> client
from diagrams.gcp.analytics import BigQuery, Dataflow, PubSub from diagrams.programming.language import Nodejs from diagrams.onprem.monitoring import Grafana, Prometheus from diagrams.aws.database import RDS from diagrams.aws.network import ELB from diagrams.aws.storage import S3 from diagrams.onprem.network import Traefik from diagrams.custom import Custom from diagrams.onprem.tracing import Jaeger from diagrams.onprem.database import Cassandra with Diagram("OpenFlow Basic"): with Cluster("Backend"): b = [Mongodb("MongoDB"), Rabbitmq("RabbitMQ")] with Cluster("Remote Clients"): rc = [Custom("OpenRPA", "./my_resources/open_rpa128.png"), Custom("PowerShell", "./my_resources/PowerShell_5.0_icon.png"), Custom("NodeRED", "./my_resources/node-red-icon.png")] with Cluster("Frontend + API"): api = EC2("WEB-API") Custom("NodeRED", "./my_resources/node-red-icon.png") b << api api << rc with Diagram("OpenFlow with Traefik"): with Cluster("Backend"): b = [Mongodb("MongoDB"), Rabbitmq("RabbitMQ")] with Cluster("Remote Clients"): rc = [Custom("OpenRPA", "./my_resources/open_rpa128.png"), Custom("PowerShell", "./my_resources/PowerShell_5.0_icon.png"), Custom("NodeRED", "./my_resources/node-red-icon.png")]
from diagrams import Diagram from diagrams.saas.analytics import Snowflake from diagrams.aws.storage import S3 from diagrams.programming.framework import Fastapi, FastAPI from diagrams.saas.identity import Auth0 from diagrams.custom import Custom with Diagram("Event Processing", show=False): cc_csv = Custom("csv file", "./csv.png") source = S3("Upload csv to S3") download = S3("Download csv from S3") ingestion = Snowflake("Snowflake Database") api = FastAPI("API Endpoints") authentication = Auth0("API Auth") cc_test = Custom("Pytest", "./pytest.png") cc_locust = Custom("Locust", "./Locust.png") cc_csv >> source >> download >> ingestion >> api >> authentication >> cc_test >> cc_locust
from urllib.request import urlretrieve #Backblaze backblaze_url = "https://img.stackshare.io/service/5918/5bNX_lVF_400x400.png" backblaze_icon = "backblaze.png" urlretrieve(backblaze_url, backblaze_icon) #Restic restic_url = "https://restic.readthedocs.io/en/latest/_static/logo.png" restic_icon = "restic.png" urlretrieve(restic_url, restic_icon) with Diagram(filename="restic_backblaze", show=True, direction="TB"): backblaze = Custom("Backblaze B2 Storage", backblaze_icon) with Cluster("Dedicated Ubuntu Server"): 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") snapshot = Docker("Snapshot") gamenight = Docker("Gamenight") misc = Docker("Misc. Servers")
from diagrams import Cluster, Diagram, Edge from diagrams.custom import Custom from diagrams.programming.language import JavaScript from diagrams.onprem.client import Client from diagrams.aws.iot import IotCamera from diagrams.programming.language import Go graph_attr = {"fontsize": "45", "bgcolor": "transparent", "pad": "0.0"} with Diagram(filename="pirate_spyglass", show=False, graph_attr=graph_attr): with Cluster("Experiment"): piCamera = IotCamera("PiCamera") with Cluster("Raspberry Pi"): v4l2 = Custom("PiCamera Driver\n+ V4L2", "./customImages/RPi-Logo-SCREEN.png") go = Go("BerryMSE") v4l2 << Edge(label="Raw Image", color="firebrick") << piCamera go << Edge(label="MPEG-4 Part 10 AVC\nH.264 NAL Units", color="firebrick") << v4l2 with Cluster("Client"): website = Client("Website") javaScript = JavaScript("MSE") javaScript << Edge(label="MPEG-4 Part 15 AVCFF\nH.264 NAL Units", color="firebrick") << go website << Edge(label="Video", color="firebrick") << javaScript
def custom_icon(filename): return os.path.join("architecture/icons", filename) with Diagram( "QHub Architecture: High Level", filename="high_level_architecture", show=False, direction="TB", ): with Cluster("Kubernetes Cluster"): conda_pvc = PersistentVolume("Conda (Persistent Volume)") nfs_pvc = PersistentVolume("NFS (Persistent Volume)") elb = LoadBalancing("Ingress") with Cluster("Pods"): dask_gateway = Custom("Dask Gateway", custom_icon("dask.png")) jupyterhub = Custom("JupyterHub", custom_icon("jupyter_hub.png")) dask_scheduler = Custom("Dask Scheduler", custom_icon("dask.png")) nfs_server = Pod("NFS Server") conda_store = Custom("Conda Store", custom_icon("conda.png")) nginx = Custom("Nginx", custom_icon("nginx.png")) nginx >> elb nginx >> jupyterhub [nfs_server, conda_store, dask_gateway] << jupyterhub [conda_store, dask_scheduler] << dask_gateway nfs_server >> nfs_pvc conda_store >> conda_pvc
github = Github("github") gitlab = Gitlab("gitlab") gits = [ github, gitlab] with Cluster("K8s cluster"): ic = CRD("IntegrationConfig") ij = CRD("IntegrationJob") ing = Ingress() with Cluster("CI/CD Operator"): webhookServer = Pod("Webhook server") github - Edge(label="PullRequest/Push/Tag") >> ing >> webhookServer webhookServer - Edge(label="Queued") >> ij pr = Custom("PipelineRun", tektonIcon) ij - Edge(label="Scheduled") >> pr tr1 = Custom("TaskRun-1", tektonIcon) tr2 = Custom("TaskRun-2", tektonIcon) tr3 = Custom("TaskRun-3", tektonIcon) pr >> tr3 >> Pod() pr >> tr2 >> Pod() pr >> tr1 >> Pod() ic - Edge(label="Register Webhook") >> gitlab
from diagrams import Cluster, Diagram from diagrams.custom import Custom from diagrams.programming.framework import Spring from diagrams.programming.language import Csharp from diagrams.programming.language import Go from diagrams.programming.language import Typescript from diagrams.generic.device import Mobile from diagrams.generic.os import Windows with Diagram("Architecture", show=False, direction="BT"): api_gateway = Custom("API-Gateway\n(KrakenD)", "./pics/krakend.png") with Cluster("\nMicrosrvices"): microservices = [ Go("advanced"), Csharp("dotnetapi"), Go("greeter"), Go("mathservice"), Spring("springapi"), Go("task-api"), Typescript("tsoaapi") ] with Cluster("Application Layer"): application = [Mobile("Mobile"), Windows("Browser")] openapi = Custom("OpenAPI", "./pics/openapi.png") api_gateway >> microservices api_gateway >> openapi
from diagrams.k8s.compute import Pod from diagrams.k8s.network import Ingress globe_img = "resources/globe.png" jitsi_img = "resources/jitsi-logo-square.png" graph_attr = {"pad": "0.5"} with Diagram(filename="jitsi_sharding", 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)] with Cluster("Kubernetes Cluster"): ingress = Ingress("edurusma.adalet.gov.tr") with Cluster("HAProxy"): n_haproxy = 2 haproxy_pods = [Pod(f"haproxy-{i}") for i in range(n_haproxy)] edge_conference_1 = Edge(color="red") edge_conference_2 = Edge(color="green") shard_0 = Custom("shard-0", jitsi_img) shard_1 = Custom("shard-1", jitsi_img) users_1 >> edge_conference_1 >> ingress
from diagrams.aws.iot import IotCamera from diagrams.programming.framework import React from diagrams.programming.language import NodeJS graph_attr = {"fontsize": "45", "bgcolor": "transparent", "pad": "0.0"} with Diagram(filename="pirate_architecture", show=False, graph_attr=graph_attr): with Cluster("Pirate Module"): with Cluster("Raspberry PI"): # with Cluster("Docker1"): with Cluster("Nodejs"): nodeJs = NodeJS("Pirate-Bridge") with Cluster("Docker1"): Janus = Custom("Pirate-Spyglass", "./customImages/janus-logo.png") with Cluster("Docker2"): Gstreamer = Custom("Gstreamer", "./customImages/gstreamer-logo.png") Janus << Edge(label="RTSP Stream", color="firebrick") << Gstreamer with Cluster("ReactJs"): react = React("Pirate-Flag") caddy = Caddy("Pirate-Map") caddy << Edge(color="firebrick") >> Janus caddy << Edge(color="firebrick") >> react caddy << Edge(color="firebrick") >> nodeJs with Cluster("Arduino Project"): piCamera = IotCamera("Camera")
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.messenger.schule") ingress >> Service("haproxy") >> haproxy_pods >> web_service
"fontsize": "12", } _icon = Server with Diagram(title, filename=filename, graph_attr=graph_attr, outformat='png', direction=direction, show=False): with Cluster("Multicloud deployment", graph_attr={ "fontsize": "15" }): # overwrite attributes for the default cluster with ServerContents("chassis 1: Bastion host"): Custom("Chassis", "./resources/ovn.png") Crio("HAproxy") Crio("Nginx") Crio("Registry") Crio("Apache") Crio("Bind") Crio("dnsmasq") with AvailabilityZone("chassis 2"): Custom("Chassis", "./resources/ovn.png") Server("nyctea") with AvailabilityZone("chassis 3"): Server("tyto") Custom("Central", "./resources/ovn.png") with Region("chassis 4", graph_attr={ "pencolor": "#60193C",
from diagrams.onprem.network import Caddy from diagrams.onprem.queue import Kafka from diagrams.generic.device import Tablet from diagrams.onprem.client import Client from diagrams.generic.blank import Blank from diagrams.generic.device import Mobile from diagrams.aws.iot import IotCamera from diagrams.programming.framework import React from diagrams.programming.language import NodeJS graph_attr = {"fontsize": "45", "bgcolor": "transparent", "pad": "0.0"} with Diagram(filename="pirate_bridge", show=False, graph_attr=graph_attr): with Cluster("Raspberry PI"): with Cluster("Pirate Bridge"): serial = Custom("Serial-Interface", "./customImages/serialport-logo-small.png") ardu_sent = NodeJS("Arduino Send Buffer") config = NodeJS("Config Data") client_sent = NodeJS("Client Send Buffer") httpapi = Custom("HTTP-API", "./customImages/Expressjs.png") caddy = Caddy("Pirate Map") with Cluster("Arduino Project"): with Cluster("Arduino"): hook = Custom("Pirate-Hook", "./customImages/720px-Arduino_Logo.png") caddy << Edge(color="firebrick") >> httpapi httpapi << [client_sent, config] httpapi >> ardu_sent
from diagrams import Diagram, Cluster, Edge from diagrams.onprem.container import Docker from diagrams.onprem.iac import Terraform, Ansible from diagrams.custom import Custom graph_attr = {"fontsize": "45", "bgcolor": "transparent", "dpi": "300"} with Diagram("", show=False, filename="value_stream", graph_attr=graph_attr): image = Docker("Docker Image") docker_role = Ansible("Ansible Role Docker") app_role = Ansible("Ansible Role App") packer_ami = Custom("AMI", "packer.png") terrafor_module = Terraform("Module") terrafor_stack = Terraform("Deployment") image >> app_role >> packer_ami docker_role >> packer_ami >> terrafor_module >> terrafor_stack
from diagrams.onprem.storage import Glusterfs from diagrams.onprem.vcs import Gitea from diagrams.custom import Custom from urllib.request import urlretrieve from diagrams.generic.blank import Blank with open("icons.json", "r") as fd: icons = json.load(fd) for k in icons: i = icons[k] if i["url"] is not None and not os.path.isfile(i["icon"]): urlretrieve(i["url"], i["icon"]) with Diagram("Infrastructure", direction="TB"): internet = Custom("", icons["cloudflare"]["icon"]) with Cluster("Pi Cluster", direction="TB"): docker = Docker() with Cluster("Pi 1", direction="TB") as pi1: controller = Docker("Docker Swarm Manager") glusterfs1 = Glusterfs("glusterfs") with Cluster("Pi 2", direction="TB") as pi2: agent = Docker("Docker Swarm Node") glusterfs2 = Glusterfs("glusterfs") with Cluster("Containers"): with Cluster("External"): cloudflared = Custom("cloudflared", icons["cloudflareCloud"]["icon"])
from diagrams import Cluster, Diagram from diagrams.generic.database import SQL from diagrams.aws.database import RDSMysqlInstance from diagrams.generic.device import Mobile from diagrams.programming.language import Python from diagrams.custom import Custom from diagrams.onprem.monitoring import Grafana with Diagram("Event processing",show=False): phone = Mobile("Phone running Owntracks") with Cluster("Services"): connector = Python("Connector") mysql = RDSMysqlInstance("MYSQL DB") mqtt = Custom("MQTT broker", "./mosquitto.png") grafana = Grafana("Grafana") phone >> mqtt >> connector >> mysql << grafana
from diagrams import Cluster, Diagram from diagrams.k8s.compute import Job from diagrams.onprem import client, container from diagrams.custom import Custom with Diagram(name="MLCommons-Box-k8s", show=False): with Cluster("Kubernetes Runner"): yaml_icon = "yaml.jpg" config = [ container.Docker("container"), Custom("Task file", yaml_icon) ] client.User("User") >> config >> Job("k8s")
from urllib.request import urlretrieve from diagrams import Cluster, Diagram from diagrams.aws.database import Aurora from diagrams.custom import Custom from diagrams.k8s.compute import Pod # Download an image to be used into a Custom Node class rabbitmq_url = "https://jpadilla.github.io/rabbitmqapp/assets/img/icon.png" rabbitmq_icon = "rabbitmq.png" urlretrieve(rabbitmq_url, rabbitmq_icon) with Diagram("Broker Consumers", show=False): with Cluster("Consumers"): consumers = [Pod("worker"), Pod("worker"), Pod("worker")] queue = Custom("Message queue", rabbitmq_icon) queue >> consumers >> Aurora("Database")
} kuberik_icon = "logo.png" with Diagram(filename="play_trigger", show=False, edge_attr=edge_attr, outformat="png", graph_attr=graph_attr, node_attr=node_attr): with Cluster("Screening", graph_attr=graph_attr): screener_controller = Pod("Screener Controller") screener = CRD("Screener") events = CRD("Events") screener << Edge(label="configure", **edge_attr) - screener_controller screener_controller - Edge(label="") >> events movie = CRD("Movie") # "\n" fixes padding issues engine = Custom("Engine\n", kuberik_icon) movie << Edge(constraint="false") - engine [events, events, events] << engine with Cluster("Pipeline execution", graph_attr=graph_attr): play = CRD("Play") actions = [Job("Action"), Job("Action"), Job("Action")] engine >> [play, play, play] movie - Edge(style="dotted") >> play play - Edge(style="dotted") >> actions
# outformat="jpg", outformat="png", filename="./assets/images/architecture/installation"): with Cluster("NUC", direction="LR", graph_attr={ "shape": "box", "style": "rounded", "labeljust": "l", "pencolor": "#AEB6BE", "fontname": "Lucida-Sans", "fontsize": "16", }): k4a = K4A() rs2 = RS2() monitor = Monitor() led = Custom("led", intel_nuc_icon) with Cluster("Workstation", direction="LR", graph_attr={ "shape": "box", "style": "rounded", "labeljust": "l", "pencolor": "#AEB6BE", "fontname": "Lucida-Sans", "fontsize": "16", }): volcap = VolCap() volsnap = VolSnap() devrepo = DevRepo() message_queue = RabbitMQ()