Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Add DO diagram #772

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .do/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Testing Infrastructure

We are using DigitalOcean to test our installation outside of AWS.

## Architecture
<img src="doc/diagrams/out/do.jpg" width="60%" height="60%">

Information on how to generate diagrams [here](https://codacy.slite.com/app/docs/AeaKyDY7-G1HG0).
18 changes: 18 additions & 0 deletions .do/doc/diagrams/Makefile
Original file line number Diff line number Diff line change
@@ -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

Binary file added .do/doc/diagrams/out/do.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions .do/doc/diagrams/src/do.py
Original file line number Diff line number Diff line change
@@ -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")