% Fix for: https://tex.stackexchange.com/a/315027/43228
\RequirePackage{luatex85}
\documentclass[border=10pt,17pt]{standalone}

\usepackage{cfr-lm}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,snakes,automata,backgrounds,petri}

\begin{document}

%% sans-serif fonts, large by default, and bold too
\sffamily
\sbweight
\bfseries
\large

\begin{tikzpicture}[>=stealth',bend angle=45,auto,rounded corners]

  \input{common.tex}

  %% \draw [help lines] (-10,0) grid (10,20);

  \tikzstyle{primary}=[node,text=ptxt,fill=pbox,draw=white]
  \tikzstyle{standby}=[node,text=stxt,fill=sbox,draw=white]

  \node  (p)   at (0,18)   [primary]       {\textbf{Primary}};
  \node  (s)   at (0,12)   [standby]       {\textbf{Secondary}};
  \node  (app) at (-6,15)  [app]           {\textbf{Application}};
  \node  (m)   at (6,15)   [monitor]       {\textbf{Monitor}};

  \path (app.north east) edge [sql,out=90,in=180]   node {SQL} (p)
        (app.south east) edge [sqlf,out=-90,in=180] node[below] {SQL (fallback)} (s)
        (p)   edge [sr]
                                     node[left]   {Streaming}
                                     node [right] {Replication} (s)
        (m)   edge [hc,out=90,in=0]  node[above]  {Health checks}         (p)
              edge [hc,out=-90,in=0] node         {Health checks}         (s);
\end{tikzpicture}

\end{document}
