diff --git a/.do/README.md b/.do/README.md index 1c98875d..5c742849 100644 --- a/.do/README.md +++ b/.do/README.md @@ -1,3 +1,8 @@ # Testing Infrastructure We are using DigitalOcean to test our installation outside of AWS. + +## Architecture + + +Information on how to generate diagrams [here](https://codacy.slite.com/app/docs/AeaKyDY7-G1HG0). diff --git a/.do/doc/diagrams/Makefile b/.do/doc/diagrams/Makefile new file mode 100644 index 00000000..87947935 --- /dev/null +++ b/.do/doc/diagrams/Makefile @@ -0,0 +1,18 @@ +PYTHON=python3 + +help: + @echo "Usage:" + @echo " help show this message" + @echo " setup create virtual environment and install dependencies" + @echo " diagrams generates diagrams for all configurations stored in /src to /out" + +setup: + $(PYTHON) -m pip install diagrams --upgrade + @echo "Setup concluded" + +diagrams: + @for f in src/*.py; do $(PYTHON) $$f; done + @echo "Diagrams successfully generated" + +.PHONY: help setup diagrams + diff --git a/.do/doc/diagrams/out/do.jpg b/.do/doc/diagrams/out/do.jpg new file mode 100644 index 00000000..ba3e89bb Binary files /dev/null and b/.do/doc/diagrams/out/do.jpg differ diff --git a/.do/doc/diagrams/src/do.py b/.do/doc/diagrams/src/do.py new file mode 100644 index 00000000..95c1d2c9 --- /dev/null +++ b/.do/doc/diagrams/src/do.py @@ -0,0 +1,38 @@ +from os.path import dirname, abspath +from diagrams import Diagram, Cluster +from diagrams.k8s.group import NS +from diagrams.digitalocean.network import Firewall +from diagrams.digitalocean.database import DbaasPrimary +from diagrams.digitalocean.compute import K8SCluster, K8SNodePool + +file_dir = dirname(abspath(__file__)) + +with Diagram( + name="Digital Ocean K8s Cluster", + show=False, + direction="LR", + curvestyle="ortho", + outformat=["jpg"], + filename=dirname(file_dir) + "/out/" + "do", + graph_attr={"pad": "0.2",}, +): + + with Cluster("Digital Ocean"): + + with Cluster("k8s_cluster"): + cluster = K8SCluster("k8s_cluster") + node_pools = cluster - [ + K8SNodePool("default_node_pool"), + K8SNodePool("auto_scale_pool"), + ] + + with Cluster("namespaces"): + namespaces = cluster - [ + NS("codacy_dev"), + NS("codacy_sandbox"), + NS("codacy_release"), + ] + + with Cluster("database_cluster"): + node_pools - Firewall("postgres_fw") - DbaasPrimary("postgres_db") +