def simple_main(): # graph_attr é a lista de parâmetros utilizados na construção do diagrama. graph_attr = {"fontsize": "32", "fontcolor": "#1D3B52", "bgcolor": "white"} # Cria o Diagrama base do nosso mapa with Diagram('fboaventura.dev', direction='LR', filename='simple_fboaventura_dev', outformat='png', graph_attr=graph_attr, show=False) as diag: # Adiciona os nós no mapa ingress = Haproxy('loadbalancer') webserver = Nginx('django') db = Postgresql('database') memcached = Memcached('sessions') # Criamos um cluster para os componentes do Celery, que trabalham em conjunto with Cluster('Celery'): beat = Celery('beat') workers = [Celery('worker1'), Celery('worker2')] flower = Celery('flower') broker = Rabbitmq('broker') logs = Redis('logs') # Montamos o mapa de relacionamentos entre os nós ingress >> webserver webserver >> broker beat >> broker workers >> beat webserver >> db db >> broker webserver >> memcached broker >> logs workers >> logs flower >> beat flower >> workers beat >> logs
from diagrams.onprem.queue import Celery, Rabbitmq from diagrams.onprem.network import Nginx, Haproxy graph_attr = { "fontsize": "32", "fontcolor": "#1D3B52", "bgcolor": "white" } # Cria o Diagrama base do nosso mapa with Diagram('fboaventura.dev', direction='LR', filename='simple_fboaventura_dev', outformat='png', graph_attr=graph_attr) as diag: # Adiciona os nós no mapa ingress = Haproxy('loadbalancer') webserver = Nginx('django') db = Postgresql('database') memcached = Memcached('sessions') # Criamos um cluster para os componentes do Celery, que trabalham em conjunto with Cluster('Celery'): beat = Celery('beat') workers = [Celery('worker1'), Celery('worker2')] flower = Celery('flower') broker = Rabbitmq('broker') logs = Redis('logs') # Montamos o mapa de relacionamentos entre os nós ingress >> webserver webserver >> broker beat >> broker workers >> beat
from diagrams import Diagram, Cluster from diagrams.onprem.network import Nginx, Tomcat from diagrams.onprem.database import Postgresql from diagrams.onprem.client import User from diagrams.onprem.container import Docker with Diagram("", show=False, filename="infrastructure"): user = User("Web Browser") nginx = Nginx("Nginx") db = Postgresql("PG-DB") web = Docker("RedMine") user >> nginx >> web >> db
from diagrams.azure.database import SQLDatabases, SQLManagedInstances, SQLServers, DatabaseForMysqlServers, DatabaseForMariadbServers, DatabaseForPostgresqlServers from diagrams.aws.database import RDS, Aurora, Database node_attr = {"fontsize": "20"} graph_attr = {"fontsize": "28"} with Diagram("", show=False, direction="TB", node_attr=node_attr): with Cluster("On-Premises", graph_attr=graph_attr): with Cluster("Commercial Platforms", graph_attr=graph_attr): closed_source = [Oracle(""), Mssql("")] with Cluster("Open Source Platforms", graph_attr=graph_attr): with Cluster(""): mysql = Mysql("") mysql >> [MariaDB("MariaDB")] open_source = [mysql, Postgresql("PostgreSQL")] with Cluster("Cloud", graph_attr=graph_attr): with Cluster("Azure", graph_attr=graph_attr): with Cluster("SQL Server", graph_attr=graph_attr): azure = [ SQLDatabases("\nAzure SQL\nDatabase"), SQLManagedInstances("\n\nSQL\nManaged\nInstances"), SQLServers("\nSQL Server\n(IaaS)") ] with Cluster("Other", graph_attr=graph_attr): azure2 = [ DatabaseForMysqlServers("\nMySQL"), DatabaseForMariadbServers("\nMariaDB"), DatabaseForPostgresqlServers("\nPostgreSQL") ]
from diagrams.aws.network import Route53 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")