@@ -179,6 +179,211 @@ important are:
179
179
When creating a ` .secrets.yaml` file, ensure that the file is never shared
180
180
or committed to a code repository!
181
181
182
+ # #### Notes for deployment with microk8s
183
+
184
+ This section outlines how to install TESK via [microk8s](https://microk8s.io/),
185
+ as tested on an Ubuntu 22.04 machine.
186
+
187
+ First, install microk8s through the Snap Store and add yourself to the
188
+ ` microk8s` group::
189
+
190
+ ` ` ` bash
191
+ sudo snap install microk8s --classic
192
+ sudo usermod -a -G microk8s $USER
193
+ ` ` `
194
+
195
+ Now let' s create a directory for the microk8s configuration and enable Helm:
196
+
197
+ ```bash
198
+ mkdir ~/.kube
199
+ sudo chown -R $USER ~/.kube
200
+ microk8s enable helm3
201
+ ```
202
+
203
+ Next, let' s clone the TESK repository and move into it the Helm chart directory:
204
+
205
+ ` ` ` bash
206
+ git clone https://github.com/elixir-cloud-aai/TESK.git
207
+ cd TESK/charts/tesk
208
+ ` ` `
209
+
210
+ Follow the deployment instructions to create ` secrets.yaml` and modify
211
+ ` values.yaml` as per your requirements.
212
+
213
+ > You ** MUST** set ` host_name` . To make the service available through the
214
+ > internet, see further below on how to configure the ` service` section.
215
+
216
+ Great - you are now ready to deploy TESK!
217
+
218
+ First, let' s create a namespace:
219
+
220
+ ```bash
221
+ microk8s kubectl create namespace NAMESPACE
222
+ ```
223
+
224
+ where `NAMESPACE` is an arbitrary name for your resource group.
225
+
226
+ Now let' s use Helm to install:
227
+
228
+ ` ` ` bash
229
+ microk8s helm3 install -n NAMESPACE RELEASE_NAME . -f secrets.yaml -f values.yaml
230
+ ` ` `
231
+
232
+ where ` RELEASE_NAME` is an arbitrary name for this particular TESK release.
233
+
234
+ Congratulations - TESK should now be successfully deployed!
235
+
236
+ To find out the IP address at which TESK is available, run the following
237
+ command:
238
+
239
+ ` ` ` bash
240
+ microk8s kubectl get svc -n NAMESPACE
241
+ ` ` `
242
+
243
+ The output could look something like this:
244
+
245
+ ` ` ` console
246
+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
247
+ tesk-api ClusterIP 123.123.123.123 < none> 8080/TCP 8s
248
+ ` ` `
249
+
250
+ Use the ` CLUSTER-IP` and the ` PORT` with the following template to construct the
251
+ URL at which the service is available (and make sure to replace the dummy URL
252
+ when you want to try out the calls below):
253
+
254
+ ` ` ` console
255
+ http://CLUSTER-IP:PORT/ga4gh/tes/v1
256
+ ` ` `
257
+
258
+ So, in this example case, we get the following URL:
259
+
260
+ ` ` ` console
261
+ http://123.123.123.123:8080/ga4gh/tes/v1
262
+ ` ` `
263
+
264
+ You can now test the intallation with the following example call to get a list
265
+ of tasks:
266
+
267
+ ` ` ` bash
268
+ curl http://123.123.123.123:8080/ga4gh/tes/v1/tasks
269
+ ` ` `
270
+
271
+ If everything worked well, you should get an output like this:
272
+
273
+ ` ` ` json
274
+ {
275
+ " tasks" : []
276
+ }
277
+ ` ` `
278
+
279
+ Let' s try to send a small task to TESK:
280
+
281
+ ```console
282
+ curl \
283
+ -H "Accept: application/json" \
284
+ -H "Content-Type: application/json" \
285
+ -X POST \
286
+ --data ' {" executors" : [ { " command" : [ " echo" , " TESK says: Hello World" ], " image" : " alpine" } ]}' \
287
+ "http://123.123.123.123:8080/ga4gh/tes/v1/tasks"
288
+ ```
289
+
290
+ That should give you a task ID:
291
+
292
+ ```json
293
+ {
294
+ "id" : "task-123ab456"
295
+ }
296
+ ```
297
+
298
+ You can run the task list command from before again. Now the response should not
299
+ be an empty list anymore. Rather, you should see something like this:
300
+
301
+ ```json
302
+ {
303
+ "tasks" : [ {
304
+ "id" : "task-123ab456",
305
+ "state" : "COMPLETE"
306
+ } ]
307
+ }
308
+ ```
309
+
310
+ To get more details on your task, use the task ID from before in a call like
311
+ this:
312
+
313
+ ```bash
314
+ curl http://123.123.123.123:8080/ga4gh/tes/v1/tasks/TASK_ID?view=FULL
315
+ ```
316
+
317
+ We can use `jq` to parse the results. Let' s say we want to see the logs of the
318
+ first (only, in this case) TES executor, we could do something like this:
319
+
320
+ ` ` ` console
321
+ $curl -s http://123.123.123.123:8080/ga4gh/tes/v1/tasks/task-123ab456? view=FULL | jq ' .logs[0].logs'
322
+ ` ` `
323
+
324
+ Which would give us an output like this:
325
+
326
+ ` ` ` json
327
+ [
328
+ {
329
+ " start_time" : " 2023-11-01T14:54:20.000Z" ,
330
+ " end_time" : " 2023-11-01T14:54:25.000Z" ,
331
+ " stdout" : " TESK says: Hello World\n" ,
332
+ " exit_code" : 0
333
+ }
334
+ ]
335
+ ` ` `
336
+
337
+ Note that in the example, the API is only accessible internally. To make it
338
+ accessible publicly, we need to properly configure the ` service` section in
339
+ ` values.yaml` .
340
+
341
+ In particular, we would like to set the type to ` NodePort` and then set an open
342
+ port on the host machine at which the API is exposed. For example, with
343
+
344
+ ` ` ` yaml
345
+ service:
346
+ type: " NodePort"
347
+ node_port: " 31567"
348
+ ` ` `
349
+
350
+ Kubernetes will route requests coming in to port ` 31567` on the host machine to
351
+ port ` 8080` on the pod.
352
+
353
+ Let' s confirm this by upgrading the Helm chart and again inspecting the services
354
+ in our namespace with:
355
+
356
+ ```bash
357
+ microk8s helm3 upgrade -n NAMESPACE RELEASE_NAME . -f secrets.yaml -f values.yaml
358
+ microk8s kubectl get svc -n NAMESPACE
359
+ ```
360
+
361
+ We should get an output like this:
362
+
363
+ ```console
364
+ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
365
+ tesk-api NodePort 123.123.123.111 <none> 8080:31567/TCP 5s
366
+ ```
367
+
368
+ Indeed, the port section changed as expected. Now, note that the `CLUSTER-IP`
369
+ _also_ changed. However, this is not a problem as Kubernetes will manage the
370
+ routing, so we don' t really need to know the ` CLUSTER-IP` . Instead, now we can
371
+ use the hostname (or IP) of the host machine, together with the port we set to
372
+ call our TES API from anywhere:
373
+
374
+ ` ` `
375
+ curl http://HOST_NAME_OR_IP:31567/ga4gh/tes/v1/tasks
376
+ ` ` `
377
+
378
+ > Of course you need to make sure that the port you selected is opened for
379
+ > public access. This will depend on your router/firewall settings.
380
+
381
+ If you would like to tear down the TESK service, simply run:
382
+
383
+ ` ` ` bash
384
+ microk8s helm uninstall RELEASE_NAME -n NAMESPACE
385
+ ` ` `
386
+
182
387
# ### Deploying Funnel
183
388
184
389
Follow these instructions if you wish to deploy a TES endpoint in front of your
0 commit comments