\subsection*{Issue}

For Elektra Web, there needs to be a way to remotely manage instances and groups of instances (clusters). The remote configuration of a single instance is simple. However, to manage multiple instances, we need to store the information to access the daemons, as well as information about the grouping (clusters) of daemons.

\subsection*{Constraints}


\begin{DoxyItemize}
\item We need to be able to manage single, as well as multiple instances.
\item We need to be able to group instances and manage them together.
\end{DoxyItemize}

\subsection*{Assumptions}

\subsection*{Considered Alternatives}


\begin{DoxyItemize}
\item Accessing the elektrad daemons directly
\item Using a separate daemon (clusterd) to manage multiple instances
\begin{DoxyItemize}
\item Using one of these daemons for each cluster
\item Using one daemon for all clusters
\end{DoxyItemize}
\end{DoxyItemize}

\subsection*{Decision}

Use one cluster daemon (clusterd) to manage all clusters and instances.

\subsection*{Argument}

Accessing the elektrad daemons directly would require us to store all the information in the client, which is not a good idea if we want to be able to switch machines and still be able to access all data. Thus, there should be a single point of entry that the client connects to.

Using a daemon for each cluster would make it harder to create new clusters, because the user would have to manually set up a new daemon for each cluster. Another problem with this approach is that we still don\textquotesingle{}t have a single point of entry, so we would have to store information to connect to the daemons on the client.

Using one daemon to manage all instances and clusters is the easiest solution, that way the client simply connects to that daemon, which forwards requests to single instances or multiple instances at once. In this case, the cluster daemon can also serve the client, further simplifying the whole structure, because we don\textquotesingle{}t need to host the client on a separate web server.

Another advantage of this solution is that both clusterd and elektrad are using nodejs, which means that a wrapper script can set up and start both daemons easily.

There are still some other issues, like possible conflicts when adding an instance multiple times, or assigning an instance to multiple clusters. The cluster daemon should prevent adding the same instance twice. It also won\textquotesingle{}t be possible to add an instance to two clusters. If an instance is part of a cluster, single instances can still be configured, but all configuration options that are set in the cluster cannot be modified.

\subsection*{Implications}


\begin{DoxyItemize}
\item There needs to be a single point of entry for the web client to connect to.
\end{DoxyItemize}

\subsection*{Related decisions}


\begin{DoxyItemize}
\item \hyperlink{doc_decisions_elektra_web_recursive_md}{Elektra Web Recursive Structure decision}
\end{DoxyItemize}

\subsection*{Notes}


\begin{DoxyItemize}
\item \href{https://github.com/ElektraInitiative/libelektra/pull/1173}{\tt Discussion in the pull request} 
\end{DoxyItemize}