Archyno
UMLDiagramy struktury

Příklady diagramů nasazení

Tři diagramy nasazení systémů, které znáte - třívrstvá webová aplikace, Kubernetes klastr a pool za load balancerem - vždy s odůvodněním, co bylo nakresleno a co záměrně vynecháno.

8 min čteníUML 2.5.122 z 35

HTTPSHTTP/8080TCP/5432«deploy»«deploy»«deploy»web-ui.tar.gzorders.jarschema.sql«device»Browser«execution environment»nginx«execution environment»app-01«device»postgres
The three-tier stack: four nodes, three protocols, three artifacts. Most first deployment diagrams are this diagram with different names.

01Example 1: a three-tier web application

The diagram above is the one worth being able to draw from memory. A browser, a web server terminating TLS, an application server, a database. Three communication paths carrying the protocol and port, and three artifacts dropped onto the nodes that run them.

Two decisions in it are worth naming. First, the protocol labels are the reason the diagram is useful: HTTPS, HTTP/8080, TCP/5432 is the entire content of most security reviews, and a diagram without them is four boxes anybody could have guessed. Second, the artifacts are real filenames - orders.jar, not “application” - because a deployment diagram is about physical things, and a build produces files with names.

02Example 2: a Kubernetes cluster

Containers make people hesitate, because a container is both a thing that runs and a thing that was built. UML already separates those: the running container is an execution environment, which is a node, and the image it started from is an artifact, which is deployed onto it.

HTTPSHTTP/8080TCP/5432«deploy»«deploy»«deploy»ingress.yamlorders:1.4.2schema.sql«device»ALB«execution environment»ingress-nginx«execution environment»orders pod«device»orders-db

Nothing about the shape of this diagram differs from the three-tier one, which is the point: the runtime changed and the notation did not. The load balancer is a «device» because it is infrastructure you do not deploy into. The ingress controller and the pod are «execution environment» because other things run inside them. The image tag orders:1.4.2is an artifact because a build produced it, and putting the version in the label is what makes the diagram answer “what is running in production right now”.

The managed database sits at the edge as a plain device. That is the honest drawing: you do not deploy artifacts onto a service somebody else operates, and pretending the schema is installed “onto RDS” is only true in the sense that it was applied there once.

03Example 3: a load-balanced pool

The commonest reason anyone opens a deployment diagram is to find out what happens when one box dies. That question has a shape, and it is worth drawing explicitly rather than leaving it to a footnote.

«device»haproxy«execution environment»app-01«execution environment»app-02«execution environment»app-03«device»db-primary

Three application nodes behind one load balancer, all writing to a single primary. Drawn this way, the single point of failure is visible without anybody having to say it: the app tier fans out and the data tier does not. That is a sentence somebody will act on, and it took no extra notation to make.

When the count varies at runtime, replace the three nodes with one carrying a multiplicity - app-node [3..*] - rather than drawing an arbitrary number. A diagram that claims exactly three is false the first time the group scales, and a diagram known to be false stops being consulted.

04What to leave off

Every deployment diagram that becomes useless does so the same way: somebody kept adding nodes. The discipline is deciding what the diagram is for before the second box goes down.

Reach for it when

  • Protocols and ports on every communication path - it is the content of most reviews.
  • Real artifact names with versions, so the diagram answers what is running now.
  • One representative instance per role, with a multiplicity when the count varies.
  • Managed services as plain devices at the edge, with the boundary of what you operate visible.

Reach for something else when

  • Logical layers - they have no address and nothing is deployed onto them.
  • Every microservice in a large estate. Draw one subsystem per diagram instead.
  • Monitoring, logging and CI agents, unless the diagram is about them.
  • Live instance counts, which are wrong by the time the diagram is reviewed.

If you need the counterpart that shows the software rather than the machines, that is a component diagram. The two are usually drawn as a pair, and the deployment one is the shorter of them.

05What to remember

In one line each

  1. 01Four nodes, labelled protocols and named artifacts is already a complete deployment diagram.
  2. 02A running container is a node; the image it started from is an artifact. Confusing the two is the usual container mistake.
  3. 03Protocol and port labels are what make the diagram worth opening in a review.
  4. 04Draw one instance per role and use a multiplicity when the count varies at runtime.
  5. 05If a box cannot be pinged, it does not belong on this diagram.

06Časté dotazy

Jaký je jednoduchý příklad diagramu nasazení?

Prohlížeč se připojuje na webový server, ten na aplikační server a ten na databázi, přičemž na každém je nasazen jeden artefakt. Čtyři uzly, tři komunikační cesty označené protokolem a tři šipky nasazení jsou úplný a užitečný diagram.

Jak nakreslit diagram nasazení pro Kubernetes?

Běhové části klastru modelujte jako uzly a obrazy jako artefakty. Load balancer je zařízení, ingress kontrolér a každý pod jsou běhová prostředí a obraz kontejneru je artefakt nasazený na pod. Spravované služby jako hostovaná databáze zůstávají zařízeními na okraji diagramu.

Jsou kontejnery v UML uzly, nebo artefakty?

Obojí, podle toho, který kontejner máte na mysli. Běžící kontejner je běhové prostředí, tedy uzel, protože v něm běží něco dalšího. Obraz, ze kterého byl spuštěn, je artefakt, protože je to soubor z buildu. Kreslit obraz jako uzel je nejčastější chyba kontejnerového diagramu.

Jak zobrazit redundanci na diagramu nasazení?

Buď nakreslete jednotlivé instance, což je poctivé, ale nefunguje nad čtyři, nebo nakreslete jeden uzel s násobností v rohu, například app-node s 3..*. Druhou možnost použijte, když se počet mění za běhu - diagram tvrdící přesně tři je špatně hned po prvním autoškálování.

Kolik detailu patří na diagram nasazení?

Tolik, aby odpověděl na otázku, kvůli které vznikl. Infrastrukturní přehled chce protokoly a porty na komunikačních cestách; onboardingový diagram chce čtyři boxy a nic víc. Každý další uzel je tvrzení, které musí někdo po další migraci udržet pravdivé.

Všechny články