Skip to content

Instantly share code, notes, and snippets.

@xNok
Last active April 5, 2021 02:33
Show Gist options
  • Save xNok/2242b329bcb2bfad363a4a0625a81ebb to your computer and use it in GitHub Desktop.
Save xNok/2242b329bcb2bfad363a4a0625a81ebb to your computer and use it in GitHub Desktop.
from diagrams import Diagram, Cluster, Edge
from diagrams.custom import Custom
from diagrams.onprem.compute import Server
from diagrams.onprem.monitoring import Grafana, Prometheus
from diagrams.onprem.container import Docker
from diagrams.onprem.database import Mongodb
from diagrams.onprem.iac import Ansible
from diagrams.onprem.ci import GithubActions
with Diagram(name="Startup infra for small self hosted project", show=False):
ansible = Ansible("Ansible")
actions = GithubActions("Github Actions")
with Cluster("Master worker"):
ingress = Custom("ingress", "/out/caddy2.png")
with Cluster("Observability"):
# Docker
portainer = Custom("portainer", "/out/portainer.png")
registery = Docker("Private Registery")
ingress >> portainer >> registery
# Prometheus
metrics = Prometheus("Prometheus")
graphana = Grafana("Grafana")
ingress >> graphana >> metrics
# Provisioning
ob = [metrics, graphana, portainer, registery]
ob << Edge(color="firebrick", style="dashed") << ansible
with Cluster("Application worker", direction="TB"):
app = Server("Application")
db = Mongodb("Database")
ingress >> app >> db
# CI/CD
registery \
<< Edge(color="firebrick", style="dashed") << actions \
>> Edge(color="firebrick", style="dashed") >> [db, app]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment