def mysql(c, version): with Diagram(f'MySQL Server (ver. {version}) Pod', filename=f'mysql-{version}', show=False, graph_attr={'pad': '0.0'}): _mysql = MySQL('MySQL Server') _metricbeat = Beats('Metricbeat') _heartbeat = Beats('Heartbeat') _logstash = Logstash('Logstash') 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(f'mysql-system-{version}.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 _mysql >> _metricbeat >> _logstash _logstash << _heartbeat
from diagrams.onprem.database import MySQL from diagrams.onprem.inmemory import Redis from diagrams.onprem.network import Nginx, Apache, Internet from diagrams.onprem.queue import Celery """ https://diagrams.mingrammer.com """ with Diagram("Sample", show=False): user_web = EC2("Web") with Cluster('WEB SERVER'): web_server = [Apache('Web Server'), Nginx('Web Server')] with Cluster('QUEUE'): sever_queue = Redis('Queue Broker') sever_queue - [Celery('Queue Worker')] with Cluster('DATABASE'): db_master = MySQL('Database') # db_master - Database('Database') with Cluster('DATABASE2'): db_slave = MySQL('Database2') # db_slave - Database('Database2') user_web >> web_server >> sever_queue sever_queue >> db_master sever_queue >> db_slave web_server >> db_master web_server >> db_slave
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') user >> dns >> web_server >> was >> database nhn_jenkins >> acm_jenkins >> was
#onPrem imports from diagrams.onprem.database import Mysql as MySQL from diagrams.onprem.database import Postgresql as PostgreSQL from diagrams.onprem.network import Zookeeper from diagrams.onprem.queue import Kafka cluster_attr = { "bgcolor": "transparent", "pencolor" : "white", } with DaC("mysql postgres dblog zookeeper kafka ", filename= "./diagram-adhocBT", show=True, direction="BT"): with Cluster(" ", graph_attr=cluster_attr): with Cluster("mysql service"): mysql = MySQL("mysql") with Cluster("postgres service"): postgres = PostgreSQL("postgres") vol_mysql = Volume("db-data") vol_mysql >> Edge(color="darkgreen", style="dashed") << mysql vol_postgres = Volume("db-data") vol_postgres >> Edge(color="darkgreen", style="dashed") << postgres with Cluster("dblog service"): dblog = Server("dblog") with Cluster(" ", graph_attr=cluster_attr): with Cluster("zookeeper service"): zookeeper = Zookeeper("zookeeper")
redis_main << replica redis_main >> replica replica >> redis_haproxy redis_haproxy >> replica redis_haproxy.connect( redis_main, Edge(redis_haproxy, reverse=True, color='#5e73e5')) redis_main.connect(redis_haproxy, Edge(redis_main, reverse=True, color='#2ea44f')) with Cluster('MySQL Cluster'): mysql_nodes = [] mysql_main = MySQL('MySQL: main') mysql_nodes.append(mysql_main) for n in range(1, NUM_MYSQL_REPLICAS + 1): replica = MySQL(f'MySQL: replica {n}') mysql_nodes.append(replica) mysql_main << replica mysql_main >> replica replica << db_haproxy replica >> db_haproxy db_haproxy.connect(mysql_main, Edge(db_haproxy, reverse=True, color='#5e73e5'))
from diagrams.onprem.database import MySQL from diagrams.onprem.inmemory import Redis from diagrams.custom import Custom with Diagram("Food Platform Architecture", show=False): customUser = Custom("User", "./resources/notebook.png") orderWebUi = Pod("order web ui") ing = Ingress() gatewaySvc = Service("food gateway svc") gateway = Pod("food gateway") orderDB = MySQL("order") orderSvc = Service("order svc") orderApp = Pod("order app") orderApp >> orderDB orderSvc >> orderApp restaurantDB = MySQL("restaurant") restaurantSvc = Service("restaurant svc") restaurantApp = Pod("restaurant app") restaurantApp >> restaurantDB restaurantSvc >> restaurantApp reviewDB = MongoDB("review") reviewSvc = Service("review svc") with Cluster("review app"): reviewApp1 = Pod("v1")
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: rs1 = database.Redshift("Redshift\nCluster") postgres = PostgreSQL("Postgres\n(RDS)") mySQL = MySQL("MySQL\n(RDS)") airflow = Airflow("Airflow Server\n(ECS Fargate)") # with Cluster("Public Subnet (2)") as pub2: nat = network.NATGateway("NAT\nGateway") # rs2 = database.Redshift("Redshift\n(node 2)") elb = network.ELB("Elastic Load\nBalancer") with Cluster("Private Subnets") as priv1: Blank("") singer1 = Singer("Singer.io\nExtract/Loads\n(ECS Fargate)") Blank("") Blank("") Blank("") # with Cluster("Private Subnet (2)") as priv2: tableau = Tableau("Tableau Server\n(EC2)")