-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path3_Internal_Programming_Workflows.tex
261 lines (195 loc) · 8.65 KB
/
3_Internal_Programming_Workflows.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
\chapter{Internal Programming Workflows}
\section{Sent calls}
\section{Add, edit, delete User}
\subsection*{Show current users}
\begin{enumerate}
\item Get current status via \texttt{GET /users} on Core URL
\item Handle updates via Websocket
\end{enumerate}
\subsection*{Add and Edit User}
\begin{enumerate}
\item If edit: Get current status via \texttt{GET /users/<username>} on Core URL
\item Show edit form and place data
\item On save button event, send \texttt{POST /users/<username>} on Core URL
\end{enumerate}
The core will update the CouchDB and generate a RabbitMQ administration message
to inform all other nodes. This information is transmitted by the Stats and
Websocket Micro-Service to all connected websocket clients to get them updated.
This will also happen for the website instance emitting the edit request, so its
content is also updated.
\subsection*{Delete User}
\begin{enumerate}
\item Ask "Are you sure?"
\item If yes, send \texttt{DELETE /users/<username>} on Core URL
\end{enumerate}
The core will update the CouchDB and generate a RabbitMQ administration message
to inform all other nodes. This information is transmitted by the Stats and
Websocket Micro-Service to all connected websocket clients to get them updated.
This will also happen for the website instance emitting the edit request, so its
content is also updated.
\section{Add, edit, delete Subscriber}
\section{Add, edit, delete Node (tbd)}
\section{Add, edit, delete Transmitter}
\section{Implementation of Transmitter Groups}
\section{Add, edit, delete Rubrics}
\textbf{Show current configuration}
\begin{enumerate}
\item Get current status via \texttt{GET /rubrics} on Core URL
\item Handle updates via websocket
\end{enumerate}
\textbf{Add and Edit rubrics}
\begin{enumerate}
\item If edit: Get current status via \texttt{GET /rubrics/<rubricname>} on Core URL
\item Show edit form and place data
\item On save button event, send \texttt{POST /users/<rubricname>} on Core URL
\end{enumerate}
The core will update the CouchDB and generate a RabbitMQ administration message
to inform all other nodes. This information is transmitted by the Stats and
Websocket Micro-Service to all connected websocket clients to get them updated.
This will also happen for the website instance emitting the edit request, so its
content is also updated.
\textbf{Delete rubric}
\begin{enumerate}
\item Ask "Are you sure?"
\item If yes, send \texttt{DELETE /users/<rubricname>} on Core URL
\end{enumerate}
The core will update the CouchDB and generate a RabbitMQ administration message
to inform all other nodes. This information is transmitted by the Stats and
Websocket Micro-Service to all connected websocket clients to get them updated.
This will also happen for the website instance emitting the edit request, so its
content is also updated.
\section{Add, edit, delete Rubrics content}
\section{Add, edit, delete, assign Rubrics to Transmitter/-Groups}
\section{Docker integration}
\label{internalprog:docker}
\todo{DL2IC: Docker Integration beschreiben}
\section{Microservices}
\label{internalprog:microservices}
A DAPNET node consists of serveral isolated microservices with different
responsibilities. Each microservice runs in a container and is automatically
restarted if it should crash. Some microservices can be started in multiple
instances to fully utilize multiple cores.
\subsection{Overview of Microservices}
\label{internalprog:microservices:overview}
\subsubsection{Database Service}
\label{internalprog:microservices:overview:database}
\subsubsection{Rubric Service}
\label{internalprog:microservices:overview:rubric}
\subsubsection{Call Service}
\label{internalprog:microservices:call}
\subsubsection{Transmitter Service}
\label{internalprog:microservices:transmitter}
\subsubsection{Cluster Service}
\label{internalprog:microservices:overview:cluster}
\subsubsection{Telemetry Service}
\label{internalprog:microservices:overview:telemetry}
\subsubsection{Database Changes Service}
\label{internalprog:microservices:overview:databasechanges}
\subsubsection{Status Service}
\label{internalprog:microservices:overview:status}
\subsubsection{Statistics Service}
\label{internalprog:microservices:overview:statistics}
\subsubsection{RabbitMQ Auth Service}
\label{internalprog:microservices:overview:rabbitmqauth}
\subsubsection{Backward Compatibility Service}
\label{internalprog:microservices:overview:backwardcompatibility}
\subsubsection{Coverage Service}
\label{internalprog:microservices:overview:coverage}
\subsection{REST Interfaces}
The access to the microservices is proxied by a NGINX webserver which can also provide load balancing and caching.
\begin{center}
\begin{tabular}{|l|l|} \hline
REST endpoint & Microservice \\ \hline \hline
\verb|* /users/*| & Database Service \\
\verb|* /nodes/*| & \\
\verb|* /rubrics/*| & \\
\verb|* /subscribers/*| & \\
\verb|* /subscriber_group(s)/*| & \\
\verb|GET /transmitter/grouptags | & \\
\verb|DELETE /transmitter/<transmittername>| & \\
\verb|PUT /transmitter/<transmittername>| & \\ \hline
\verb|* /calls/*| & Call Service \\ \hline
\verb|* /rubrics/content/*| & Rubric Service \\ \hline
\verb|GET /transmitters| & Transmitter Service \\
\verb|GET /transmitters/:id| & \\
\verb|POST /transmitters/bootstrap| & \\
\verb|POST /transmitters/heartbeat| & \\ \hline
\verb|POST /cluster/discovery| & Cluster Service \\ \hline
\verb|GET /telemetry/*| & Telemetry Service \\ \hline
\verb|WS /telemetry/transmitters| & Summary data of all TX\\
\verb|WS /telemetry/transmitter/<TxName>| & Details for TX <TxName>\\
\verb|WS /telemetry/nodes| & Summary data of all nodes\\
\verb|WS /telemetry/node/<NodeName>| & Details for Node <NodeName>\\ \hline
\verb|WS /changes| & Database Changes Service \\ \hline
\verb|GET /status/*| & Status Service \\ \hline
\verb|GET /statistics| & Statistics Service \\ \hline
\verb|GET /rabbitmq/*| & RabbitMQ Auth Service \\ \hline
\end{tabular}
\end{center}
\subsection{Database Service}
\begin{itemize}
\item Proxies calls to the CouchDB database
\item Controls access to different database actions
\item Removes private/admin only fields from documents
\end{itemize}
\subsection{Call Service}
\begin{itemize}
\item Generates and publishes calls to RabbitMQ
\item Receives all calls from RabbitMQ
\item Maintains a database of all calls
\end{itemize}
The
\subsection{Rubric Service}
\begin{itemize}
\item Publishes rubric content as calls to RabbitMQ
\item Periodically publishes rubric names as calls to RabbitMQ
\end{itemize}
\subsection{Transmitter Service}
\begin{itemize}
\item Maintains a list of all transmitters and their current status
\end{itemize}
\subsection{Cluster Service}
\begin{itemize}
\item Maintains a list of known nodes and their current status
\item Manages federation between RabbitMQ queues
\item Manages replication between CouchDB databases
\end{itemize}
\subsection{Telemetry Service}
\begin{itemize}
\item Maintains the telemetry state of all transmitters
\item Forwards telemetry updates via websocket
\end{itemize}
\subsection{Database Changes Service}
\begin{itemize}
\item Forwards database changes via websocket
\end{itemize}
\subsection{Status Service}
\begin{itemize}
\item Periodically checks all other services and connections
\end{itemize}
\subsection{RabbitMQ Auth Service}
\begin{itemize}
\item Provides authentication for RabbitMQ against the CouchDB users database
\end{itemize}
\subsection{Time and Identification Service}
\begin{itemize}
\item Sends periodic time and identification messages to RabbitMQ
\end{itemize}
\section{Ports and Loadbalacing Concept}
\section{Periodic Tasks (Scheduler)}
\section{Plugin Interface}
\section{Transmitter Connection}
Transmitter connections consist of two connections to a Node. A REST connection
for initial announcement of a new transmitter, heartbeat messages and
transmitter configuration and a RabbitMQ connection to receive the data to be
transmitted.
The workflow for a new transmitter connection is the following:
\begin{enumerate}
\item Announce the transmitter via a call to the REST API at \texttt{/transmitter/\_bootstrap} (\ref{protcoldef:transmitters:bootstrap}).
\item The response contains either the transmitter configuration or an error message (\ref{protcoldef:transmitters:bootstrap}).
\item On success, initiate the RabbitMQ connection to receive calls and send telemetry (\ref{protocoldef:RabbitMQ}).
\end{enumerate}
After the connection has been established, a periodical heartbeat must be sent
to the REST API at \texttt{/transmitter/\_heartbeat}
(\ref{protocoldef:transmitters:heartbeat}).
\section{DAPNET-Proxy}