Skip to content

Commit

Permalink
chore(diagram): add diagram code (#426)
Browse files Browse the repository at this point in the history
Just adding the Diagram code
  • Loading branch information
MichelDiz authored Jul 26, 2024
1 parent faac032 commit 9353342
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 0 deletions.
Binary file added diagrams/GraphQL_Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/apollo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/curl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/dgraph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions diagrams/dgraph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from diagrams import Cluster, Diagram, Edge
from diagrams.programming.language import Go, Nodejs, Python
from diagrams.custom import Custom

graph_attr = {
"layout":"dot",
"compound":"true",
"splines":"spline",
}

zeros_attr = {
"icon_path":"./dgraphlg.png"
}

ec2_attr = {
"icon_path":"./dgraphlgEC2.png"
}

with Diagram("\ndgraph", show=False, direction="TB", graph_attr=graph_attr, outformat='png') as diag:
with Cluster("RAFT Groups / Cluster (Baremetal example)"):
with Cluster("0", graph_attr={"label":"Zero Group"}):
a = Custom("Zero 2", **zeros_attr)
b = Custom("Zero 1", **zeros_attr)
c = Custom("Zero 0", **zeros_attr)

with Cluster("1", graph_attr={"label":"Alpha Group"}):
e = Custom("Alpha 4", **ec2_attr)
f = Custom("Alpha 5", **ec2_attr)
g = Custom("Alpha 6", **ec2_attr)
h = Custom("Alpha 3", **ec2_attr)
i = Custom("Alpha 2", **ec2_attr)
j = Custom("Alpha 1", **ec2_attr)
h = Custom("Alpha 0", **ec2_attr)

with Cluster("2", graph_attr={"label":"APIs"}):
e1 = Custom("RAW HTTP", "./http.png")
f1 = Custom("gRPC", "./grpc.png")
g1 = Custom("GraphQL ", "./GraphQL_Logo.png")

with Cluster("3", graph_attr={"label":"Special Node(EE)"}):
Learner = Custom("Learner 0", **ec2_attr)

with Cluster("4", graph_attr={"label":"Clients"}):
client2 = Custom("Apollo GraphQL ", "./apollo.png")
client3 = Nodejs("Dgraph-JS")
client4 = Python("Pydgraph")
client0 = Go("Dgo")
client1 = Custom("Curl", "./curl.png")

b >> Edge(lhead="cluster_1") >> f

g >> Edge(ltail="cluster_1") >> Learner
e >> Edge(ltail="cluster_2") >> e1

g1 >> Edge(lhead="cluster_4") >> client2
f1 >> Edge(lhead="cluster_4") >> client0
e1 >> Edge(lhead="cluster_4") >> client1

diag
Binary file added diagrams/dgraphlg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/dgraphlgEC2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/grpc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added diagrams/http.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions diagrams/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Create a new Diagram

sudo apt install graphviz

pip install diagrams

python3 dgraph.py

0 comments on commit 9353342

Please sign in to comment.