This repo contains some demo code to demonstrate the Diagrams as Code tool 'diagram'
Our goal here is to add our diagrams to our source repository for two main reasons;
- Source of truth
- We naturally get an audit log from git
Most of the code has been obtained from a great blog post by Dylan Roy, Create Beautiful Architecture Diagrams with Python, so all credits go to him.
This demo shows the steps involved to create a diagram using code.
This will simply render a blank diagram with the designated label.
python3 demo1.py
Now that we have our workspace it’s time to add the nodes that we need for our website. Each one of our nodes are pictured, and these are the “ingredients” for the architecture we want to build. The next steps will be to organise some of our nodes into logical groupings, and then link each of the nodes with edges.
python3 demo2.py
For this example we will just group the load balanced web servers. In a good number of the diagrams I have created in the past this was not always necessary, but as your architecture grows grouping these nodes within clusters usually enhances readability.
python3 demo3.py