% Architekturdiagramm der GitLab-Omnibus-Komponenten
% Einbinden im Hauptdokument:
%   \usepackage{tikz}
%   \usetikzlibrary{positioning,arrows.meta,fit,backgrounds}
% und an der gewünschten Stelle:
%   \input{diagrams/omnibus_arch}

\begin{figure}[H]
	\centering
	\resizebox{\columnwidth}{!}{%
	\begin{tikzpicture}[
		node distance=8mm and 9mm,
		font=\footnotesize\sffamily,
		every node/.style={align=center},
		comp/.style={draw, rounded corners=2pt, minimum height=9mm, minimum width=24mm, fill=blue!5},
		store/.style={draw, rounded corners=2pt, minimum height=9mm, minimum width=24mm, fill=green!8},
		ext/.style={draw, dashed, rounded corners=2pt, minimum height=9mm, minimum width=24mm, fill=gray!5},
		arr/.style={-{Stealth[length=2mm]}, thick},
		extarr/.style={-{Stealth[length=2mm]}, thick, dashed},
		]

		% Eingangsebene
		\node[comp] (nginx) {nginx\\(Reverse Proxy)};
		\node[comp, above=of nginx] (browser) {Browser /\\git-Client};
		\node[comp, left=of nginx] (registry) {Container\\Registry};
		\node[ext, right=of nginx] (runner) {GitLab Runner\\(extern)};

		% Anwendungsebene
		\node[comp, below=of nginx] (puma) {Puma\\(Rails-App)};
		\node[comp, right=of puma] (sidekiq) {Sidekiq\\(Hintergrundjobs)};
		\node[ext, right=of sidekiq] (mail) {SMTP-Server\\(extern)};

		% Datenebene
		\node[store, below=of puma] (gitaly) {Gitaly\\(Repositorien)};
		\node[store, right=of gitaly] (pg) {PostgreSQL\\(Daten)};
		\node[store, right=of pg] (redis) {Redis\\(Cache, Queue)};

		% Web-Anfragen
		\draw[arr] (browser) -- (nginx);
		\draw[arr] (nginx) -- (registry);
		\draw[arr] (nginx) -- (puma);
		\draw[extarr] (runner) -- (nginx);

		% Anwendungsebene -> Datenebene
		\draw[arr] (puma) -- (gitaly);
		\draw[arr] (puma) -- (pg);
		\draw[arr] (sidekiq) -- (pg);
		\draw[arr] (sidekiq) -- (redis);
		\draw[arr] (puma.south east) -- (redis.north west);

		% Hintergrundjobs -> externer Mailversand
		\draw[extarr] (sidekiq) -- (mail);

	\end{tikzpicture}%
	}
	\caption{Komponenten einer Self-Managed-Instanz im Omnibus-Paket. Durchgezogen die im Paket enthaltenen Dienste, gestrichelt die extern angebundenen Komponenten (Runner, Mailversand).}
	\label{fig:omnibus-arch}
\end{figure}
