% 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=6mm and 8mm,
		font=\footnotesize\sffamily,
		every node/.style={align=center},
		comp/.style={draw, rounded corners=2pt, minimum height=8mm, minimum width=20mm, fill=blue!5},
		store/.style={draw, rounded corners=2pt, minimum height=8mm, minimum width=20mm, fill=green!8},
		ext/.style={draw, dashed, rounded corners=2pt, minimum height=8mm, minimum width=20mm, fill=gray!5},
		arr/.style={-{Stealth[length=2mm]}, thick},
		]

		% Ebene 1: Eingang
		\node[comp] (browser) {Browser / git-Client};
		\node[comp, right=of browser] (nginx) {nginx\\(Reverse Proxy)};

		% Ebene 2: Anwendungsschicht
		\node[comp, below=of nginx] (puma) {Puma\\(Rails-App)};
		\node[comp, right=of puma] (sidekiq) {Sidekiq\\(Hintergrundjobs)};

		% Ebene 3: Datenschicht
		\node[store, below=of puma] (pg) {PostgreSQL\\(Daten)};
		\node[store, right=of pg] (redis) {Redis\\(Cache, Queue)};
		\node[store, left=of pg] (gitaly) {Gitaly\\(Repo-Storage)};

		% Ebene 4: Add-Ons
		\node[comp, below=of pg] (registry) {Container\\Registry};
		\node[ext, right=of registry] (runner) {GitLab Runner\\(extern)};
		\node[ext, left=of registry] (mail) {SMTP-Server\\(extern)};

		% Verbindungen
		\draw[arr] (browser) -- (nginx);
		\draw[arr] (nginx) -- (puma);
		\draw[arr] (puma) -- (pg);
		\draw[arr] (puma) -- (redis);
		\draw[arr] (puma.west) to[bend right=20] (gitaly.north);
		\draw[arr] (sidekiq) -- (redis);
		\draw[arr] (sidekiq.south) to[bend left=15] (pg.east);
		\draw[arr] (puma.south) to[bend left=10] (registry.north);
		\draw[arr, dashed] (runner.north) to[bend left=15] (puma.east);
		\draw[arr, dashed] (puma.west) to[bend left=20] (mail.north);

	\end{tikzpicture}%
	}
	\caption{Komponenten einer Self-Managed-Instanz im Omnibus-Paket. Gestrichelte Komponenten laufen ausserhalb des Omnibus-Pakets und werden separat angebunden.}
	\label{fig:omnibus-arch}
\end{figure}
