Hacker News new | ask | show | jobs
by karlicoss 2223 days ago
Nice! I did something similar for my personal infrastructure map [0]. I tried different tools, and each of them was too limited so landed on graphviz + a python DSL [1] to generate the diagram.

It turned out to be extremely convenient:

- python makes it easy to spot errors/typos (you can use mypy even before running the genrator)

- keyword arguments and dictionaries map naturally to node/edge properties

- you can reuse boilerplate by using functions, variables and control structures

- you can always inject graphviz string directly as a last resort hacking measure

- thanks to python's dynamic features, you can even give the nodes/clusters same names as their corresponding python objects, which results in less boilerplate and makes easy to debug

[0] https://beepb00p.xyz/myinfra.html

[1] https://github.com/karlicoss/myinfra/blob/master/generate.py

2 comments

When needing to do something similar (with our pseudo-microservice project's increasingly incomprehensible JSON logs) I also wanted the diagram to be interactive so it's possible to "dig" when showing larger amounts of data, so I learned d3.js and was very pleasantly surprised by the power of the abstraction it introduces, despite the unavoidable javascript.

https://github.com/alphagov/digitalmarketplace-logdia

(ended up having to turn it into a custom WebExtension just so it could integrate "easily" with kibana by monkeypatching & intercepting its xhr requests, let's not get into that...)

Wow... I'm really enjoying reading about promnesia, roam integration, etc. Thanks for sharing.