From ffa527c9df754067150e60074698c19311e1f0c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= <anarcat@debian.org>
Date: Mon, 9 Nov 2020 15:23:16 -0500
Subject: [PATCH] add architecture diagram

---
 howto/static-component.md               |   2 +-
 howto/static-component/Makefile         |  11 ++
 howto/static-component/architecture.dot |  28 +++++
 howto/static-component/architecture.svg | 156 ++++++++++++++++++++++++
 4 files changed, 196 insertions(+), 1 deletion(-)
 create mode 100644 howto/static-component/Makefile
 create mode 100644 howto/static-component/architecture.dot
 create mode 100644 howto/static-component/architecture.svg

diff --git a/howto/static-component.md b/howto/static-component.md
index 558d6426..85fd8d50 100644
--- a/howto/static-component.md
+++ b/howto/static-component.md
@@ -189,7 +189,7 @@ hosts. Those components are defined in a YAML file in the
 (`modules/roles/misc/static-components.yaml` at the time of writing,
 but it might move to Hiera, see [issue 30020](https://gitlab.torproject.org/tpo/tpa/team/-/issues/30020) and [puppet](puppet)).
 
-TODO: make a diagram?
+![LDAP architecture diagram](static-component/architecture.svg)
 
 <!-- this is a rephrased copy of -->
 <!-- https://salsa.debian.org/dsa-team/mirror/dsa-puppet/-/blob/master/modules/roles/README.static-mirroring.txt -->
diff --git a/howto/static-component/Makefile b/howto/static-component/Makefile
new file mode 100644
index 00000000..c1f40928
--- /dev/null
+++ b/howto/static-component/Makefile
@@ -0,0 +1,11 @@
+FILES=architecture.svg
+
+.PHONY: all
+all: $(FILES)
+
+%.svg: %.dot
+	dot -Tsvg $< > $@
+
+.PHONY: clean
+clean:
+	rm -f $(FILES)
diff --git a/howto/static-component/architecture.dot b/howto/static-component/architecture.dot
new file mode 100644
index 00000000..760420cd
--- /dev/null
+++ b/howto/static-component/architecture.dot
@@ -0,0 +1,28 @@
+digraph static {
+        label="static site mirror system architecture, torproject.org, november 2020"
+        node [shape=record]
+        subgraph "clusterhosts" {
+                label="hosts"
+                labelloc=bottom
+
+                source [ label="<host> source | { <update> static-update-component }"]
+                master [ label="<host> master | { <update> static-master-update-component | <run> static-master-run }" ]
+                mirror [ label="<host> mirror | { <run> static-mirror-run }" ]
+                source:update -> master:update [taillabel="runs"]
+                master:update -> source:host [label="rsync from"]
+                master:update -> master:run [label="runs"]
+                master:run -> mirror:run [taillabel="runs"]
+                mirror:run -> master:host [label="rsync from"]
+                note [shape="note" label="note:\nthere can be many\n source, master\nand mirror hosts"]
+        }
+        subgraph "clusterusers" {
+                label="users"
+                labelloc=bottom
+                TPA
+                users
+        }
+        TPA -> puppet -> source:host
+        puppet -> master:host
+        puppet -> mirror:host
+        users -> sudo -> source:update
+}
diff --git a/howto/static-component/architecture.svg b/howto/static-component/architecture.svg
new file mode 100644
index 00000000..0e36e4cd
--- /dev/null
+++ b/howto/static-component/architecture.svg
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: static Pages: 1 -->
+<svg width="442pt" height="585pt"
+ viewBox="0.00 0.00 442.00 585.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 581)">
+<title>static</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-581 438,-581 438,4 -4,4"/>
+<text text-anchor="middle" x="217" y="-7.8" font-family="Times,serif" font-size="14.00" fill="#000000">static site mirror system architecture, torproject.org, november 2020</text>
+<g id="clust1" class="cluster">
+<title>clusterhosts</title>
+<polygon fill="none" stroke="#000000" points="8,-31 8,-400 376,-400 376,-31 8,-31"/>
+<text text-anchor="middle" x="192" y="-38.8" font-family="Times,serif" font-size="14.00" fill="#000000">hosts</text>
+</g>
+<g id="clust2" class="cluster">
+<title>clusterusers</title>
+<polygon fill="none" stroke="#000000" points="278,-493 278,-569 420,-569 420,-493 278,-493"/>
+<text text-anchor="middle" x="349" y="-500.8" font-family="Times,serif" font-size="14.00" fill="#000000">users</text>
+</g>
+<!-- source -->
+<g id="node1" class="node">
+<title>source</title>
+<polygon fill="none" stroke="#000000" points="156,-340 156,-376 368,-376 368,-340 156,-340"/>
+<text text-anchor="middle" x="183" y="-354.3" font-family="Times,serif" font-size="14.00" fill="#000000">source</text>
+<polyline fill="none" stroke="#000000" points="210,-340 210,-376 "/>
+<text text-anchor="middle" x="289" y="-354.3" font-family="Times,serif" font-size="14.00" fill="#000000">static&#45;update&#45;component</text>
+</g>
+<!-- master -->
+<g id="node2" class="node">
+<title>master</title>
+<polygon fill="none" stroke="#000000" points="72,-188.5 72,-234.5 326,-234.5 326,-188.5 72,-188.5"/>
+<text text-anchor="middle" x="99" y="-207.8" font-family="Times,serif" font-size="14.00" fill="#000000">master</text>
+<polyline fill="none" stroke="#000000" points="126,-188.5 126,-234.5 "/>
+<text text-anchor="middle" x="226" y="-219.3" font-family="Times,serif" font-size="14.00" fill="#000000">static&#45;master&#45;update&#45;component</text>
+<polyline fill="none" stroke="#000000" points="126,-211.5 326,-211.5 "/>
+<text text-anchor="middle" x="226" y="-196.3" font-family="Times,serif" font-size="14.00" fill="#000000">static&#45;master&#45;run</text>
+</g>
+<!-- source&#45;&gt;master -->
+<g id="edge1" class="edge">
+<title>source:update&#45;&gt;master:update</title>
+<path fill="none" stroke="#000000" d="M289,-340C289,-306.4069 273.9374,-300.4033 256,-272 246.7402,-257.3373 232.7229,-255.8359 227.7919,-244.34"/>
+<polygon fill="#000000" stroke="#000000" points="231.2351,-243.7111 226,-234.5 224.3483,-244.9653 231.2351,-243.7111"/>
+<text text-anchor="middle" x="277" y="-328.8" font-family="Times,serif" font-size="14.00" fill="#000000">runs</text>
+</g>
+<!-- master&#45;&gt;source -->
+<g id="edge2" class="edge">
+<title>master:update&#45;&gt;source:host</title>
+<path fill="none" stroke="#000000" d="M226,-234.5C226,-257.9136 198.8316,-250.7506 189,-272 177.8028,-296.2009 181.6533,-306.9529 182.7501,-329.8006"/>
+<polygon fill="#000000" stroke="#000000" points="179.256,-330.0888 183,-340 186.2539,-329.9172 179.256,-330.0888"/>
+<text text-anchor="middle" x="220.5" y="-275.8" font-family="Times,serif" font-size="14.00" fill="#000000">rsync from</text>
+</g>
+<!-- master&#45;&gt;master -->
+<g id="edge3" class="edge">
+<title>master:update&#45;&gt;master:run</title>
+<path fill="none" stroke="#000000" d="M326.3669,-226.3682C337.1966,-223.3652 344,-218.5313 344,-211.5 344,-206.8857 341.07,-203.2178 335.995,-200.3926"/>
+<polygon fill="#000000" stroke="#000000" points="336.955,-197.0101 326.3669,-196.6318 334.4081,-203.5304 336.955,-197.0101"/>
+<text text-anchor="middle" x="356" y="-207.8" font-family="Times,serif" font-size="14.00" fill="#000000">runs</text>
+</g>
+<!-- mirror -->
+<g id="node3" class="node">
+<title>mirror</title>
+<polygon fill="none" stroke="#000000" points="117.5,-62.5 117.5,-98.5 280.5,-98.5 280.5,-62.5 117.5,-62.5"/>
+<text text-anchor="middle" x="144" y="-76.8" font-family="Times,serif" font-size="14.00" fill="#000000">mirror</text>
+<polyline fill="none" stroke="#000000" points="170.5,-62.5 170.5,-98.5 "/>
+<text text-anchor="middle" x="225.5" y="-76.8" font-family="Times,serif" font-size="14.00" fill="#000000">static&#45;mirror&#45;run</text>
+</g>
+<!-- master&#45;&gt;mirror -->
+<g id="edge4" class="edge">
+<title>master:run&#45;&gt;mirror:run</title>
+<path fill="none" stroke="#000000" d="M226,-188.5C226,-152.0938 226,-140.539 226,-108.5983"/>
+<polygon fill="#000000" stroke="#000000" points="229.5001,-108.5 226,-98.5 222.5001,-108.5 229.5001,-108.5"/>
+<text text-anchor="middle" x="214" y="-177.3" font-family="Times,serif" font-size="14.00" fill="#000000">runs</text>
+</g>
+<!-- mirror&#45;&gt;master -->
+<g id="edge5" class="edge">
+<title>mirror:run&#45;&gt;master:host</title>
+<path fill="none" stroke="#000000" d="M226,-98.5C226,-132.6247 186.8811,-116.3241 159,-136 133.1027,-154.2759 105.5261,-153.5112 99.9973,-178.5098"/>
+<polygon fill="#000000" stroke="#000000" points="96.5107,-178.2018 99,-188.5 103.4761,-178.8971 96.5107,-178.2018"/>
+<text text-anchor="middle" x="190.5" y="-139.8" font-family="Times,serif" font-size="14.00" fill="#000000">rsync from</text>
+</g>
+<!-- note -->
+<g id="node4" class="node">
+<title>note</title>
+<polygon fill="none" stroke="#000000" points="131.5,-392 16.5,-392 16.5,-324 137.5,-324 137.5,-386 131.5,-392"/>
+<polyline fill="none" stroke="#000000" points="131.5,-392 131.5,-386 "/>
+<polyline fill="none" stroke="#000000" points="137.5,-386 131.5,-386 "/>
+<text text-anchor="middle" x="77" y="-376.8" font-family="Times,serif" font-size="14.00" fill="#000000">note:</text>
+<text text-anchor="middle" x="77" y="-361.8" font-family="Times,serif" font-size="14.00" fill="#000000">there can be many</text>
+<text text-anchor="middle" x="77" y="-346.8" font-family="Times,serif" font-size="14.00" fill="#000000"> source, master</text>
+<text text-anchor="middle" x="77" y="-331.8" font-family="Times,serif" font-size="14.00" fill="#000000">and mirror hosts</text>
+</g>
+<!-- TPA -->
+<g id="node5" class="node">
+<title>TPA</title>
+<polygon fill="none" stroke="#000000" points="358,-524.5 358,-560.5 412,-560.5 412,-524.5 358,-524.5"/>
+<text text-anchor="middle" x="385" y="-538.8" font-family="Times,serif" font-size="14.00" fill="#000000">TPA</text>
+</g>
+<!-- puppet -->
+<g id="node7" class="node">
+<title>puppet</title>
+<polygon fill="none" stroke="#000000" points="365,-429.5 365,-465.5 419,-465.5 419,-429.5 365,-429.5"/>
+<text text-anchor="middle" x="392" y="-443.8" font-family="Times,serif" font-size="14.00" fill="#000000">puppet</text>
+</g>
+<!-- TPA&#45;&gt;puppet -->
+<g id="edge6" class="edge">
+<title>TPA&#45;&gt;puppet</title>
+<path fill="none" stroke="#000000" d="M386.3497,-524.183C387.3568,-510.5149 388.7518,-491.5833 389.9036,-475.9508"/>
+<polygon fill="#000000" stroke="#000000" points="393.4101,-475.9909 390.6545,-465.7607 386.429,-475.4765 393.4101,-475.9909"/>
+</g>
+<!-- users -->
+<g id="node6" class="node">
+<title>users</title>
+<polygon fill="none" stroke="#000000" points="286,-524.5 286,-560.5 340,-560.5 340,-524.5 286,-524.5"/>
+<text text-anchor="middle" x="313" y="-538.8" font-family="Times,serif" font-size="14.00" fill="#000000">users</text>
+</g>
+<!-- sudo -->
+<g id="node8" class="node">
+<title>sudo</title>
+<polygon fill="none" stroke="#000000" points="284,-429.5 284,-465.5 338,-465.5 338,-429.5 284,-429.5"/>
+<text text-anchor="middle" x="311" y="-443.8" font-family="Times,serif" font-size="14.00" fill="#000000">sudo</text>
+</g>
+<!-- users&#45;&gt;sudo -->
+<g id="edge10" class="edge">
+<title>users&#45;&gt;sudo</title>
+<path fill="none" stroke="#000000" d="M312.6144,-524.183C312.3266,-510.5149 311.9281,-491.5833 311.599,-475.9508"/>
+<polygon fill="#000000" stroke="#000000" points="315.0942,-475.6848 311.3844,-465.7607 308.0958,-475.8322 315.0942,-475.6848"/>
+</g>
+<!-- puppet&#45;&gt;source -->
+<g id="edge7" class="edge">
+<title>puppet&#45;&gt;source:host</title>
+<path fill="none" stroke="#000000" d="M364.7906,-433.8689C348.8041,-426.2002 328.0541,-416.8252 309,-410 257.9139,-391.7011 192.1334,-428.6497 183.8662,-385.9937"/>
+<polygon fill="#000000" stroke="#000000" points="187.3505,-385.6604 183,-376 180.3766,-386.2649 187.3505,-385.6604"/>
+</g>
+<!-- puppet&#45;&gt;master -->
+<g id="edge8" class="edge">
+<title>puppet&#45;&gt;master:host</title>
+<path fill="none" stroke="#000000" d="M394.7284,-429.3223C397.5951,-403.4858 399.0451,-355.7603 377,-324 337.895,-267.6616 305.4292,-273.5483 240,-253 213.501,-244.6779 124.6631,-261.1054 103.5363,-243.7503"/>
+<polygon fill="#000000" stroke="#000000" points="106.5455,-241.9375 99,-234.5 100.2605,-245.0196 106.5455,-241.9375"/>
+</g>
+<!-- puppet&#45;&gt;mirror -->
+<g id="edge9" class="edge">
+<title>puppet&#45;&gt;mirror:host</title>
+<path fill="none" stroke="#000000" d="M406.2193,-429.4564C418.4038,-412.1534 434,-384.7759 434,-358 434,-358 434,-358 434,-143.5 434,-128.9156 201.946,-117.4614 152.9971,-103.5373"/>
+<polygon fill="#000000" stroke="#000000" points="154.4354,-100.3313 144,-98.5 151.0157,-106.4392 154.4354,-100.3313"/>
+</g>
+<!-- sudo&#45;&gt;source -->
+<g id="edge11" class="edge">
+<title>sudo&#45;&gt;source:update</title>
+<path fill="none" stroke="#000000" d="M302.1785,-429.4516C297.1577,-417.8175 291.5062,-401.9746 289.6373,-386.2615"/>
+<polygon fill="#000000" stroke="#000000" points="293.1132,-385.7638 289,-376 286.1267,-386.1977 293.1132,-385.7638"/>
+</g>
+</g>
+</svg>
-- 
GitLab