72 lines
2 KiB
Python
72 lines
2 KiB
Python
|
""" Diagram to visualize serguzim.net """
|
||
|
|
||
|
from diagrams import Cluster, Diagram
|
||
|
|
||
|
from diagrams.oci.compute import Container, OCIRegistry
|
||
|
from diagrams.oci.storage import ObjectStorage
|
||
|
|
||
|
from diagrams.onprem.ci import Droneci
|
||
|
from diagrams.onprem.database import Influxdb, Postgresql
|
||
|
from diagrams.onprem.monitoring import Grafana, Prometheus
|
||
|
from diagrams.onprem.network import Caddy
|
||
|
from diagrams.onprem.vcs import Gitea
|
||
|
|
||
|
def add_to_groups(service, *groups):
|
||
|
""" Add a service to groups like 'db_users' """
|
||
|
for group in groups:
|
||
|
group.append(service)
|
||
|
|
||
|
|
||
|
with Diagram("serguzim.net", show=False):
|
||
|
|
||
|
node002 = Cluster("node002.serguzim.net")
|
||
|
node004 = Cluster("node004.serguzim.net")
|
||
|
|
||
|
exoscale_objectstore = ObjectStorage("Exoscale Object Storage")
|
||
|
|
||
|
with node002:
|
||
|
services = []
|
||
|
db_users = []
|
||
|
objectstore_users = []
|
||
|
|
||
|
proxy = Caddy()
|
||
|
|
||
|
ci = Droneci("ci.serguzim.me")
|
||
|
add_to_groups(ci, services, db_users)
|
||
|
|
||
|
db_time = Influxdb("tick.serguzim.me")
|
||
|
add_to_groups(db_time, services, db_users)
|
||
|
|
||
|
db = Postgresql("db.serguzim.me")
|
||
|
|
||
|
graph = Grafana("graph.serguzim.me")
|
||
|
add_to_groups(graph, services, db_users)
|
||
|
|
||
|
mail = Container("mail.serguzim.me")
|
||
|
add_to_groups(mail, services)
|
||
|
|
||
|
matrix = Container("matrix.serguzim.me")
|
||
|
add_to_groups(matrix, services, db_users, objectstore_users)
|
||
|
|
||
|
prometheus = Prometheus("prometheus.serguzim.me")
|
||
|
add_to_groups(prometheus, services)
|
||
|
|
||
|
registry = OCIRegistry("registry.serguzim.me")
|
||
|
add_to_groups(registry , services, db_users, objectstore_users)
|
||
|
|
||
|
vcs = Gitea("git.serguzim.me")
|
||
|
add_to_groups(vcs, services, db_users)
|
||
|
|
||
|
db_users >> db
|
||
|
proxy >> services
|
||
|
objectstore_users >> exoscale_objectstore
|
||
|
|
||
|
with node004:
|
||
|
services = []
|
||
|
|
||
|
proxy = Caddy()
|
||
|
minecraft = Container("minecraft.serguzim.me")
|
||
|
add_to_groups(minecraft, services)
|
||
|
|
||
|
proxy >> services
|